Skip to content

Commit 3729b5c

Browse files
authored
Need to swtch to new CI OS (libmir#477)
* Update Github Actions CI OS * Add timeout-minutes condition to Github Actions * Update github actions cache to v4 * Update macos-13 to macos-15-intel * Update codecov to v5 * Update restore-keys * Split packages and build cache * Only generate coverage for stable compiler * continue-on-error if beta or master compilers * Fixups * Remove extra continue-on-error * Only upload coverage data if coverage reports generated * Tweak runner.os * Update setup-dlang to latest * Add verify toolchain step * Updates for powershell and better toolchain verification * Enhance verify toolchain * Fix typo * Update wildcard * Change exit to throw * Add verify toolchain for ubuntu/macos * Add some additional diagnostic info for dub in macos
1 parent b476262 commit 3729b5c

File tree

2 files changed

+201
-34
lines changed

2 files changed

+201
-34
lines changed

.github/workflows/ci.yml

Lines changed: 196 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818
jobs:
1919
setup:
2020
name: 'Load job configuration'
21-
runs-on: ubuntu-20.04
21+
runs-on: ubuntu-24.04
2222
outputs:
2323
compilers: ${{ steps.load-config.outputs.compilers }}
2424
steps:
@@ -68,7 +68,8 @@ jobs:
6868
6969
macos:
7070
name: '[macos] x86_64/${{ matrix.dc }}'
71-
runs-on: macos-11
71+
runs-on: macos-15-intel
72+
timeout-minutes: 60
7273
needs: setup
7374
# Only run if the setup phase explicitly defined compilers to be used
7475
if: ${{ fromJSON(needs.setup.outputs.compilers).macos != '' && fromJSON(needs.setup.outputs.compilers).macos != '[]' }}
@@ -84,27 +85,87 @@ jobs:
8485
- name: Checkout repo
8586
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
8687
- name: Setup D compiler
87-
uses: dlang-community/setup-dlang@763d869b4d67e50c3ccd142108c8bca2da9df166
88+
uses: dlang-community/setup-dlang@d7d85fcde7c4cd5f9a6618fce1bccc316e1e910b
8889
with:
8990
compiler: ${{ matrix.dc }}
90-
- name: Cache dub dependencies
91-
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
91+
- name: Verify toolchain
92+
shell: bash
93+
env:
94+
DC_NAME: ${{ matrix.dc }}
95+
run: |
96+
set -euo pipefail
97+
98+
echo "matrix.dc = ${DC_NAME}"
99+
100+
# dub must exist for all jobs
101+
if ! command -v dub >/dev/null 2>&1; then
102+
echo "ERROR: dub not found on PATH"
103+
exit 1
104+
fi
105+
which dub
106+
file "$(which dub)" || true
107+
dub --version
108+
109+
if [[ "${DC_NAME}" == dmd* ]]; then
110+
if ! command -v dmd >/dev/null 2>&1; then
111+
echo "ERROR: dmd not found on PATH (matrix.dc=${DC_NAME})"
112+
exit 1
113+
fi
114+
dmd --version
115+
116+
elif [[ "${DC_NAME}" == ldc* ]]; then
117+
if ! command -v ldc2 >/dev/null 2>&1; then
118+
echo "ERROR: ldc2 not found on PATH (matrix.dc=${DC_NAME})"
119+
exit 1
120+
fi
121+
ldc2 --version
122+
123+
else
124+
echo "ERROR: Unknown compiler in matrix.dc: '${DC_NAME}' (expected prefix 'dmd' or 'ldc')"
125+
exit 1
126+
fi
127+
128+
echo "ARCH=${ARCH:-<unset>}"
129+
echo "PATH=${PATH}"
130+
- name: Cache dub packages (safe to share)
131+
uses: actions/cache@v4
92132
with:
93-
path: ~/.dub/packages
94-
key: macos-latest-build-${{ hashFiles('**/dub.sdl', '**/dub.json') }}
133+
path: |
134+
~/.dub/packages
135+
key: ${{ runner.os }}-dub-${{ hashFiles('**/dub.sdl', '**/dub.json', '**/dub.selections.json') }}
95136
restore-keys: |
96-
macos-latest-build-
97-
- name: Build / test
137+
${{ runner.os }}-dub-packages-
138+
- name: Cache dub build cache (compiler-specific)
139+
uses: actions/cache@v4
140+
with:
141+
path: |
142+
~/Library/Caches/dub
143+
key: ${{ runner.os }}-dub-${{ matrix.dc }}-${{ hashFiles('**/dub.sdl', '**/dub.json', '**/dub.selections.json') }}
144+
restore-keys: |
145+
${{ runner.os }}-dub-cache-${{ matrix.dc }}-
146+
- name: Build / test (nightly compiler; no coverage)
147+
if: contains(matrix.dc, 'beta') || contains(matrix.dc, 'master')
148+
run: dub test --arch=$ARCH --combined
149+
shell: bash
150+
- name: Build / test (stable compiler; with coverage)
151+
if: ${{ !(contains(matrix.dc, 'beta') || contains(matrix.dc, 'master')) }}
98152
run: |
99153
dub test --arch=$ARCH --build=unittest-cov
100154
dub test --arch=$ARCH --combined
101155
shell: bash
102156
- name: Upload coverage data
103-
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b
157+
if: ${{ !(contains(matrix.dc, 'beta') || contains(matrix.dc, 'master')) }}
158+
uses: codecov/codecov-action@v5
159+
with:
160+
fail_ci_if_error: true
161+
verbose: true
162+
env:
163+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
104164

105165
ubuntu:
106166
name: '[ubuntu] ${{ matrix.arch }}/${{ matrix.dc }}'
107-
runs-on: ubuntu-20.04
167+
runs-on: ubuntu-24.04
168+
timeout-minutes: 60
108169
needs: setup
109170
# Only run if the setup phase explicitly defined compilers to be used
110171
if: ${{ fromJSON(needs.setup.outputs.compilers).ubuntu != '' && fromJSON(needs.setup.outputs.compilers).ubuntu != '[]' }}
@@ -121,30 +182,88 @@ jobs:
121182
- name: Checkout repo
122183
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
123184
- name: Setup D compiler
124-
uses: dlang-community/setup-dlang@763d869b4d67e50c3ccd142108c8bca2da9df166
185+
uses: dlang-community/setup-dlang@d7d85fcde7c4cd5f9a6618fce1bccc316e1e910b
125186
with:
126187
compiler: ${{ matrix.dc }}
127188
- name: Install multi-lib for 32-bit systems
128189
if: matrix.arch == 'x86'
129190
run: sudo apt-get update && sudo apt-get install gcc-multilib
130-
- name: Cache dub dependencies
131-
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
191+
- name: Verify toolchain
192+
shell: bash
193+
env:
194+
DC_NAME: ${{ matrix.dc }}
195+
run: |
196+
set -euo pipefail
197+
198+
echo "matrix.dc = ${DC_NAME}"
199+
200+
# dub must exist for all jobs
201+
if ! command -v dub >/dev/null 2>&1; then
202+
echo "ERROR: dub not found on PATH"
203+
exit 1
204+
fi
205+
dub --version
206+
207+
if [[ "${DC_NAME}" == dmd* ]]; then
208+
if ! command -v dmd >/dev/null 2>&1; then
209+
echo "ERROR: dmd not found on PATH (matrix.dc=${DC_NAME})"
210+
exit 1
211+
fi
212+
dmd --version
213+
214+
elif [[ "${DC_NAME}" == ldc* ]]; then
215+
if ! command -v ldc2 >/dev/null 2>&1; then
216+
echo "ERROR: ldc2 not found on PATH (matrix.dc=${DC_NAME})"
217+
exit 1
218+
fi
219+
ldc2 --version
220+
221+
else
222+
echo "ERROR: Unknown compiler in matrix.dc: '${DC_NAME}' (expected prefix 'dmd' or 'ldc')"
223+
exit 1
224+
fi
225+
226+
echo "ARCH=${ARCH:-<unset>}"
227+
echo "PATH=${PATH}"
228+
- name: Cache dub packages (safe to share)
229+
uses: actions/cache@v4
132230
with:
133-
path: ~/.dub/packages
134-
key: ubuntu-latest-build-${{ hashFiles('**/dub.sdl', '**/dub.json') }}
231+
path: |
232+
~/.dub/packages
233+
key: ${{ runner.os }}-dub-${{ hashFiles('**/dub.sdl', '**/dub.json', '**/dub.selections.json') }}
135234
restore-keys: |
136-
ubuntu-latest-build-
137-
- name: Build / test
235+
${{ runner.os }}-dub-packages
236+
- name: Cache dub build cache (compiler-specific)
237+
uses: actions/cache@v4
238+
with:
239+
path: |
240+
~/.cache/dub
241+
key: ${{ runner.os }}-dub-cache-${{ matrix.arch }}-${{ matrix.dc }}-${{ hashFiles('**/dub.sdl', '**/dub.json', '**/dub.selections.json') }}
242+
restore-keys: |
243+
${{ runner.os }}-dub-cache-${{ matrix.arch }}-${{ matrix.dc }}-
244+
- name: Build / test (nightly compiler; no coverage)
245+
if: contains(matrix.dc, 'beta') || contains(matrix.dc, 'master')
246+
run: dub test --arch=$ARCH --combined
247+
shell: bash
248+
- name: Build / test (stable compiler; with coverage)
249+
if: ${{ !(contains(matrix.dc, 'beta') || contains(matrix.dc, 'master')) }}
138250
run: |
139251
dub test --arch=$ARCH --build=unittest-cov
140-
dub test --arch=$ARCH --combined
252+
dub test --arch=$ARCH --combined
141253
shell: bash
142254
- name: Upload coverage data
143-
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b
255+
if: ${{ !(contains(matrix.dc, 'beta') || contains(matrix.dc, 'master')) }}
256+
uses: codecov/codecov-action@v5
257+
with:
258+
fail_ci_if_error: true
259+
verbose: true
260+
env:
261+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
144262

145263
windows:
146264
name: '[windows] x86_64/${{ matrix.dc }}'
147265
runs-on: windows-2022
266+
timeout-minutes: 60
148267
needs: setup
149268
# Only run if the setup phase explicitly defined compilers to be used
150269
if: ${{ fromJSON(needs.setup.outputs.compilers).windows != '' && fromJSON(needs.setup.outputs.compilers).windows != '[]' }}
@@ -160,26 +279,70 @@ jobs:
160279
- name: Checkout repo
161280
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
162281
- name: Setup D compiler
163-
uses: dlang-community/setup-dlang@763d869b4d67e50c3ccd142108c8bca2da9df166
282+
uses: dlang-community/setup-dlang@d7d85fcde7c4cd5f9a6618fce1bccc316e1e910b
164283
with:
165284
compiler: ${{ matrix.dc }}
166-
- name: Cache dub dependencies
167-
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
285+
- name: Verify toolchain
286+
shell: pwsh
287+
env:
288+
DC_NAME: ${{ matrix.dc }}
289+
run: |
290+
Write-Host "matrix.dc = $env:DC_NAME"
291+
dub --version 2>$null
292+
if ($LASTEXITCODE -ne 0) { throw "dub not found" }
293+
294+
if ($env:DC_NAME -like "dmd*") {
295+
dmd --version 2>$null
296+
if ($LASTEXITCODE -ne 0) { throw "dmd not found" }
297+
} elseif ($env:DC_NAME -like "ldc*") {
298+
ldc2 --version 2>$null
299+
if ($LASTEXITCODE -ne 0) { throw "ldc2 not found" }
300+
} else {
301+
throw "Unknown compiler in matrix.dc: '$env:DC_NAME' (expected prefix 'dmd' or 'ldc')"
302+
}
303+
Write-Host "ARCH=$env:ARCH"
304+
Write-Host "Path=$env:Path"
305+
- name: Cache dub packages (safe to share)
306+
uses: actions/cache@v4
307+
with:
308+
path: |
309+
${{ env.APPDATA }}\dub\packages
310+
key: ${{ runner.os }}-dub-${{ hashFiles('**/dub.sdl', '**/dub.json', '**/dub.selections.json') }}
311+
restore-keys: |
312+
${{ runner.os }}-dub-
313+
- name: Cache dub build cache (compiler-specific)
314+
uses: actions/cache@v4
168315
with:
169-
path: ~\AppData\Local\dub
170-
key: windows-latest-build-${{ hashFiles('**/dub.sdl', '**/dub.json') }}
316+
path: |
317+
${{ env.LOCALAPPDATA }}\dub
318+
key: ${{ runner.os }}-dub-${{ matrix.dc }}-${{ hashFiles('**/dub.sdl', '**/dub.json', '**/dub.selections.json') }}
171319
restore-keys: |
172-
windows-latest-build-
320+
${{ runner.os }}-dub-${{ matrix.dc }}-
173321
# Tests are split up to work around OOM errors -- no combined testing is done
174322
# as it's simply too big for the compiler to handle on Windows.
175-
- name: Build / test
323+
- name: Build / test (nightly compiler; no coverage)
324+
if: contains(matrix.dc, 'beta') || contains(matrix.dc, 'master')
176325
run: |
177-
dub test --arch=$ARCH --build=unittest-ci -c ci-bignum-test
178-
dub test --arch=$ARCH --build=unittest-ci -c ci-core-test
179-
dub test --arch=$ARCH --build=unittest-ci -c ci-ndslice-test
180-
dub test --arch=$ARCH --build=unittest-ci -c ci-test
181-
shell: bash
326+
dub test --arch=$env:ARCH --build=unittest-ci -c ci-bignum-test
327+
dub test --arch=$env:ARCH --build=unittest-ci -c ci-core-test
328+
dub test --arch=$env:ARCH --build=unittest-ci -c ci-ndslice-test
329+
dub test --arch=$env:ARCH --build=unittest-ci -c ci-test
330+
shell: pwsh
331+
- name: Build / test (stable compiler; with coverage)
332+
if: ${{ !(contains(matrix.dc, 'beta') || contains(matrix.dc, 'master')) }}
333+
run: |
334+
dub test --arch=$env:ARCH --build=unittest-cov-ci -c ci-bignum-test
335+
dub test --arch=$env:ARCH --build=unittest-cov-ci -c ci-core-test
336+
dub test --arch=$env:ARCH --build=unittest-cov-ci -c ci-ndslice-test
337+
dub test --arch=$env:ARCH --build=unittest-cov-ci -c ci-test
338+
shell: pwsh
182339
- name: Upload coverage data
183-
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b
340+
if: ${{ !(contains(matrix.dc, 'beta') || contains(matrix.dc, 'master')) }}
341+
uses: codecov/codecov-action@v5
342+
with:
343+
fail_ci_if_error: true
344+
verbose: true
345+
env:
346+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
184347

185348

dub.sdl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ buildType "unittest-cov" {
4242
versions "mir_bignum_test" "mir_bignum_test_llv" "mir_ndslice_test" "mir_test"
4343
dflags "-lowmem"
4444
}
45-
buildType "unittest-ci" {
45+
buildType "unittest-cov-ci" {
4646
buildOptions "unittests" "coverage" "debugMode" "debugInfo"
4747
dflags "-lowmem"
4848
}
49+
buildType "unittest-ci" {
50+
buildOptions "unittests" "debugMode" "debugInfo"
51+
dflags "-lowmem"
52+
}
4953
buildType "unittest-release" {
5054
buildOptions "unittests" "releaseMode" "optimize" "inline" "noBoundsCheck"
5155
versions "mir_bignum_test" "mir_ndslice_test" "mir_test"

0 commit comments

Comments
 (0)