-
Notifications
You must be signed in to change notification settings - Fork 20
85 lines (71 loc) · 2.36 KB
/
e2e-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: E2E Tests
on:
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-e2e-changes:
runs-on: ubuntu-24.04
outputs:
e2e-or-config-changed: ${{ steps.e2e-or-config-files.outputs.e2e-or-config-changed }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch base branch
run: |
git fetch origin "${{ github.base_ref }}:${{ github.base_ref }}"
- name: Check for E2E or Playwright Config File Changes
id: e2e-or-config-files
run: |
if git diff --name-only "origin/${{ github.base_ref }}" HEAD | grep -E "(playwright.config.ts|.env.e2e|canister_e2e_ids.json|e2e/)"; then
echo "e2e-or-config-changed=true" >> "$GITHUB_OUTPUT"
else
echo "e2e-or-config-changed=false" >> "$GITHUB_OUTPUT"
fi
shell: bash
continue-on-error: false
oisy-backend-wasm:
if: ${{ needs.check-e2e-changes.outputs.e2e-or-config-changed == 'true' }}
runs-on: ubuntu-24.04
needs: check-e2e-changes
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build oisy-backend WASM
uses: ./.github/actions/oisy-backend
e2e:
if: ${{ needs.check-e2e-changes.outputs.e2e-or-config-changed == 'true' }}
runs-on: ubuntu-24.04
needs: oisy-backend-wasm
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy the backend
uses: ./.github/actions/deploy-backend
- name: Prepare
uses: ./.github/actions/prepare
- name: Test
run: npm run e2e:ci
- uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
may-merge-e2e:
if: always()
needs: ['check-e2e-changes', 'e2e']
runs-on: ubuntu-24.04
steps:
- name: Cleared for merging
run: |
if [ "${{ needs.check-e2e-changes.outputs.e2e-or-config-changed }}" == "false" ]; then
echo "No E2E or config changes detected. PR is cleared for merging."
elif [ "${{ needs.e2e.result }}" == "success" ]; then
echo "This PR is cleared for merging"
else
echo "This PR is not cleared for merging"
exit 1
fi