167 lines (149 loc) · 5.3 KB
/
integration-test.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Integration Tests
on:
pull_request:
paths:
- "packages/**/package.json"
- "packages/**/package-lock.json"
- "packages/**/*.ts"
- "integration-tests/**"
- "package.json"
- "package-lock.json"
- ".github/workflows/integration-test.yml"
- "!docs/**"
push:
branches:
- main
paths:
- "packages/**/package.json"
- "packages/**/package-lock.json"
- "packages/**/*.ts"
- "integration-tests/**"
- "package.json"
- "package-lock.json"
- ".github/workflows/integration-test.yml"
- "!docs/**"
# Run on demand
workflow_dispatch:
permissions:
contents: read
jobs:
integration-tests:
runs-on: ${{ matrix.os }}
strategy:
# the integration tests are independent, so we want to run them all.
fail-fast: false
matrix:
node-version:
- 16.x
os:
- ubuntu-latest
# List of repositories to check.
# Use `repo-list.sh` in `integration-tests` to generate.
repo:
- AdaDoom3/AdaDoom3
- alexiosc/megistos
- apollographql/apollo-server
- aspnetboilerplate/aspnetboilerplate
- aws-amplify/docs
- Azure/azure-rest-api-specs
- bitjson/typescript-starter
- caddyserver/caddy
- canada-ca/open-source-logiciel-libre
- django/django
- exonum/exonum
- googleapis/google-cloud-cpp
- graphql/express-graphql
- graphql/graphql-js
- graphql/graphql-relay-js
- graphql/graphql-spec
- liriliri/licia
- MartinThoma/LaTeX-examples
- mdx-js/mdx
- microsoft/TypeScript-Website
- pagekit/pagekit
- php/php-src
- plasticrake/tplink-smarthome-api
- prettier/prettier
- pycontribs/jira
- shoelace-style/shoelace
- SoftwareBrothers/admin-bro
- TheAlgorithms/Python
- twbs/bootstrap
- typescript-cheatsheets/react
- typescript-eslint/typescript-eslint
- w3c/aria-practices
- w3c/specberus
- webdeveric/webpack-assets-manifest
- webpack/webpack
- wireapp/wire-desktop
- wireapp/wire-webapp
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.1.1
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: |
package-lock.json
packages/*/package-lock.json
integration-tests/package-lock.json
- run: npm i -g npm@8
- run: npm -v
- name: Repo Info
id: step-repo-info
run: |
echo "::set-output name=repo-info::$(jq -c '.repositories[] | select(.path == "${{ matrix.repo }}")' integration-tests/config/config.json)"
echo "::set-output name=repo-hash::${{ hashFiles('integration-tests/tsconfig.json', 'integration-tests/config/repositories/${{matrix.repo}}/**', 'integration-tests/snapshots/${{ matrix.repo }}/*', 'integration-tests/repositories/*', '**/package-lock.json', '**/src/**/*.ts', '**/tsconfig.json') }}"
- name: Cache Integration Run
id: step-cache-run
uses: actions/cache@v3
with:
key: int-repo-${{ steps.step-repo-info.outputs.repo-hash }}-${{ fromJSON(steps.step-repo-info.outputs.repo-info).commit }}
path: |
integration-tests/tsconfig.json
- name: Cache Build
id: step-cache-build
uses: actions/cache@v3
with:
key: int-build-${{ hashFiles('**/package-lock.json', '**/src/**/*.ts', '**/tsconfig.json') }}
path: |
packages/*/dist
integration-tests/dist
- name: Cached Results
run: |
echo Build Cache: ${{ steps.step-cache-build.outputs.cache-hit && 'Hit' || 'Miss' }}
echo Run Cache: ${{ steps.step-cache-run.outputs.cache-hit && 'Hit' || 'Miss' }}
- name: Cache Integration Test Repository Files
if: ${{ !steps.step-cache-run.outputs.cache-hit }}
uses: actions/cache@v3
with:
key: int-repo-temp-files-${{ matrix.repo }}-${{ fromJSON(steps.step-repo-info.outputs.repo-info).commit }}
path: |
integration-tests/repositories/temp/${{ matrix.repo }}
- name: Npm CI
if: ${{ !steps.step-cache-build.outputs.cache-hit || !steps.step-cache-run.outputs.cache-hit }}
run: npm ci
- name: Has Npm has failed?
if: ${{ failure() }}
run: |
ls -alF /home/runner/.npm/_logs/*.log
cat /home/runner/.npm/_logs/*.log
- name: Build
if: ${{ !steps.step-cache-build.outputs.cache-hit }}
run: npm run build
- name: Run Integration Tests ${{ matrix.repo }}
if: ${{ !steps.step-cache-run.outputs.cache-hit }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
cd integration-tests
&& npm ci
&& npm run integration-tests -- ${{ matrix.repo }}
# cspell:ignore apollographql
# cspell:ignore aspnetboilerplate
# cspell:ignore caddyserver
# cspell:ignore logiciel twbs
# cspell:ignore MartinThoma googleapis
# cspell:ignore plasticrake tplink smarthome