-
Notifications
You must be signed in to change notification settings - Fork 154
108 lines (106 loc) · 4.19 KB
/
run-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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Run e2e Tests
on:
workflow_dispatch:
inputs:
prNumber:
description: "(Optional) PR Number. If you specify a value the value of the branch field will be ignored."
required: false
default: ""
jobs:
run-e2e-tests-on-utils:
runs-on: ubuntu-latest
env:
NODE_ENV: dev
PR_NUMBER: ${{ inputs.prNumber }}
permissions:
id-token: write # needed to interact with GitHub's OIDC Token endpoint.
contents: read
strategy:
matrix:
package: [logger, metrics, tracer, parameters]
version: [14, 16, 18]
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
# If we pass a PR Number when triggering the workflow we will retrieve the PR info and get its headSHA
- name: Extract PR details
id: extract_PR_details
if: ${{ inputs.prNumber != '' }}
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
script: |
const script = require('.github/scripts/get_pr_info.js');
await script({github, context, core});
# Only if a PR Number was passed and the headSHA of the PR extracted,
# we checkout the PR at that point in time
- name: Checkout PR code
if: ${{ inputs.prNumber != '' }}
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
ref: ${{ steps.extract_PR_details.outputs.headSHA }}
- name: Setup NodeJS
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.version }}
- name: Setup dependencies
uses: ./.github/actions/cached-node-modules
with:
nodeVersion: ${{ matrix.version }}
- name: Setup AWS credentials
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
aws-region: eu-west-1
- name: Run integration tests on utils
run: |
RUNTIME=nodejs${{ matrix.version }}x npm run test:e2e -w packages/${{ matrix.package }}
layer-e2e-tests:
runs-on: ubuntu-latest
env:
NODE_ENV: dev
PR_NUMBER: ${{ inputs.prNumber }}
permissions:
id-token: write # needed to interact with GitHub's OIDC Token endpoint.
contents: read
strategy:
fail-fast: false
matrix:
version: [14, 16, 18]
steps:
- name: Checkout Repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
# If we pass a PR Number when triggering the workflow we will retrieve the PR info and get its headSHA
- name: Extract PR details
id: extract_PR_details
if: ${{ inputs.prNumber != '' }}
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
script: |
const script = require('.github/scripts/get_pr_info.js');
await script({github, context, core});
# Only if a PR Number was passed and the headSHA of the PR extracted,
# we checkout the PR at that point in time
- name: Checkout PR code
if: ${{ inputs.prNumber != '' }}
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
ref: ${{ steps.extract_PR_details.outputs.headSHA }}
- name: Setup NodeJS
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
# Always use version 18
node-version: 18
- name: Setup dependencies
uses: ./.github/actions/cached-node-modules
- name: "Configure AWS credentials"
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
aws-region: eu-west-1
- name: Create layer files
run: |
export VERSION=latest
bash .github/scripts/setup_tmp_layer_files.sh
- name: Run integration test on layers
run: RUNTIME=nodejs${{ matrix.version }}x npm run test:e2e -w layers