Skip to content

Commit

Permalink
Workflow test
Browse files Browse the repository at this point in the history
  • Loading branch information
svanaeinars committed Nov 18, 2024
1 parent c3f0dbf commit 3e2cbf3
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 5 deletions.
63 changes: 58 additions & 5 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:

outputs:
TEST_CHUNKS: ${{ steps.test_projects.outputs.CHUNKS }}
E2E_CI_CHUNKS: ${{ steps.e2e_ci_projects.outputs.CHUNKS }}
E2E_CHUNKS: ${{ steps.e2e_projects.outputs.CHUNKS }}
E2E_CI_BUILD_ID: ${{ steps.e2e_ci_projects.outputs.BUILD_ID }}
E2E_BUILD_ID: ${{ steps.e2e_projects.outputs.BUILD_ID }}
LINT_CHUNKS: ${{ steps.lint_projects.outputs.CHUNKS }}
BUILD_CHUNKS: ${{ steps.build_projects.outputs.CHUNKS }}
Expand Down Expand Up @@ -141,13 +143,25 @@ jobs:
echo "CHUNKS={\"projects\":$CHUNKS}" >> "$GITHUB_OUTPUT"
fi
- name: Prepare e2e-ci targets
id: e2e_ci_projects
env:
CHUNK_SIZE: 1
run: |
set -euo pipefail
CHUNKS="$(./scripts/ci/generate-chunks.sh e2e-ci)"
if [[ "$CHUNKS" != "[]" ]]; then
echo "CHUNKS={\"projects\":$CHUNKS}" >> "$GITHUB_OUTPUT"
fi
echo BUILD_ID="$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER-$(uuidgen)" >> "$GITHUB_OUTPUT"
- name: Prepare e2e targets
id: e2e_projects
env:
CHUNK_SIZE: 1
run: |
set -euo pipefail
CHUNKS="$(./scripts/ci/generate-chunks.sh e2e-ci)"
CHUNKS="$(./scripts/ci/generate-chunks.sh e2e)"
if [[ "$CHUNKS" != "[]" ]]; then
echo "CHUNKS={\"projects\":$CHUNKS}" >> "$GITHUB_OUTPUT"
fi
Expand Down Expand Up @@ -213,10 +227,10 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
docker-registry: 821090935708.dkr.ecr.eu-west-1.amazonaws.com/

e2e:
e2e-ci:
needs:
- prepare
if: needs.prepare.outputs.E2E_CHUNKS
if: needs.prepare.outputs.E2E_CI_CHUNKS
runs-on: ec2-runners
container:
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
Expand All @@ -227,10 +241,10 @@ jobs:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
API_MOCKS: 'true'
NODE_OPTIONS: --max-old-space-size=4096
E2E_BUILD_ID: '${{ needs.prepare.outputs.E2E_BUILD_ID }}-${{ github.run_attempt }}'
E2E_CI_BUILD_ID: '${{ needs.prepare.outputs.E2E_CI_BUILD_ID }}-${{ github.run_attempt }}'
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.E2E_CHUNKS) }}
matrix: ${{ fromJson(needs.prepare.outputs.E2E_CI_CHUNKS) }}
steps:
- uses: actions/checkout@v4

Expand All @@ -252,6 +266,42 @@ jobs:
- name: Running e2e tests
run: ./scripts/ci/40_e2e.sh "${AFFECTED_PROJECT}"

e2e:
needs:
- prepare
if: needs.prepare.outputs.E2E_CHUNKS
runs-on: ec2-runners
container:
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
timeout-minutes: 35
env:
AFFECTED_PROJECT: ${{ matrix.projects }}
NODE_OPTIONS: --max-old-space-size=4096
E2E_BUILD_ID: '${{ needs.prepare.outputs.E2E_BUILD_ID }}-${{ github.run_attempt }}'
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.E2E_CHUNKS) }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: 'package.json'

- name: Setup yarn
run: corepack enable

- name: Get cache
id: get-cache
uses: ./.github/actions/get-cache
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
keys: ${{ needs.prepare.outputs.CACHE_KEYS }}
enable-cache: 'node_modules,generated-files'

- name: Running e2e tests
run: yarn e2e "${AFFECTED_PROJECT}"

linting-workspace:
needs:
- prepare
Expand Down Expand Up @@ -410,13 +460,16 @@ jobs:
- linting
- run-shellcheck
- formatting
- e2e-ci
- e2e
- build
steps:
- name: Check prepare success
run: '[[ ${{ needs.prepare.result }} == "success" ]] || exit 1'
- name: Check tests success
run: '[[ ${{ needs.tests.result }} != "failure" ]] || exit 1'
- name: Check e2e-ci success
run: '[[ ${{ needs.e2e-ci.result }} != "failure" ]] || exit 1'
- name: Check e2e success
run: '[[ ${{ needs.e2e.result }} != "failure" ]] || exit 1'
- name: Check linting success
Expand Down
1 change: 1 addition & 0 deletions apps/web/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { bootstrap } from '@island.is/infra-next-server'

import proxyConfig from './proxy.config.json'

// test
bootstrap({
name: 'web',
appDir: 'apps/web',
Expand Down

0 comments on commit 3e2cbf3

Please sign in to comment.