-
-
Notifications
You must be signed in to change notification settings - Fork 3
237 lines (202 loc) · 8.91 KB
/
release.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
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
# GitHub Actions: Automated multi-platform releases of opencl-language-server
name: Release
on:
push:
tags:
- '[0-9]+.*'
env:
BUILD_TYPE: Release
jobs:
create_release:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
upload_url: ${{steps.create_release.outputs.upload_url}}
steps:
- name: Create release
id: create_release
uses: ncipollo/release-action@v1
with:
name: Release ${{github.ref}}
tag: ${{github.ref}}
draft: true
prerelease: false
build_release:
name: Build Release
runs-on: ${{ matrix.config.os }}
permissions:
contents: write
needs: create_release
strategy:
matrix:
config:
- os: windows-latest
- os: macos-latest
- os: ubuntu-20.04
python-version: [3.9]
env:
CONAN_HOME: ${{ github.workspace }}/.conan-home
steps:
- uses: actions/checkout@v3
- name: Linux - Install prerequisites
if: "contains(matrix.config.os, 'ubuntu')"
run: |
sudo apt update
sudo apt install gcc-9-aarch64-linux-gnu g++-9-aarch64-linux-gnu
ls /usr/bin/ | grep aarch64
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Create virtual environment
run: python3 -m venv .pyenv
- name: Windows - Activate virtual environment
if: "contains(matrix.config.os, 'windows')"
run: .pyenv\Scripts\activate.bat
- name: Unix - Activate virtual environment
if: "!contains(matrix.config.os, 'windows')"
run: source .pyenv/bin/activate
- name: Setup environment
run: |
pip3 install wheel
pip3 install -r requirements.txt
conan profile detect
# The following step is copied from the build.yml.
# TODO: reuse if when needed (#17, #24)
# - name: Cache libclang
# id: cache-libclang
# uses: actions/cache@v3
# env:
# cache-name: cache-libclang
# with:
# path: .build/_deps/libclang-subbuild/libclang-populate-prefix/src/*.7z
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('libclang/libclang-urls.txt') }}
- name: Windows - Configure & Build (Release)
if: "contains(matrix.config.os, 'windows')"
run: |
python3 build.py conan-install
python3 build.py configure
python3 build.py build
- name: Windows - Archive Artifact
if: "contains(matrix.config.os, 'windows')"
run: |
cd ${{github.workspace}}/.build/Release
7z a -tzip opencl-language-server-win32-x86_64.zip opencl-language-server.exe
- name: Windows - Upload Artifact
if: "contains(matrix.config.os, 'windows')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{github.token}}
with:
upload_url: ${{needs.create_release.outputs.upload_url}}
asset_path: ${{github.workspace}}/.build/Release/opencl-language-server-win32-x86_64.zip
asset_name: opencl-language-server-win32-x86_64.zip
asset_content_type: application/zip
- name: Linux - Configure & Build (Release)
if: "contains(matrix.config.os, 'ubuntu')"
run: |
./build.py conan-install -o .conan-x86_64 -pr:h profiles/linux.release.x86_64
./build.py configure -t .conan-x86_64/build/Release/generators/conan_toolchain.cmake -b .build-x86_64 -bt Release
./build.py build -b .build-x86_64
file .build-x86_64/opencl-language-server
./build.py conan-install -o .conan-armv8 -pr:h profiles/linux.release.armv8
./build.py configure -t .conan-armv8/build/Release/generators/conan_toolchain.cmake -b .build-armv8 -bt Release
./build.py build -b .build-armv8
file .build-armv8/opencl-language-server
- name: Linux - Archive Artifact
if: "contains(matrix.config.os, 'ubuntu')"
run: |
cd ${{github.workspace}}/.build-x86_64/
tar -czvf opencl-language-server-linux-x86_64.tar.gz opencl-language-server
cd ${{github.workspace}}/.build-armv8/
tar -czvf opencl-language-server-linux-arm64.tar.gz opencl-language-server
- name: Linux - Upload Artifact (x86_64)
if: "contains(matrix.config.os, 'ubuntu')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{github.token}}
with:
upload_url: ${{needs.create_release.outputs.upload_url}}
asset_path: ${{github.workspace}}/.build-x86_64/opencl-language-server-linux-x86_64.tar.gz
asset_name: opencl-language-server-linux-x86_64.tar.gz
asset_content_type: application/gzip
- name: Linux - Upload Artifact (armv8)
if: "contains(matrix.config.os, 'ubuntu')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{github.token}}
with:
upload_url: ${{needs.create_release.outputs.upload_url}}
asset_path: ${{github.workspace}}/.build-armv8/opencl-language-server-linux-arm64.tar.gz
asset_name: opencl-language-server-linux-arm64.tar.gz
asset_content_type: application/gzip
- name: Mac - Configure & Build (Release)
if: "contains(matrix.config.os, 'macos')"
run: |
./build.py conan-install -o .conan-x86_64 -pr:h profiles/darwin.release.x86_64
./build.py configure -t .conan-x86_64/build/Release/generators/conan_toolchain.cmake -b .build-x86_64 -bt Release
./build.py build -b .build-x86_64
file .build-x86_64/opencl-language-server
./build.py conan-install -o .conan-armv8 -pr:h profiles/darwin.release.armv8
./build.py configure -t .conan-armv8/build/Release/generators/conan_toolchain.cmake -b .build-armv8 -bt Release
./build.py build -b .build-armv8
file .build-armv8/opencl-language-server
mkdir -p .build-universal/
lipo -create -output .build-universal/opencl-language-server .build-x86_64/opencl-language-server .build-armv8/opencl-language-server
lipo -archs .build-universal/opencl-language-server
file .build-universal/opencl-language-server
- name: Mac - Archive Artifact
if: "contains(matrix.config.os, 'macos')"
run: |
cd ${{github.workspace}}/.build-x86_64/
tar -czvf opencl-language-server-darwin-x86_64.tar.gz opencl-language-server
cd ${{github.workspace}}/.build-armv8/
tar -czvf opencl-language-server-darwin-arm64.tar.gz opencl-language-server
cd ${{github.workspace}}/.build-universal/
tar -czvf opencl-language-server-darwin-universal.tar.gz opencl-language-server
- name: Mac - Upload Artifact (x86_64)
if: "contains(matrix.config.os, 'macos')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{github.token}}
with:
upload_url: ${{needs.create_release.outputs.upload_url}}
asset_path: ${{github.workspace}}/.build-x86_64/opencl-language-server-darwin-x86_64.tar.gz
asset_name: opencl-language-server-darwin-x86_64.tar.gz
asset_content_type: application/gzip
- name: Mac - Upload Artifact (armv8)
if: "contains(matrix.config.os, 'macos')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{github.token}}
with:
upload_url: ${{needs.create_release.outputs.upload_url}}
asset_path: ${{github.workspace}}/.build-armv8/opencl-language-server-darwin-arm64.tar.gz
asset_name: opencl-language-server-darwin-arm64.tar.gz
asset_content_type: application/gzip
- name: Mac - Upload Artifact (universal)
if: "contains(matrix.config.os, 'macos')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{github.token}}
with:
upload_url: ${{needs.create_release.outputs.upload_url}}
asset_path: ${{github.workspace}}/.build-universal/opencl-language-server-darwin-universal.tar.gz
asset_name: opencl-language-server-darwin-universal.tar.gz
asset_content_type: application/gzip
- name: Archive Licenses
if: "contains(matrix.config.os, 'ubuntu')"
run: |
cd ${{github.workspace}}/.conan-x86_64
tar -czvf licenses.tar.gz licenses
- name: Upload Licenses
if: "contains(matrix.config.os, 'ubuntu')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{github.token}}
with:
upload_url: ${{needs.create_release.outputs.upload_url}}
asset_path: ${{github.workspace}}/.conan-x86_64/licenses.tar.gz
asset_name: licenses.tar.gz
asset_content_type: application/gzip