-
Notifications
You must be signed in to change notification settings - Fork 21
88 lines (86 loc) · 3.43 KB
/
on_pull_request_label.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
86
87
88
name: Run E2E tests when PR labeled
on:
pull_request:
types:
- labeled
env:
LABEL_READY: e2e-ready
LABEL_TESTING: e2e-testing
LABEL_COMPLETED: e2e-completed
NODE_VERSION: 20
AWS_REGION: eu-west-1
jobs:
set-progress-label:
# Note: env is not available for the job level 'if', so hard coded value here
if: ${{ github.event.label.name == 'e2e-ready' }}
name: Set in-progress label
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
actions: read
steps:
- name: Assign label ${{ env.LABEL_TESTING }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
github.rest.issues.removeLabel({...context.repo, issue_number: context.issue.number, name: '${{ env.LABEL_READY }}'});
try {
await github.rest.issues.removeLabel({...context.repo, issue_number: context.issue.number, name: '${{ env.LABEL_COMPLETED }}'});
} catch(e) { /* OK to fail, this label might be missing */ }
github.rest.issues.addLabels({...context.repo, issue_number: context.issue.number, labels: ['${{ env.LABEL_TESTING }}']});
run-e2e-tests-on-request:
name: Run E2E tests on request
needs: set-progress-label
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
actions: read
id-token: write # needed to interact with GitHub's OIDC Token endpoint
strategy:
matrix:
suite: [processing, storage, governance, utils, consumption, streaming]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup NodeJS and dependency cache
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: |
yarn.lock
framework/yarn.lock
solutions/yarn.lock
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
- name: Build
run: npx projen build
- name: Setup AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
aws-region: ${{ env.AWS_REGION }}
role-duration-seconds: 10800
- name: Run e2e tests
run: cd framework && npx jest --group=e2e/${{ matrix.suite }}
set-completed-label:
name: Set completed label
needs: [set-progress-label, run-e2e-tests-on-request]
if: always() && needs.set-progress-label.result == 'success'
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
actions: read
steps:
- name: Assign label ${{ env.LABEL_COMPLETED }}
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
script: |
github.rest.issues.addLabels({...context.repo, issue_number: context.issue.number, labels: ['${{ env.LABEL_COMPLETED }}']});
try {
await github.rest.issues.removeLabel({...context.repo, issue_number: context.issue.number, name: '${{ env.LABEL_TESTING }}'});
} catch(e) { /* OK to fail, this label might be missing when re-running single test-jobs*/ }