1
+ name : Run AWS tests
2
+
3
+ on :
4
+ pull_request_target :
5
+ branches : [main]
6
+ # opened, reopened and synchronize will cause the workflow to fail on forks due to permissions
7
+ # once labeled, that will then be overridden by the is-collaborator job
8
+ types : [opened, labeled, synchronize, reopened]
9
+
10
+ jobs :
11
+ is-collaborator :
12
+ runs-on : ubuntu-latest
13
+ steps :
14
+ - name : Get User Permission
15
+ id : checkAccess
16
+ uses : actions-cool/check-user-permission@cd622002ff25c2311d2e7fb82107c0d24be83f9b
17
+ with :
18
+ require : write
19
+ username : ${{ github.actor }}
20
+ env :
21
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
22
+ - name : Check User Permission
23
+ if : steps.checkAccess.outputs.require-result == 'false'
24
+ run : |
25
+ echo "${{ github.actor }} does not have permissions on this repo."
26
+ echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
27
+ exit 1
28
+
29
+ publish-branch-image :
30
+ if : contains( github.event.pull_request.labels.*.name, 'run-aws-tests' )
31
+ needs : is-collaborator
32
+ uses : ./.github/workflows/docker-ecs-worker-image.yml
33
+ permissions :
34
+ contents : read
35
+ id-token : write
36
+ secrets :
37
+ ECR_WORKER_IMAGE_PUSH_ROLE_ARN : ${{ secrets.ECR_WORKER_IMAGE_PUSH_ROLE_ARN }}
38
+ with :
39
+ ref : ${{ github.event.pull_request.head.sha || null }} # this should only be run with this ref if is-collaborator has been run and passed
40
+
41
+ run-tests :
42
+ if : contains( github.event.pull_request.labels.*.name, 'run-aws-tests' )
43
+ needs : publish-branch-image
44
+ timeout-minutes : 40
45
+ runs-on : ubuntu-latest
46
+ permissions :
47
+ contents : read
48
+ id-token : write
49
+ steps :
50
+ - uses : actions/checkout@v3
51
+ with :
52
+ ref : ${{ github.event.pull_request.head.sha || null }} # this should only be run with this ref if is-collaborator has been run and passed
53
+ - name : Configure AWS Credentials
54
+ uses : aws-actions/configure-aws-credentials@v2
55
+ env :
56
+ SHOW_STACK_TRACE : true
57
+ with :
58
+ aws-region : eu-west-1
59
+ role-to-assume : ${{ secrets.ARTILLERY_AWS_CLI_ROLE_ARN_TEST1 }}
60
+ role-session-name : OIDCSession
61
+ mask-aws-account-id : true
62
+ - name : Use Node.js 18.x
63
+ uses : actions/setup-node@v2
64
+ with :
65
+ node-version : 18.x
66
+ - run : npm install
67
+ - run : npm run build
68
+ - run : npm run test:aws --workspace artillery
69
+ env :
70
+ FORCE_COLOR : 1
71
+ ECR_IMAGE_VERSION : ${{ github.sha }} # the image is published with the sha of the commit within this repo
0 commit comments