-
-
Notifications
You must be signed in to change notification settings - Fork 186
191 lines (185 loc) · 6.44 KB
/
msvcrt.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
name: Build msvcrt toolchains
on:
workflow_dispatch:
inputs:
commit:
description: 'Commit to extract from'
type: string
branch:
description: 'Branch to extract from'
type: string
upload:
description: 'Upload the artifacts'
type: boolean
default: false
permissions:
contents: read
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
LLVM_VERSION: ${{steps.get-parameters.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{steps.get-parameters.outputs.MINGW_W64_VERSION}}
PYTHON_VERSION_MINGW: ${{steps.get-parameters.outputs.PYTHON_VERSION_MINGW}}
TAG: ${{steps.get-parameters.outputs.TAG}}
COMMIT_DATE_UNIX: ${{steps.get-parameters.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{steps.get-parameters.outputs.BUILD_DATE}}
BUILD_DATE_UNIX: ${{steps.get-parameters.outputs.BUILD_DATE_UNIX}}
steps:
- name: Download build parameters
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yml
workflow_conclusion: success
commit: ${{inputs.commit}}
branch: ${{inputs.branch}}
event: push
name: parameters
- name: Get build parameters
id: get-parameters
run: |
cat parameters.txt >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
# Build a new toolchain with a different CRT choice.
linux-msvcrt:
needs: [prepare]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }}
- name: Download toolchain
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yml
workflow_conclusion: success
commit: ${{inputs.commit}}
branch: ${{inputs.branch}}
event: push
name: linux-ucrt-x86_64-toolchain
- name: Unpack original toolchain
run: |
tar -Jxf llvm-mingw-*.tar.xz
rm llvm-mingw-*.tar.xz
mkdir install
mv llvm-mingw* install/llvm-mingw
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: |
sudo apt-get update && sudo apt-get install ninja-build
./build-all.sh $(pwd)/install/llvm-mingw --no-tools --wipe-runtimes --with-default-msvcrt=msvcrt
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
cd install
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m)
NAME=llvm-mingw-$TAG-msvcrt-$DISTRO
mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v4
with:
name: linux-msvcrt-x86_64-toolchain
path: |
llvm-mingw-*.tar.xz
retention-days: 7
linux-cross-windows:
needs: [linux-msvcrt, prepare]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { arch: i686, crt: msvcrt }
- { arch: x86_64, crt: msvcrt }
steps:
- uses: actions/download-artifact@v4
with:
name: linux-${{matrix.crt}}-x86_64-toolchain
- name: Unpack cross toolchain
run: |
tar -Jxf llvm-mingw-*.tar.xz
rm llvm-mingw-*.tar.xz
sudo mv llvm-mingw* /opt/llvm-mingw
echo /opt/llvm-mingw/bin >> $GITHUB_PATH
- uses: actions/checkout@v4
with:
ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }}
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
PYTHON_VERSION_MINGW: ${{needs.prepare.outputs.PYTHON_VERSION_MINGW}}
TAG: ${{needs.prepare.outputs.TAG}}
run: |
sudo apt-get update && sudo apt-get install autoconf-archive ninja-build
./build-cross-tools.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw ${{matrix.arch}} --with-python
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
cd install
NAME=llvm-mingw-$TAG-${{matrix.crt}}-${{matrix.arch}}
mv llvm-mingw $NAME
zip -9rq ../$NAME.zip $NAME
- uses: actions/upload-artifact@v4
with:
name: windows-${{matrix.crt}}-${{matrix.arch}}-toolchain
path: |
llvm-mingw-*.zip
retention-days: 7
# Run llvm-mingw's tests on x86_64 and i686 with the cross-built corresponding
# toolchains from above.
test-toolchain:
needs: [linux-cross-windows]
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
strategy:
fail-fast: false
matrix:
include:
- { arch: i686, crt: msvcrt }
- { arch: x86_64, crt: msvcrt }
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
install: >-
unzip
make
- uses: actions/download-artifact@v4
with:
name: windows-${{matrix.crt}}-${{matrix.arch}}-toolchain
- name: Unpack toolchain
run: |
unzip -q llvm-mingw-*.zip
rm llvm-mingw-*.zip
mv llvm-mingw-* /llvm-mingw
echo /llvm-mingw/bin >> $GITHUB_PATH
- uses: actions/checkout@v4
with:
ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }}
- name: Run tests
run: |
./run-tests.sh /llvm-mingw
./run-lldb-tests.sh /llvm-mingw
upload:
if: ${{inputs.upload}}
permissions:
contents: write
needs: [linux-msvcrt, linux-cross-windows, test-toolchain, prepare]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Rearrange files
run: |
rm -rf linux-asserts*
mv *-toolchain/*.zip *-toolchain/*.tar.xz .
- name: Upload binaries
env:
GITHUB_TOKEN: ${{github.token}}
TAG: ${{needs.prepare.outputs.TAG}}
run: |
gh release upload $TAG *.tar.xz *.zip --clobber -R ${{github.repository}}