|
1 |
| -name: 'Non Regression Testing (EU) - APMs' |
| 1 | +name: Non Regression Testing (EU) (inactive) |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | workflow_dispatch:
|
5 |
| - |
6 |
| -env: |
7 |
| - FOLDER: apm |
| 5 | +# schedule: |
| 6 | +# - cron: "0 9 * * 1-5" |
| 7 | +# push: |
| 8 | +# branches: [ main ] |
8 | 9 |
|
9 | 10 | jobs:
|
10 | 11 | log-context:
|
11 |
| - name: Contexts |
12 | 12 | runs-on: ubuntu-latest
|
13 | 13 | steps:
|
14 |
| - - name: GitHub |
| 14 | + # Dump all contexts |
| 15 | + - name: Dump GitHub context |
15 | 16 | env:
|
16 | 17 | GITHUB_CONTEXT: ${{ toJson(github) }}
|
17 | 18 | run: echo "$GITHUB_CONTEXT"
|
18 |
| - - name: Runner |
| 19 | + - name: Dump job context |
| 20 | + env: |
| 21 | + JOB_CONTEXT: ${{ toJson(job) }} |
| 22 | + run: echo "$JOB_CONTEXT" |
| 23 | + - name: Dump steps context |
| 24 | + env: |
| 25 | + STEPS_CONTEXT: ${{ toJson(steps) }} |
| 26 | + run: echo "$STEPS_CONTEXT" |
| 27 | + - name: Dump runner context |
19 | 28 | env:
|
20 | 29 | RUNNER_CONTEXT: ${{ toJson(runner) }}
|
21 | 30 | run: echo "$RUNNER_CONTEXT"
|
22 |
| - |
23 |
| - get-files: |
24 |
| - name: Test Definition Files |
| 31 | + - name: Dump strategy context |
| 32 | + env: |
| 33 | + STRATEGY_CONTEXT: ${{ toJson(strategy) }} |
| 34 | + run: echo "$STRATEGY_CONTEXT" |
| 35 | + - name: Dump matrix context |
| 36 | + env: |
| 37 | + MATRIX_CONTEXT: ${{ toJson(matrix) }} |
| 38 | + run: echo "$MATRIX_CONTEXT" |
| 39 | + get-test-definition-files: |
| 40 | + name: Get Test Definition Files |
25 | 41 | runs-on: ubuntu-latest
|
26 | 42 | outputs:
|
27 |
| - matrix: ${{ steps.get-files.outputs.result }} |
| 43 | + matrix: ${{ steps.get-test-definition-files.outputs.result }} |
28 | 44 | steps:
|
29 | 45 | - name: Checkout Repo
|
30 |
| - uses: actions/checkout@v3 |
| 46 | + uses: actions/checkout@v2 |
31 | 47 | with:
|
32 | 48 | fetch-depth: 0
|
33 |
| - - name: Get Files |
34 |
| - id: get-files |
35 |
| - uses: actions/github-script@v6 |
| 49 | + - name: Get Test Definition Files |
| 50 | + id: get-test-definition-files |
| 51 | + uses: actions/github-script@v3 |
36 | 52 | with:
|
37 | 53 | script: |
|
38 |
| - const fs = require('fs'); |
| 54 | + const fs = require("fs"); |
39 | 55 | const fsp = fs.promises;
|
40 |
| - const path = require('path'); |
| 56 | + const path = require("path"); |
41 | 57 |
|
42 |
| - const { FOLDER } = process.env |
| 58 | + const { isOHIValidationTimeout } = require("${{ github.workspace }}/.github/workflows/scripts/ohiValidationTimeout"); |
43 | 59 |
|
44 | 60 | // readdir recursive directory search
|
45 | 61 | const { readdir } = fsp;
|
46 | 62 | async function getFiles(dir) {
|
47 |
| - const dirents = await readdir(dir, { withFileTypes: true }); |
48 |
| - const files = await Promise.all(dirents.map((dirent) => { |
49 |
| - const res = path.join(dir, dirent.name); |
50 |
| - return dirent.isDirectory() ? getFiles(res) : res; |
51 |
| - })); |
52 |
| - return Array.prototype.concat(...files); |
| 63 | + const dirents = await readdir(dir, { withFileTypes: true }); |
| 64 | + const files = await Promise.all( |
| 65 | + dirents.map((dirent) => { |
| 66 | + const res = path.join(dir, dirent.name); |
| 67 | + return dirent.isDirectory() ? getFiles(res) : res; |
| 68 | + }) |
| 69 | + ); |
| 70 | + return Array.prototype.concat(...files); |
53 | 71 | }
|
54 |
| - const definitionsDir = 'test/definitions-eu'; |
55 |
| - const testDefinitions = await getFiles(definitionsDir + '/' + `${FOLDER}`); |
56 | 72 |
|
57 |
| - const outputTestFilesMap = testDefinitions.map(testDefinitionFile => { |
58 |
| - return { testDefinitionFile, 'testDisplayName': testDefinitionFile.replace(`${definitionsDir}/`, '') } |
59 |
| - }) |
| 73 | + const definitionsDir = "test/definitions-eu"; |
| 74 | + const testDefinitions = await getFiles(definitionsDir); |
| 75 | +
|
| 76 | + const outputTestFilesMap = testDefinitions |
| 77 | + .filter((testDefinitionFile) => !isOHIValidationTimeout(testDefinitionFile)) |
| 78 | + .map((testDefinitionFile) => { |
| 79 | + return { |
| 80 | + testDefinitionFile, |
| 81 | + testDisplayName: testDefinitionFile.replace(`${definitionsDir}/`, ""), |
| 82 | + }; |
| 83 | + }); |
60 | 84 | const output = {
|
61 |
| - "include": outputTestFilesMap |
62 |
| - } |
| 85 | + include: outputTestFilesMap, |
| 86 | + }; |
63 | 87 | console.log(output);
|
64 | 88 | return output;
|
65 | 89 |
|
66 | 90 | test-deploy-recipe:
|
67 | 91 | name: ${{ matrix.testDisplayName }}
|
68 |
| - needs: [get-files] |
69 |
| - if: ${{ fromJSON(needs.get-files.outputs.matrix).include[0] }} # Avoids empty matrix validation error |
| 92 | + needs: [get-test-definition-files] |
| 93 | + if: ${{ fromJSON(needs.get-test-definition-files.outputs.matrix).include[0] }} # Avoids empty matrix validation error |
70 | 94 | runs-on: ubuntu-latest
|
71 | 95 | strategy:
|
72 |
| - matrix: ${{ fromJSON(needs.get-files.outputs.matrix) }} |
| 96 | + matrix: ${{ fromJSON(needs.get-test-definition-files.outputs.matrix) }} |
73 | 97 | fail-fast: false
|
74 | 98 | env:
|
75 | 99 | MATRIX: ${{ toJSON(matrix) }}
|
76 | 100 | steps:
|
77 | 101 | - name: Checkout Repo
|
78 |
| - uses: actions/checkout@v3 |
| 102 | + uses: actions/checkout@v2 |
79 | 103 | with:
|
80 | 104 | fetch-depth: 0
|
81 | 105 |
|
82 |
| - - name: Update Files URLs |
83 |
| - id: get-files |
| 106 | + - name: Update Test Definition Files URLs |
| 107 | + id: get-test-definition-files |
84 | 108 | env:
|
85 | 109 | TEST_DEFINITION_FILE: ${{ matrix.testDefinitionFile }}
|
86 |
| - uses: actions/github-script@v6 |
| 110 | + uses: actions/github-script@v3 |
87 | 111 | with:
|
88 | 112 | script: |
|
89 | 113 | const fs = require('fs');
|
@@ -124,61 +148,33 @@ jobs:
|
124 | 148 |
|
125 | 149 | return testDefinitionFile;
|
126 | 150 |
|
127 |
| - - name: Setup Certificate |
128 |
| - env: |
129 |
| - AWS_PEM: ${{ secrets.GIT_DEPLOYER_CANADA_AWS_PEM }} |
130 |
| - run: | |
131 |
| - mkdir -p configs |
132 |
| - rm -f configs/gitdeployerCanada.pem |
133 |
| - echo "$AWS_PEM" > configs/gitdeployerCanada.pem |
134 |
| - sudo chmod 400 configs/gitdeployerCanada.pem |
135 |
| -
|
136 |
| - - name: Write Tests Files |
137 |
| - env: |
138 |
| - USER_JSON: ${{ secrets.GIT_DEPLOYER_DOCKER_USER_CONFIG_EU }} |
139 |
| - run: | |
140 |
| - echo "$USER_JSON" > configs/gitusdkreu${{ github.run_id }}.json |
141 |
| -
|
142 |
| - - name: Pull Deployer Image |
143 |
| - run: | |
144 |
| - docker pull newrelic/deployer:latest |
145 |
| - docker images newrelic/deployer:latest |
146 |
| -
|
147 |
| - - name: Run Deployer |
148 |
| - id: deployerRun |
149 |
| - run: | |
150 |
| - set -e |
151 |
| - testDefinitionFile=$(echo $MATRIX | jq -c -r '.testDefinitionFile') |
152 |
| - echo $testDefinitionFile |
153 |
| - docker run -i\ |
154 |
| - -v ${{ github.workspace }}/configs/:/mnt/deployer/configs/\ |
155 |
| - -v ${{ github.workspace }}/test/:/mnt/deployer/test/\ |
156 |
| - --entrypoint ruby newrelic/deployer:latest main.rb -c configs/gitusdkreu${{ github.run_id }}.json -d $testDefinitionFile -l debug |
157 |
| - echo ::set-output name=exit_status::$? |
| 151 | + - name: Install npm dependencies for deployer test runner |
| 152 | + working-directory: .github/workflows/scripts/deployer-platform |
| 153 | + run: npm install |
158 | 154 |
|
159 |
| - - name: Teardown Deployment |
160 |
| - if: always() |
161 |
| - id: cleanupResources |
162 |
| - continue-on-error: true |
| 155 | + - name: Execute test |
| 156 | + id: runDeployerPlatformTest |
| 157 | + working-directory: .github/workflows/scripts/deployer-platform |
163 | 158 | run: |
|
164 |
| - testDefinitionFile=$(echo $MATRIX | jq -c -r '.testDefinitionFile') |
165 |
| - echo $testDefinitionFile |
166 |
| - docker run \ |
167 |
| - -v ${{ github.workspace }}/configs/:/mnt/deployer/configs/\ |
168 |
| - -v ${{ github.workspace }}/test/:/mnt/deployer/test/\ |
169 |
| - --entrypoint ruby newrelic/deployer:latest main.rb -c configs/gitusdkreu${{ github.run_id }}.json -d $testDefinitionFile -t |
| 159 | + node main.js |
| 160 | + env: |
| 161 | + TEST_DEFINITION_FILE: ${{ matrix.testDefinitionFile }} |
| 162 | + AWS_ACCESS_KEY_ID: ${{ secrets.DEPLOYER_PLATFORM_EU_AWS_ACCESS_KEY_ID }} |
| 163 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.DEPLOYER_PLATFORM_EU_AWS_SECRET_ACCESS_KEY }} |
| 164 | + AWS_REGION: ${{ secrets.DEPLOYER_PLATFORM_EU_AWS_REGION }} |
| 165 | + SQS_URL: ${{ secrets.DEPLOYER_PLATFORM_EU_SQS_URL }} |
| 166 | + DYNAMO_TABLE: ${{ secrets.DEPLOYER_PLATFORM_EU_DYNAMO_TABLE }} |
170 | 167 |
|
171 |
| - - name: Error Reporting |
172 |
| - if: steps.deployerRun.outputs.exit_status != 0 |
| 168 | + - name: Report any error |
| 169 | + if: steps.runDeployerPlatformTest.outputs.exit_status != 0 |
173 | 170 | run: exit 1
|
174 | 171 |
|
175 | 172 | slack-notify:
|
176 |
| - name: Slack |
177 | 173 | runs-on: ubuntu-latest
|
178 | 174 | needs: [test-deploy-recipe]
|
179 | 175 | if: always()
|
180 | 176 | steps:
|
181 |
| - - name: Build Result Notification |
| 177 | + - name: Build Result Slack Notification |
182 | 178 | uses: 8398a7/action-slack@v3
|
183 | 179 | with:
|
184 | 180 | author_name: GitHub Actions
|
|
0 commit comments