-
-
Notifications
You must be signed in to change notification settings - Fork 282
Expand file tree
/
Copy pathaction.yml
More file actions
191 lines (169 loc) · 6 KB
/
action.yml
File metadata and controls
191 lines (169 loc) · 6 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
name: Install prerequisites
inputs:
llvm_version:
required: true
arch:
required: true
runs:
using: composite
steps:
- name: 'Linux: Install required apt packages'
if: runner.os == 'Linux'
shell: bash
run: |
set -eux
cd ..
export DEBIAN_FRONTEND=noninteractive
arch='${{ inputs.arch }}'
if [[ $arch == x86_64 ]]; then
sudo dpkg --add-architecture i386
fi
sudo apt-get -q update
packages=( \
git-core cmake g++ \
libcurl4 libxml2-dev libzstd-dev \
curl gdb p7zip-full tzdata unzip zip python3-pip \
)
if [[ $arch == x86_64 ]]; then
packages+=(g++-multilib libcurl4:i386)
fi
# extra prerequisites of apt.llvm.org install script
packages+=(lsb-release wget software-properties-common gnupg)
sudo -E apt-get -yq install ${packages[@]}
# Make sure to link libzstd statically
sudo rm /usr/lib/$arch-linux-gnu/libzstd.so
- name: 'Linux: Install clang 20 from apt.llvm.org'
if: runner.os == 'Linux'
shell: bash
run: |
set -eux
cd ..
curl -fL --retry 3 --max-time 30 -O https://apt.llvm.org/llvm.sh
sudo bash llvm.sh 20
for tool in clang clang++ ld.lld; do
sudo ln -sf $tool-20 /usr/bin/$tool
$tool --version
done
- name: 'Windows: Install clang v20.1.3 from GitHub'
if: runner.os == 'Windows'
shell: bash
run: |
set -eux
cd ..
curl -fL --retry 3 --max-time 300 -o clang.exe \
https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.3/LLVM-20.1.3-win64.exe
./clang.exe //S # double-slash for bash
rm clang.exe
# C:\Program Files\LLVM\bin should already be in PATH
clang-cl --version
- name: Download & extract LDC-flavoured LLVM # into ../llvm
shell: bash
run: |
set -eux
cd ..
version='${{ inputs.llvm_version }}'
if [[ "$version" = *.* ]]; then
tag="ldc-v$version"
else
tag=CI
fi
arch='${{ inputs.arch }}'
# use assertions for untagged builds
assertsSuffix="-withAsserts"
if [[ '${{ github.ref }}' = refs/tags/* ]]; then
assertsSuffix=""
fi
if [[ '${{ runner.os }}' == Windows ]]; then
curl -fL --retry 3 --max-time 300 -o llvm.7z \
https://github.com/ldc-developers/llvm-project/releases/download/$tag/llvm-$version-windows-$arch$assertsSuffix.7z
mkdir llvm
cd llvm
7z x ../llvm.7z >/dev/null
rm ../llvm.7z
cd ..
else
if [[ '${{ runner.os }}' == Linux ]]; then
os=linux
elif [[ '${{ runner.os }}' == macOS ]]; then
os=osx
fi
curl -fL --retry 3 --max-time 300 -o llvm.tar.xz \
https://github.com/ldc-developers/llvm-project/releases/download/$tag/llvm-$version-$os-$arch$assertsSuffix.tar.xz
mkdir llvm
tar -xf llvm.tar.xz --strip 1 -C llvm
rm llvm.tar.xz
fi
llvm/bin/llvm-config --version
- name: 'Linux: Make lld (from apt.llvm.org) the default linker'
if: runner.os == 'Linux'
shell: bash
run: |
set -eux
sudo ln -sf ld.lld /usr/bin/ld
ld --version
- name: Install ninja v1.12.1
uses: Ahajha/gha-setup-ninja@69595b0cf872acdad8ce599142fbdc88724b9a2b
- name: Install D host compiler
uses: dlang-community/setup-dlang@v1
with:
# macOS: use LDC with LLVM version matching Xcode - v1.39.0 (LLVM 17) on arm64 with Xcode 16, v1.35.0 (LLVM 16) on x86_64 with Xcode 15
compiler: ${{ runner.os != 'macOS' && 'ldc-latest' || (inputs.arch == 'arm64' && 'ldc-1.39.0' || 'ldc-1.35.0') }}
- name: 'Posix: Clear LD_LIBRARY_PATH env variable' # don't use host druntime/Phobos .so/.dylib etc.
if: runner.os != 'Windows'
shell: bash
run: echo "LD_LIBRARY_PATH=" >> $GITHUB_ENV
- name: Install lit
shell: bash
run: |
set -euxo pipefail
python3 --version
if [[ '${{ runner.os }}-${{ inputs.arch }}' == 'macOS-arm64' ]]; then
brew install lit
else
python3 -m pip install --user lit psutil
fi
python3 -c "import lit.main; lit.main.main();" --version . | head -n 1
# the druntime tests require GNU make
- name: 'Windows: Make sure GNU make is installed'
if: runner.os == 'Windows'
shell: cmd
run: make --version
- name: 'macOS: Install a more recent GNU make'
if: runner.os == 'macOS'
shell: bash
run: |
brew install make
gmake --version
- name: 'Windows: Download & extract libcurl' # into ../libcurl/ldc2
if: runner.os == 'Windows'
shell: bash
run: |
set -eux
cd ..
url='https://curl.se/windows/latest.cgi?p=win64-mingw.zip'
if [[ '${{ inputs.arch }}' == x86 ]]; then
url='https://curl.se/windows/latest.cgi?p=win32-mingw.zip'
fi
curl -fL --retry 3 --max-time 60 -o libcurl.zip "$url"
mkdir libcurl
cd libcurl
7z x ../libcurl.zip >/dev/null
rm ../libcurl.zip
mkdir ldc2
cp curl-*/bin/{libcurl*.dll,curl-ca-bundle.crt} ldc2/
if [[ '${{ inputs.arch }}' != x86 ]]; then
mv ldc2/libcurl*.dll ldc2/libcurl.dll
fi
ls -lh ldc2/
- name: 'Windows: Set LDC_VSDIR env variable' # to somewhat speed-up MSVC auto-detection
if: runner.os == 'Windows'
shell: bash
run: echo "LDC_VSDIR=$(vswhere -latest -property installationPath)" >> $GITHUB_ENV
- name: 'Windows x86: Make CMake configure 64-bit clang-cl for 32-bit code emission'
if: runner.os == 'Windows' && inputs.arch == 'x86'
shell: bash
run: |
set -eux
echo "CFLAGS=-m32" >> $GITHUB_ENV
echo "CXXFLAGS=-m32" >> $GITHUB_ENV
echo "ASMFLAGS=-m32" >> $GITHUB_ENV