-
-
Notifications
You must be signed in to change notification settings - Fork 719
263 lines (242 loc) · 9.44 KB
/
Copy pathmain.yml
File metadata and controls
263 lines (242 loc) · 9.44 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Main
on:
pull_request: # without merge conflicts
paths-ignore:
- 'spec/**'
push: # branch or tag
paths-ignore:
- 'spec/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
call-precommit:
uses: ./.github/workflows/pre_commit.yml
main:
needs: call-precommit
strategy:
fail-fast: false
matrix:
include:
# Linux
- job_name: Ubuntu 22.04 x64, DMD (latest)
os: ubuntu-22.04
host_dmd: dmd
# Enable this to replace coverage tests on CircleCI
# - job_name: Ubuntu 22.04 x64, DMD (coverage)
# os: ubuntu-22.04
# host_dmd: dmd
# coverage: true
- job_name: Ubuntu 22.04 x64, DMD (bootstrap)
os: ubuntu-22.04
host_dmd: dmd-2.079.0
disable_debug_for_dmd_unittests: true # no `-debug` - host frontend too old
- job_name: Ubuntu 22.04 x86, DMD (latest)
os: ubuntu-22.04
model: 32
host_dmd: dmd
# Disabled because of failure https://issues.dlang.org/show_bug.cgi?id=24518
# - job_name: Ubuntu 22.04 x86, DMD (coverage)
# os: ubuntu-22.04
# model: 32
# host_dmd: dmd
# coverage: true
- job_name: Ubuntu 22.04 x86, DMD (bootstrap)
os: ubuntu-22.04
model: 32
host_dmd: dmd-2.097.1
- job_name: Ubuntu 22.04 x64, LDC
os: ubuntu-22.04
host_dmd: ldc
- job_name: Ubuntu 22.04 x64, GDC
os: ubuntu-22.04
host_dmd: gdmd-9
disable_debug_for_dmd_unittests: true # no `-debug` - host frontend too old
- job_name: Alpine 3.21 x64, LDC
os: ubuntu-latest
container_image: alpine:3.21
host_dmd: ldmd2
# macOS
- job_name: macOS 14 x64, DMD (latest)
os: macos-14
host_dmd: dmd
# Disabled because of failure https://issues.dlang.org/show_bug.cgi?id=24518
#- job_name: macOS 14 x64, DMD (coverage)
# os: macos-14
# host_dmd: dmd
# coverage: true
- job_name: macOS 14 x64, DMD (bootstrap)
os: macos-14
host_dmd: dmd-2.107.1
# Windows
- job_name: Windows x64, LDC
os: windows-2022
host_dmd: ldc-latest
- job_name: Windows x86, DMD (latest)
os: windows-2022
host_dmd: dmd-latest
model: 32
# FreeBSD (VMs on Ubuntu)
- job_name: FreeBSD 14.4 x64, DMD (latest)
os: ubuntu-latest
vm_os: freebsd
vm_os_version: '14.4'
host_dmd: dmd
- job_name: FreeBSD 14.4 x64, DMD (bootstrap)
os: ubuntu-latest
vm_os: freebsd
vm_os_version: '14.4'
host_dmd: dmd-2.095.0
name: ${{ matrix.job_name }}
runs-on: ${{ matrix.os }}
container: ${{ matrix.container_image }}
timeout-minutes: 60 # OSX tests can still be running runnable at 40
env:
# for ci/run.sh:
OS_NAME: ${{ matrix.vm_os || (startsWith(matrix.os, 'ubuntu') && 'linux' || (startsWith(matrix.os, 'macos') && 'osx' || (startsWith(matrix.os, 'windows') && 'windows' || ''))) }}
MODEL: ${{ matrix.model || '64' }}
HOST_DMD: ${{ matrix.host_dmd }}
# N is set dynamically below
FULL_BUILD: true
# for coverage:
DMD_TEST_COVERAGE: ${{ matrix.coverage && '1' || '0' }}
# work around https://issues.dlang.org/show_bug.cgi?id=23517
MACOSX_DEPLOYMENT_TARGET: '11'
defaults:
run:
# cpa.sh comes with cross-platform-actions and delegates to the VM.
# Use it by default for all `run` steps below, i.e., run them in the VM (with a bash shell).
shell: ${{ matrix.vm_os && 'cpa.sh {0} --sync-files runner-to-vm --environment-variables OS_NAME MODEL HOST_DMD CI_DFLAGS N FULL_BUILD DMD_TEST_COVERAGE' || 'bash' }}
steps:
- name: Start VM
if: matrix.vm_os
uses: cross-platform-actions/action@v1.5.0
with:
operating_system: ${{ matrix.vm_os }}
version: ${{ matrix.vm_os_version }}
shell: bash
memory: 12G
cpu_count: 4
sync_files: runner-to-vm
- name: 'Alpine container: Pre-install bash, git and sudo'
if: startsWith(matrix.container_image, 'alpine')
shell: sh
run: apk add bash git sudo
- uses: actions/checkout@v7
with:
fetch-depth: 50
- name: Set environment variable N (parallelism)
run: echo "N=$(${{ runner.os == 'macOS' && 'sysctl -n hw.logicalcpu' || 'nproc' }})" >> $GITHUB_ENV
shell: bash # don't run in VM, but host runner (for exporting env var)
- name: 'Posix: Install prerequisites'
if: runner.os != 'Windows'
run: ${{ runner.os == 'macOS' && 'ci/cirrusci.sh' || 'sudo -E ci/cirrusci.sh' }}
- name: 'macOS: Switch Xcode version if required'
if: runner.os == 'macOS' && matrix.xcode
run: sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode }}.app
- name: 'Posix: Install host compiler'
if: runner.os != 'Windows'
run: ci/run.sh install_host_compiler
- name: 'Windows: Install host compiler'
if: runner.os == 'Windows'
uses: dlang-community/setup-dlang@v2
with:
compiler: ${{ matrix.host_dmd }}
- name: Set up repos
run: |
set -uexo pipefail
ref='${{ github.ref }}'
if [[ "$ref" =~ ^refs/pull/ ]]; then
# PR: clone the Phobos head with the same name as this DMD PR's target branch
# e.g., Phobos stable when targeting DMD stable
REPO_BRANCH="$GITHUB_BASE_REF"
elif [[ "$ref" =~ ^refs/(heads|tags)/(.*)$ ]]; then
# no PR: try to clone the Phobos head with the same name as this DMD head, falling back to master
# e.g., Phobos stable for a push to DMD stable, or Phobos v2.105.2 for DMD tag v2.105.2
REPO_BRANCH="${BASH_REMATCH[2]}"
else
echo "Error: unexpected GitHub ref '$ref'" >&2
exit 1
fi
ci/run.sh setup_repos "$REPO_BRANCH"
- name: Build
run: ${{ matrix.disable_debug_for_dmd_unittests && 'ENABLE_DEBUG=0' || '' }} ci/run.sh build
- name: Rebuild dmd (with enabled coverage)
if: matrix.coverage
run: ENABLE_RELEASE=0 ENABLE_DEBUG=1 ENABLE_COVERAGE=1 ci/run.sh rebuild
- name: 'Windows: Set up MSVC environment' # some tests need cl.exe etc. in PATH
if: runner.os == 'Windows'
uses: seanmiddleditch/gha-setup-vsdevenv@v5
with:
arch: ${{ env.MODEL == '64' && 'x64' || 'x86' }}
- name: Test dmd
run: ci/run.sh test_dmd
- name: Test frontend subpackage
if: '!matrix.coverage && (success() || failure()) && (matrix.host_dmd == ''dmd'' || matrix.host_dmd == ''dmd-latest'')'
run: ci/run.sh test_frontend_subpackage
- name: Test druntime
if: '!matrix.coverage && (success() || failure())'
run: ci/run.sh test_druntime
- name: 'Windows x86: Add 32-bit libcurl.dll to PATH (required for Phobos unittests)'
if: runner.os == 'Windows' && env.MODEL == '32' && !matrix.coverage && (success() || failure())
run: |
set -uexo pipefail
if [[ "$HOST_DMD" =~ ^ldc ]]; then
echo "$(dirname "$DC")/../lib32" >> $GITHUB_PATH
else # DMD
echo "$(dirname "$DC")/../bin" >> $GITHUB_PATH
fi
- name: Test phobos
if: '!matrix.coverage && (success() || failure())'
run: ci/run.sh test_phobos
- name: Test self-compile
if: '!matrix.coverage && (success() || failure())' # already re-built with enabled coverage
run: ENABLE_RELEASE=0 ci/run.sh rebuild
- name: Upload coverage report
if: matrix.coverage
run: ci/run.sh codecov
arm-qemu:
needs: call-precommit
name: 'Ubuntu 24.04 x64, DMD (AArch64 cross-compile via QEMU)'
runs-on: ubuntu-latest
timeout-minutes: 30
env:
OS_NAME: linux
MODEL: 64
HOST_DMD: dmd
FULL_BUILD: true
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 50
- name: Set environment variable N (parallelism)
run: echo "N=$(nproc)" >> $GITHUB_ENV
- name: Install prerequisites
run: sudo -E ci/cirrusci.sh
- name: Install host compiler
run: ci/run.sh install_host_compiler
- name: Set up repos
run: |
set -uexo pipefail
ref='${{ github.ref }}'
if [[ "$ref" =~ ^refs/pull/ ]]; then
REPO_BRANCH="$GITHUB_BASE_REF"
elif [[ "$ref" =~ ^refs/(heads|tags)/(.*)$ ]]; then
REPO_BRANCH="${BASH_REMATCH[2]}"
else
echo "Error: unexpected GitHub ref '$ref'" >&2
exit 1
fi
ci/run.sh setup_repos "$REPO_BRANCH"
- name: Build DMD
run: ci/run.sh build
- name: Install AArch64 cross-compile tools
run: sudo apt-get install -y qemu-user clang lld gcc-aarch64-linux-gnu
- name: Test AArch64 cross-compile and run via QEMU
run: |
source ~/dlang/*/activate
compiler/test/run.d arm