Skip to content

CypressMatrix

CypressMatrix #232

name: CypressMatrix
"on":
push:
branches:
- cypress-matrix/**
schedule:
- cron: 30 5 * * 1,3
jobs:
cypress-run:
name: Cypress browser tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
dummy1:
- 1
- 2
- 3
- 4
- 5
- 6
dummy2:
- 1
- 2
- 3
- 4
- 5
- 6
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: "18"
- name: Cache node modules, firebase emulators and cypress
uses: actions/cache@v3
with:
path: |
~/.rush
~/.pnpm-store
common/temp
**/node_modules
~/.cache/firebase/emulators
~/.cache/Cypress
key: ${{ runner.os }}-modules-emulators-cypress-node18-v2-${{ hashFiles('**/pnpm-lock.yaml', '**/package.json', 'common/config/rush/repo-state.json') }}
- name: Add rush directory to PATH
run: echo PATH=$PWD/common/scripts/:$PATH >> $GITHUB_ENV
- name: Install dependencies
run: rush update
- name: Build eisbuk packages
run: rush build
- name: Build app
run: cd packages/client && NODE_OPTIONS="--max-old-space-size=8192" rushx build:test
- name: Cypress run
uses: cypress-io/github-action@v4
with:
start: emulators-start
install: false
working-directory: packages/e2e
wait-on: http://localhost:8080, http://localhost:5000
record: false
config-file: cypress-ci.config.ts
- name: Check if secrets are available
id: has_secret
if: success() || failure()
run: '[ "${{ secrets.CYPRESS_KEY }}" != "" ] && echo HAS_SECRETS=true >> $GITHUB_OUTPUT || echo HAS_SECRETS= >> $GITHUB_OUTPUT'
- name: Coveralls
uses: coverallsapp/github-action@master
if: steps.has_secret.outputs.HAS_SECRETS
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: packages/e2e/coverage/lcov.info
base-path: packages/e2e
flag-name: run-cypress
parallel: true
- name: Create file with gcloud cretentials
if: (success() || failure()) && steps.has_secret.outputs.HAS_SECRETS
run: echo "${{ secrets.GCLOUD_JSON_BASE64 }}" | base64 -d > .gcloud.json
- name: Set destination of test results
if: (success() || failure()) && steps.has_secret.outputs.HAS_SECRETS
run: echo "RESULTS_DESTINATION=$(date +%Y-%m-%d)/${{ github.run_id }}-${{ matrix.dummy1 }}-${{ matrix.dummy2 }}" >> $GITHUB_OUTPUT
id: results-destination
- name: Install rclone
if: (success() || failure()) && steps.has_secret.outputs.HAS_SECRETS
run: |
curl https://rclone.org/install.sh | sudo bash
mkdir -p ~/.config/rclone
echo "${RCLONE_CONF}" > ~/.config/rclone/rclone.conf
env:
RCLONE_CONF: |
[gcloud]
type = google cloud storage
service_account_file = ${{ github.workspace }}/.gcloud.json
object_acl = publicRead
bucket_acl = publicRead
bucket_policy_only = true
- name: Copy test results to gcloud
if: (success() || failure()) && steps.has_secret.outputs.HAS_SECRETS
run: |
rclone copy packages/e2e/reports/html/ gcloud:cypress-logs-bucket/${{ steps.results-destination.outputs.RESULTS_DESTINATION }}/ --log-level INFO
rclone copy packages/e2e/coverage/ gcloud:cypress-logs-bucket/${{ steps.results-destination.outputs.RESULTS_DESTINATION }}/coverage-cypress --log-level INFO
- name: Print gcloud url to view test results
if: (success() || failure()) && steps.has_secret.outputs.HAS_SECRETS
run: |
mkdir result_tabs
echo Check out test results at https://storage.googleapis.com/cypress-logs-bucket/${{ steps.results-destination.outputs.RESULTS_DESTINATION }}/index.html
echo Check out coverage result: https://storage.googleapis.com/cypress-logs-bucket/${{ steps.results-destination.outputs.RESULTS_DESTINATION }}/coverage-cypress/index.html
echo "[Check out test results](https://storage.googleapis.com/cypress-logs-bucket/${{ steps.results-destination.outputs.RESULTS_DESTINATION }}/index.html)" > result_tabs/cypress.md
echo "[Check out coverage result](https://storage.googleapis.com/cypress-logs-bucket/${{ steps.results-destination.outputs.RESULTS_DESTINATION }}/coverage-cypress/lcov-report/index.html)" >> result_tabs/cypress.md