Repository navigation
186 lines (159 loc) · 5.4 KB
/
Copy pathexample.yml
File metadata and controls
186 lines (159 loc) · 5.4 KB
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Example
on:
pull_request:
push:
branches: main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: example
permissions:
contents: read
jobs:
# Make sure we use an updated dist/index.js in the examples, which are
# effectively integration tests. In the case of a Renovate PR, index.js
# won't be rebuilt otherwise.
dist:
runs-on: ubuntu-latest
# Override the workflow-level `working-directory: example`: pnpm accepts
# package.yaml as a manifest, and example/package.yaml is hpack's, so pnpm
# stops there and never reaches the root package.json.
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
cache: pnpm
node-version-file: ".nvmrc"
- run: pnpm install --frozen-lockfile
- run: pnpm build
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/index.js
test:
needs: dist
strategy:
matrix:
runner:
- ubuntu-latest
- macOS-latest
- windows-latest
stack:
- resolver: nightly
- resolver: lts
- resolver: lts-22.7
ghc: "9.6.4"
- resolver: lts-12.26
ghc: "8.4.4"
exclude:
# Binary distributions for older GHCs don't exist on macOS-latest
- runner: macOS-latest
stack: { ghc: "8.4.4" }
fail-fast: false
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8
with:
name: dist
path: dist # overwrite dist/index.js
# https://github.com/freckle/stack-action/issues/489
- if: ${{ startsWith(matrix.runner, 'macOS-') }}
run: |
sudo xcode-select -s /Library/Developer/CommandLineTools
- id: stack
uses: ./
with:
cache-prefix: v1/
working-directory: example
stack-arguments: --resolver ${{ matrix.stack.resolver }}
- name: Check compiler[-*] outputs
if: matrix.stack.ghc
shell: bash
run: |
[[ "${{ steps.stack.outputs.compiler }}" = ghc-${{ matrix.stack.ghc }} ]]
[[ "${{ steps.stack.outputs.compiler-version }}" = ${{ matrix.stack.ghc }} ]]
- name: Check presence of other outputs
shell: bash
run: |
# stack path | cut -d: -f1
[[ -n "${{ steps.stack.outputs.snapshot-doc-root }}" ]]
[[ -n "${{ steps.stack.outputs.local-doc-root }}" ]]
[[ -n "${{ steps.stack.outputs.local-hoogle-root }}" ]]
[[ -n "${{ steps.stack.outputs.stack-root }}" ]]
[[ -n "${{ steps.stack.outputs.project-root }}" ]]
[[ -n "${{ steps.stack.outputs.config-location }}" ]]
[[ -n "${{ steps.stack.outputs.bin-path }}" ]]
[[ -n "${{ steps.stack.outputs.programs }}" ]]
[[ -n "${{ steps.stack.outputs.compiler-exe }}" ]]
[[ -n "${{ steps.stack.outputs.compiler-bin }}" ]]
[[ -n "${{ steps.stack.outputs.compiler-tools-bin }}" ]]
[[ -n "${{ steps.stack.outputs.local-bin }}" ]]
# Actually blank in default setup
# [[ -n "${{ steps.stack.outputs.extra-include-dirs }}" ]]
# [[ -n "${{ steps.stack.outputs.extra-library-dirs }}" ]]
[[ -n "${{ steps.stack.outputs.snapshot-pkg-db }}" ]]
[[ -n "${{ steps.stack.outputs.local-pkg-db }}" ]]
[[ -n "${{ steps.stack.outputs.global-pkg-db }}" ]]
[[ -n "${{ steps.stack.outputs.ghc-package-path }}" ]]
[[ -n "${{ steps.stack.outputs.snapshot-install-root }}" ]]
[[ -n "${{ steps.stack.outputs.local-install-root }}" ]]
[[ -n "${{ steps.stack.outputs.dist-dir }}" ]]
[[ -n "${{ steps.stack.outputs.local-hpc-root }}" ]]
test-generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- id: generate
uses: ./generate-matrix
with:
working-directory: example
outputs:
stack-yamls: ${{ steps.generate.outputs.stack-yamls }}
test-stack-yamls:
needs: [dist, test-generate]
runs-on: ubuntu-latest
strategy:
matrix:
stack-yaml: ${{ fromJSON(needs.test-generate.outputs.stack-yamls) }}
fail-fast: false
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8
with:
name: dist
path: dist # overwrite dist/index.js
- run: |
if [[ -L '${{ matrix.stack-yaml }}' ]]; then
echo "generate-matrix incorrectly included a symlink" >&2
exit 1
fi
- uses: ./
with:
working-directory: example
stack-arguments: --stack-yaml ${{ matrix.stack-yaml }}
test-fails-on-error:
needs: dist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8
with:
name: dist
path: dist # overwrite dist/index.js
- name: Should fail
id: stack-action-step
continue-on-error: true
uses: ./
with:
working-directory: example
stack-arguments: --resolver bad-resolver
- name: Check failure
if: steps.stack-action-step.outcome != 'failure'
run: exit 1