skipping tests conditionally #6303
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Client Tests | |
on: | |
push: | |
paths: | |
- 'client/**' | |
- '.github/workflows/testing-client.yml' | |
workflow_dispatch: | |
env: | |
NODE_ENV: production | |
jobs: | |
testing-client: | |
name: Running client tests | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
defaults: | |
run: | |
working-directory: ${{github.workspace}}/client | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Use Node.js 18.13 | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: 'client/.nvmrc' | |
cache: 'yarn' | |
cache-dependency-path: client/yarn.lock | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Cypress run | |
# ! REMOVE THIS LINE IF YOU PLAN TO MERGE THIS CODE INTO THE MAIN BRANCH AND THE ENV VAR IN GITHUB ACTIONS | |
if: ${{ env.CYPRESS_SKIP_TESTS == 'undefined' }} | |
uses: cypress-io/github-action@v5 | |
with: | |
record: true | |
working-directory: client | |
install: false | |
build: yarn build | |
start: yarn start | |
browser: chrome | |
wait-on: http://localhost:3000/auth/signin | |
config-file: cypress.config.ts | |
command-prefix: yarn dlx | |
command: "yarn test:e2e" | |
env: | |
NEXT_PUBLIC_MAPBOX_API_TOKEN: ${{ secrets.NEXT_PUBLIC_MAPBOX_API_TOKEN }} | |
NEXT_PUBLIC_API_URL: ${{ secrets.CYPRESS_API_URL }} | |
NEXT_TELEMETRY_DISABLED: 1 | |
NEXTAUTH_URL: http://localhost:3000 | |
NEXTAUTH_SECRET: nyanpony | |
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }} | |
CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }} | |
CYPRESS_API_URL: ${{ secrets.CYPRESS_API_URL }} | |
# pass GitHub token to detect new build vs re-run build | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
DEBUG: "cypress:server:args" | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: ${{github.workspace}}/client/cypress/screenshots |