fix: use github actions artifact to provide frontend e2e to cypress containers

something in our CI setup lets turbo believe that the environment has
changed so much that the build can't be restored from the cache.
Therefore all the cypress jobs are rebuilding the frontend on their own.
It probably has something to do with the fact that the cypress jobs are not
running with the ubuntu image but with the cypress docker image.
I couldn't find out how to fix this, so I changed the CI to use a GitHub
actions artifact.

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-04-18 10:38:04 +02:00
parent 9e16f865c9
commit d66ab3a8e1

View file

@ -132,10 +132,21 @@ jobs:
run: yarn turbo run build:test --filter=frontend run: yarn turbo run build:test --filter=frontend
shell: bash shell: bash
env: env:
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_API: ${{ vars.TURBO_API }} TURBO_API: ${{ vars.TURBO_API }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }} TURBO_TEAM: ${{ vars.TURBO_TEAM }}
- name: Compress build
run: tar --exclude='frontend/.next/cache' --exclude='frontend/.next/standalone' --zstd -cf frontend-e2e-build.tar.zst frontend/.next/
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: frontend-e2e-build
retention-days: 1
path: frontend-e2e-build.tar.zst
frontend-cypress: frontend-cypress:
if: "(github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork" if: "(github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork"
needs: frontend-build needs: frontend-build
@ -148,25 +159,26 @@ jobs:
matrix: matrix:
containers: [ 1, 2, 3 ] containers: [ 1, 2, 3 ]
steps: steps:
- name: Install jq and zstd
run: apt-get update && apt-get install -y jq zstd
- name: Check out repo - name: Check out repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
ref: ${{ env.HEAD_COMMIT_HASH }}
- name: Setup node - name: Setup node
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
with: with:
NODEJS_VERSION: ${{ env.NODEJS_VERSION }} NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
- name: Install jq - name: Download build
run: apt-get update && apt-get install -y jq uses: actions/download-artifact@v3
with:
name: frontend-e2e-build
- name: Build test production build - name: Decompress build
run: yarn turbo run build:test --filter=frontend run: tar -xf frontend-e2e-build.tar.zst
shell: bash
env:
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_API: ${{ vars.TURBO_API }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
- name: Run server - name: Run server
working-directory: frontend/ working-directory: frontend/
@ -181,7 +193,6 @@ jobs:
run: yarn turbo run test:e2e:ci --filter=frontend run: yarn turbo run test:e2e:ci --filter=frontend
shell: bash shell: bash
env: env:
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}