mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-04-05 00:56:40 +00:00
refactor(workflow): all e2e are running in parallel (#9205)
This commit is contained in:
parent
0d617c46c6
commit
9b6d2bbbba
46
.github/workflows/test-e2e.yml
vendored
46
.github/workflows/test-e2e.yml
vendored
@ -105,17 +105,30 @@ jobs:
|
|||||||
/home/runner/work/Ocelot-Social/Ocelot-Social
|
/home/runner/work/Ocelot-Social/Ocelot-Social
|
||||||
key: ${{ github.run_id }}-e2e-cypress
|
key: ${{ github.run_id }}-e2e-cypress
|
||||||
|
|
||||||
fullstack_tests:
|
list_features:
|
||||||
name: Fullstack | tests
|
name: List Feature Files
|
||||||
if: success()
|
runs-on: ubuntu-latest
|
||||||
needs: [prepare_backend_environment, prepare_webapp_image, prepare_cypress]
|
outputs:
|
||||||
|
features: ${{ steps.list.outputs.features }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
|
||||||
|
|
||||||
|
- name: List feature files
|
||||||
|
id: list
|
||||||
|
run: |
|
||||||
|
FEATURES=$(find cypress/e2e/ -maxdepth 1 -name "*.feature" -printf '%f\n' | sort | jq -R -s -c 'split("\n") | map(select(length > 0))')
|
||||||
|
echo "features=$FEATURES" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
fullstack_tests:
|
||||||
|
name: E2E | ${{ matrix.feature }}
|
||||||
|
if: success()
|
||||||
|
needs: [prepare_backend_environment, prepare_webapp_image, prepare_cypress, list_features]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
jobs: 8
|
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
# run copies of the current job in parallel
|
feature: ${{ fromJson(needs.list_features.outputs.features) }}
|
||||||
job: [1, 2, 3, 4, 5, 6, 7, 8]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Delete huge unnecessary tools folder
|
- name: Delete huge unnecessary tools folder
|
||||||
run: rm -rf /opt/hostedtoolcache
|
run: rm -rf /opt/hostedtoolcache
|
||||||
@ -171,7 +184,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Full stack tests | run tests
|
- name: Full stack tests | run tests
|
||||||
id: e2e-tests
|
id: e2e-tests
|
||||||
run: yarn run cypress:run --spec $(cypress/parallel-features.sh ${{ matrix.job }} ${{ env.jobs }} )
|
run: yarn run cypress:run --spec "cypress/e2e/${{ matrix.feature }}"
|
||||||
|
|
||||||
- name: Full stack tests | if tests failed, compile html report
|
- name: Full stack tests | if tests failed, compile html report
|
||||||
if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }}
|
if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }}
|
||||||
@ -184,6 +197,19 @@ jobs:
|
|||||||
if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }}
|
if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }}
|
||||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||||
with:
|
with:
|
||||||
name: ocelot-e2e-test-report-pr${{ needs.docker_preparation.outputs.pr-number }}
|
name: e2e-report-${{ matrix.feature }}
|
||||||
path: /home/runner/work/Ocelot-Social/Ocelot-Social/cypress/reports/cucumber_html_report
|
path: /home/runner/work/Ocelot-Social/Ocelot-Social/cypress/reports/cucumber_html_report
|
||||||
|
|
||||||
|
e2e_status:
|
||||||
|
name: E2E | Status
|
||||||
|
if: always()
|
||||||
|
needs: [fullstack_tests]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check E2E results
|
||||||
|
run: |
|
||||||
|
if [ "${{ needs.fullstack_tests.result }}" != "success" ]; then
|
||||||
|
echo "E2E tests failed or were cancelled (result: ${{ needs.fullstack_tests.result }})"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user