-
Notifications
You must be signed in to change notification settings - Fork 2
198 lines (174 loc) · 5.78 KB
/
default.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
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
name: run-tests
on:
pull_request:
push:
branches:
- master
- replace_libdparse
jobs:
main:
name: Run all tests
# Only run for the main repository - not forks
if: ${{ github.repository == 'Dlang-UPB/D-Scanner' }}
# Run permutations of common os + host compilers
strategy:
fail-fast: false
matrix:
compiler: [
{
version: dmd-latest,
dmd: dmd
},
{
version: ldc-latest,
dmd: ldmd2
},
{
# Install dmd for the associated tools (dub/rdmd)
version: dmd-latest,
dmd: gdc-12
}
]
host: [
ubuntu-22.04,
macos-latest,
windows-latest
]
build: [
{ type: make },
{ type: dub, version: 'current' },
{ type: dub, version: 'min libdparse' },
# Fail due to unresolvable dependencies
# { type: dub, version: 'max libdparse' },
# { type: dub, version: 'min dsymbol' },
# { type: dub, version: 'max dsymbol' },
]
exclude:
# Restrict GDC to Ubuntu
- compiler:
dmd: gdc-12
host: windows-latest
- compiler:
dmd: gdc-12
host: macos-latest
# Restrict DMD to macOS latest
- compiler:
dmd: dmd
host: macos-latest
# Omit dub builds for GDC because dub rejects the old fronted revision
- compiler:
dmd: gdc-12
build:
type: dub
include:
- { do_report: 1, build: { type: dub, version: 'current' }, host: 'ubuntu-22.04', compiler: { version: dmd-latest, dmd: dmd } }
- compiler:
dmd: dmd
host: macos-13
build:
type: 'dub'
version: 'current'
runs-on: ${{ matrix.host }}
steps:
# Clone repo + submodules
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
# Uncomment to get a ssh connection inside the GH Actions runner
#- name: Setup upterm session
# uses: lhotari/action-upterm@v1
# Install the host compiler (DMD or LDC)
# Also grabs DMD for GDC to include dub + rdmd
- name: Install ${{ matrix.compiler.version }}
if: ${{ matrix.compiler.dmd != 'gdc-12' || matrix.build.type == 'dub' }} # Fetch required tools for GDC
uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.compiler.version }}
# GDC not yet supported by setup-dlang
- name: Install GDC via apt-get
if: ${{ matrix.compiler.dmd == 'gdc-12' }}
run: |
sudo apt-get install gdc-12 -y
gdc-12 --version
# - name: Setup upterm session
# if: ${{ matrix.build.type == 'dub' && matrix.host == 'macos-latest'}}
# uses: lhotari/action-upterm@v1
# Compile D-Scanner and execute all tests without dub
- name: Build and test without dub
if: ${{ matrix.build.type == 'make' }}
env:
DC: ${{ matrix.compiler.dmd }}
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export MFLAGS="-m64"
./build.bat
./build.bat test
else
NUM_PROC=$(nproc || getconf _NPROCESSORS_ONLN || 1)
make "-j$((NUM_PROC / 2))" all test
fi
# Compile D-Scanner and execute all tests using a specific dependency version
# Currently skipped for GDC (dub installed from apt-get is broken)
- name: Build and test with dub (min or max libdparse test)
if: ${{ matrix.build.type == 'dub' && matrix.build.version != 'current' }}
env:
DC: ${{ matrix.compiler.dmd }}
run: |
rdmd ./d-test-utils/test_with_package.d ${{ matrix.build.version }} -- dub build
rdmd ./d-test-utils/test_with_package.d ${{ matrix.build.version }} -- dub test
- name: Build and test with dub (with dub.selections.json)
if: ${{ matrix.build.type == 'dub' && matrix.build.version == 'current' }}
env:
DC: ${{ matrix.compiler.dmd }}
run: |
dub build
dub test
- uses: actions/upload-artifact@v4
with:
name: bin-${{matrix.build.type}}-${{matrix.build.version}}-${{ matrix.compiler.dmd }}-${{ matrix.host }}
path: bin
# Lint source code using the previously built binary
- name: Run linter
shell: bash
env:
REPORT_GITHUB: ${{matrix.do_report}}
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
EXE=".exe"
else
EXE=""
fi
if [ "$REPORT_GITHUB" == "1" ]; then
FORMAT="github"
else
FORMAT=""
fi
"./bin/dscanner$EXE" --styleCheck -f "$FORMAT" src
# TODO: fixme
#- name: Integration Tests
#run: ./it.sh
#working-directory: tests
#shell: bash
- name: Run style checks
if: ${{ matrix.compiler.dmd == 'dmd' && matrix.build.type == 'make' }}
run: |
make style
# Parse phobos to check for failures / crashes / ...
- name: Checkout Phobos
uses: actions/checkout@v4
with:
repository: dlang/phobos
path: phobos
- name: Apply D-Scanner to Phobos
if: ${{ matrix.build.version != 'min libdparse'}} # Older versions crash with "Invalid UTF..."
working-directory: phobos
shell: bash
run: |
for FILE in $(find std -name '*.d');
do
echo "$FILE"
../bin/dscanner -S --config=.dscanner.ini "$FILE"
done