Skip to content

Commit

Permalink
simplify setup
Browse files Browse the repository at this point in the history
  • Loading branch information
kahboom committed Jun 3, 2024
1 parent 5fd35ca commit 361bc27
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 62 deletions.
54 changes: 37 additions & 17 deletions .github/workflows/e2e-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cross Browser End-to-End Testing (Cypress) 🚀
name: End-to-End Testing (Cypress) 🚀

on:
push:
Expand All @@ -13,32 +13,52 @@ jobs:
cypress-run:
runs-on: ubuntu-latest
timeout-minutes: 30

services:
docker:
image: docker:20.10.8
options: --privileged
strategy:
matrix:
browser: [ chrome, electron ]
env:
- name: no-variable
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: ""
- name: with-variable
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: "https://this-is-a-test.com"
env:
CYPRESS_baseUrl: ${{ matrix.env.url }}

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install dependencies
run: npm install

- name: Build and run Docker Compose 🐳
- name: Start Next.js app
run: npm run start &
env:
NODE_ENV: production
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: https://rekor.sigstore.dev
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: docker-compose up --build -d
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: Wait for services to start ⏱️
run: docker-compose logs -f --tail="all" | grep -m 1 "listening on port"
- name: Install browsers for Cypress
run: |
if [[ "${{ matrix.browser }}" == "chrome" ]]; then
sudo apt-get install -y google-chrome-stable;
elif [[ "${{ matrix.browser }}" == "firefox" ]]; then
sudo apt-get install -y firefox;
fi
- name: Run Cypress tests
run: docker-compose run cypress
run: npx cypress run --browser ${{ matrix.browser }}
env:
NODE_ENV: ${{ matrix.env.name }}
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: ${{ matrix.env.NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN }}
CYPRESS_baseUrl: "http://localhost:3000"

- name: Upload Electron artifacts 📸
uses: actions/upload-artifact@v4
Expand Down
16 changes: 0 additions & 16 deletions cypress.Dockerfile

This file was deleted.

29 changes: 0 additions & 29 deletions docker-compose.yaml

This file was deleted.

0 comments on commit 361bc27

Please sign in to comment.