10
10
- " *-lock.yaml"
11
11
- " .github/workflows/integration-test.yml"
12
12
- " !docs/**"
13
- push :
14
- branches :
15
- - main
16
- paths :
17
- - " packages/**/package.json"
18
- - " packages/**/*-lock.yaml"
19
- - " packages/**/*.ts"
20
- - " integration-tests/**"
21
- - " package.json"
22
- - " *-lock.yaml"
23
- - " .github/workflows/integration-test.yml"
24
- - " !docs/**"
13
+ # push:
14
+ # branches:
15
+ # - main
16
+ # paths:
17
+ # - "packages/**/package.json"
18
+ # - "packages/**/*-lock.yaml"
19
+ # - "packages/**/*.ts"
20
+ # - "integration-tests/**"
21
+ # - "package.json"
22
+ # - "*-lock.yaml"
23
+ # - ".github/workflows/integration-test.yml"
24
+ # - "!docs/**"
25
25
# Run on demand
26
26
workflow_dispatch :
27
27
inputs :
38
38
NPM_VERSION : " 8"
39
39
40
40
jobs :
41
- calc-ref :
41
+ prepare :
42
42
runs-on : ubuntu-latest
43
43
env :
44
44
REF_BRANCH : ${{ github.event.inputs.ref || github.ref }}
45
45
outputs :
46
46
ref : ${{ env.REF_BRANCH }}
47
47
runs_on : ${{ env.RUNS_ON }}
48
48
node_version : ${{ env.NODE_VERSION }}
49
+ repos : ${{ steps.load-integrations.outputs.repos }}
49
50
steps :
50
- - name : Refs
51
- run : |
52
- echo ref: "${{ env.REF_BRANCH }}"
53
- echo runs_on: "${{ env.RUNS_ON }}"
54
- echo node_version: ${{ env.NODE_VERSION }}
51
+ - name : Checkout
52
+ uses : actions/checkout@v3
53
+ with :
54
+ ref : ${{ env.REF_BRANCH }}
55
55
56
- load-integrations :
57
- needs :
58
- - calc-ref
59
- uses : ./.github/workflows/reuseable-list-integration-repos.yml
60
- with :
61
- ref : ${{ needs.calc-ref.outputs.ref }}
56
+ - name : Start Prepare
57
+ uses : ./.github/actions/summary
58
+ with :
59
+ text : |
60
+ # Prepare Integration
62
61
63
- build :
64
- needs :
65
- - calc-ref
66
- uses : " ./.github/workflows/reuseable-build-dist-cache.yml"
67
- with :
68
- ref : ${{ needs.calc-ref.outputs.ref }}
62
+ - ref: "${{ env.REF_BRANCH }}"
63
+ - runs_on: "${{ env.RUNS_ON }}"
64
+ - node_version: ${{ env.NODE_VERSION }}
65
+
66
+ - name : load-integrations
67
+ id : load-integrations
68
+ uses : ./.github/actions/list-integration-repos
69
+
70
+ - name : Refs
71
+ uses : ./.github/actions/summary
72
+ with :
73
+ text : |
74
+ ## Integrations
75
+ ```json
76
+ ${{ steps.load-integrations.outputs.repos }}
77
+ ```
78
+
79
+ - name : Pre-build and cache
80
+ uses : ./.github/actions/build-for-integrations
81
+ with :
82
+ show-summary : true
83
+ node-version : ${{ env.NODE_VERSION }}
84
+ use-setup : true
85
+
86
+ - name : Done
87
+ uses : ./.github/actions/summary
88
+ with :
89
+ text : |
90
+ ## Done
69
91
70
92
integration-tests :
71
93
needs :
72
- - calc-ref
73
- - load-integrations
74
- - build
94
+ - prepare
75
95
runs-on : ${{ matrix.os }}
76
96
77
97
env :
78
- REF_BRANCH : ${{ needs.calc-ref .outputs.ref }}
98
+ REF_BRANCH : ${{ needs.prepare .outputs.ref }}
79
99
80
100
strategy :
81
101
# the integration tests are independent, so we want to run them all.
82
102
fail-fast : false
83
103
matrix :
84
104
node-version :
85
- - ${{ needs.calc-ref .outputs.node_version }}
105
+ - ${{ needs.prepare .outputs.node_version }}
86
106
87
107
os :
88
- - ${{ needs.calc-ref .outputs.runs_on }}
108
+ - ${{ needs.prepare .outputs.runs_on }}
89
109
90
110
# List of repositories to check.
91
111
# Use `repo-list.sh` in `integration-tests` to generate.
92
- repo : ${{ fromJSON(needs.load-integrations .outputs.repos) }}
112
+ repo : ${{ fromJSON(needs.prepare .outputs.repos) }}
93
113
# repo:
94
114
# - prettier/prettier
95
115
# - typescript-eslint/typescript-eslint
@@ -98,51 +118,62 @@ jobs:
98
118
- name : Checkout
99
119
uses : actions/checkout@v3
100
120
101
- - name : Setup pnpm
102
- uses : pnpm/action-setup@v2.2.4
103
-
104
- - name : Use Node.js ${{ matrix.node-version }}
105
- uses : actions/setup-node@v3
121
+ - id : repo-hash
122
+ uses : ./.github/actions/echo
106
123
with :
107
- node-version : ${{ matrix.node-version }}
108
- cache : " pnpm"
109
-
110
- - run : pnpm -v
124
+ value : >-
125
+ ${{ hashFiles(
126
+ 'integration-tests/tsconfig.json',
127
+ 'integration-tests/config/repositories/${{matrix.repo}}/**',
128
+ 'integration-tests/snapshots/${{ matrix.repo }}/*',
129
+ 'integration-tests/repositories/*',
130
+ 'integration-tests/src/**/*.ts', 'integration-tests/tsconfig.json',
131
+ 'packages/*/src/**/*.ts', 'packages/*/tsconfig.json',
132
+ 'packages/*/*.ts',
133
+ '*-lock.yaml'
134
+ ) }}
111
135
112
136
- name : Repo Info
113
137
id : step-repo-info
114
138
run : |
115
139
echo "repo-info=$(jq -c '.repositories[] | select(.path == "${{ matrix.repo }}")' integration-tests/config/config.json)" >> $GITHUB_OUTPUT
116
- echo "repo-hash=${{ hashFiles(
117
- 'integration-tests/tsconfig.json',
118
- 'integration-tests/config/repositories/${{matrix.repo}}/**',
119
- 'integration-tests/snapshots/${{ matrix.repo }}/*',
120
- 'integration-tests/repositories/*',
121
- 'integration-tests/src/**/*.ts', 'integration-tests/tsconfig.json',
122
- 'packages/*/src/**/*.ts', 'packages/*/tsconfig.json',
123
- 'packages/*/*.ts',
124
- '*-lock.yaml'
125
- ) }}" >> $GITHUB_OUTPUT
140
+
141
+ - uses : ./.github/actions/echo
142
+ with :
143
+ value : |
144
+ step.repo-hash: "${{ steps.repo-hash.outputs.value }}"
145
+ env.repo-info: ${{ steps.step-repo-info.outputs.repo-info }}
146
+ $repo-hash
126
147
127
148
- name : Cache Integration Run
128
149
id : step-cache-run
129
150
uses : actions/cache@v3
130
151
with :
131
- key : int-repo-${{ steps.step-repo-info.outputs.repo-hash }}-${{ fromJSON(steps.step-repo-info.outputs.repo-info).commit }}
152
+ key : integration-run-result-${{ steps.repo-hash.outputs.value }}-${{ fromJSON(steps.step-repo-info.outputs.repo-info).commit }}
153
+ # We just need a path, its contents isn't important. We really just care if the key was cached.
132
154
path : |
133
155
integration-tests/tsconfig.json
134
156
135
- - name : Cache Build
136
- id : step-cache-build
137
- uses : actions/cache@v3
157
+ - uses : ./.github/actions/echo
138
158
with :
139
- key : ${{ needs.build.outputs.key }}
140
- path : ${{ needs.build .outputs.path }}
159
+ value : |
160
+ Run Cache : ${{ steps.step-cache-run .outputs.cache-hit && 'Hit' || 'Miss' }}
141
161
142
- - name : Cached Results
143
- run : |
144
- echo Build Cache: ${{ steps.step-cache-build.outputs.cache-hit && 'Hit' || 'Miss' }}
145
- echo Run Cache: ${{ steps.step-cache-run.outputs.cache-hit && 'Hit' || 'Miss' }}
162
+ - name : Setup Env
163
+ if : ${{ !steps.step-cache-run.outputs.cache-hit }}
164
+ uses : ./.github/actions/setup
165
+ with :
166
+ node-version : ${{ matrix.node-version }}
167
+
168
+ - id : step-cache-build
169
+ if : ${{ !steps.step-cache-run.outputs.cache-hit }}
170
+ uses : ./.github/actions/build-for-integrations
171
+
172
+ - uses : ./.github/actions/echo
173
+ if : ${{ !steps.step-cache-run.outputs.cache-hit }}
174
+ with :
175
+ value : |
176
+ Run Cache: ${{ steps.step-cache-run.outputs.cache-hit && 'Hit' || 'Miss' }}
146
177
147
178
- name : Cache Integration Test Repository Files
148
179
if : ${{ !steps.step-cache-run.outputs.cache-hit }}
@@ -152,20 +183,6 @@ jobs:
152
183
path : |
153
184
integration-tests/repositories/temp/${{ matrix.repo }}
154
185
155
- - name : pnpm CI
156
- if : ${{ !steps.step-cache-build.outputs.cache-hit || !steps.step-cache-run.outputs.cache-hit }}
157
- run : pnpm i
158
-
159
- - name : Has pnpm has failed?
160
- if : ${{ failure() }}
161
- run : |
162
- ls -alF /home/runner/.pnpm/_logs/*.log
163
- cat /home/runner/.pnpm/_logs/*.log
164
-
165
- - name : Build
166
- if : ${{ !steps.step-cache-build.outputs.cache-hit }}
167
- run : pnpm run build
168
-
169
186
- name : Run Integration Tests ${{ matrix.repo }}
170
187
if : ${{ !steps.step-cache-run.outputs.cache-hit }}
171
188
env :
0 commit comments