Skip to content

Commit

Permalink
test(e2e): split install + run jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
kahboom committed Jun 3, 2024
1 parent 250232b commit daf3e26
Showing 1 changed file with 50 additions and 13 deletions.
63 changes: 50 additions & 13 deletions .github/workflows/e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,8 @@ on:
- cron: '0 2 * * FRI'

jobs:
cypress-run:
install:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
browser: [ chrome, electron ]
env:
- name: no-variable
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: ""
- name: with-variable
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: "https://rekor.sigstore.dev"
env:
CYPRESS_baseUrl: ${{ matrix.env.url }}

steps:
- name: Checkout 🛎
uses: actions/checkout@v4
Expand Down Expand Up @@ -59,8 +47,57 @@ jobs:
sudo apt-get install -y firefox;
fi
- name: Cypress install
uses: cypress-io/github-action@v6
with:
# disable running of tests within install job
runTests: false
build: npm run build

- name: Save build folder
uses: actions/upload-artifact@v4
with:
name: build
if-no-files-found: error
path: build

cypress-run:
runs-on: ubuntu-latest
needs: install
timeout-minutes: 30
strategy:
matrix:
browser: [ chrome, electron ]
env:
- name: no-variable
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: ""
- name: with-variable
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: "https://rekor.sigstore.dev"
env:
CYPRESS_baseUrl: ${{ matrix.env.url }}

steps:
- name: Checkout 🛎
uses: actions/checkout@v4

- name: Download the build folder
uses: actions/download-artifact@v4
with:
name: build
path: .next

- name: Start Next.js app
run: npm run start &
env:
NODE_ENV: ${{ matrix.env.name }}
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: ${{ matrix.env.NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN }}

- name: Wait for Next.js to start
run: npx wait-on http://localhost:3000

- name: Run Cypress tests
run: npx cypress run --browser ${{ matrix.browser }}
uses: cypress-io/github-action@v6
env:
NODE_ENV: ${{ matrix.env.name }}
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: ${{ matrix.env.NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN }}
Expand Down

0 comments on commit daf3e26

Please sign in to comment.