-
Notifications
You must be signed in to change notification settings - Fork 1
/
.cirrus.yml
268 lines (246 loc) · 13.3 KB
/
.cirrus.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
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
264
265
266
267
268
build_task:
environment: &environment
GITHUB_API_TOKEN: ENCRYPTED[636741c0f231293de78980eb83f86c5b8cd5dad07a79351e239c097e42ee4cc0f28113a26f6ad579437e40fcb227066c]
PONYC_GIT_URL: https://github.com/ponylang/ponyc
PONYC_VERSION: 0.51.2
XWIN_RELEASE_URL: https://github.com/Jake-Shadle/xwin/releases/download/0.2.1/xwin-0.2.1-x86_64-unknown-linux-musl.tar.gz
XWIN_CACHE_COMMAND: mkdir /tmp/xwin; echo "xwin is not needed on this platform" > /tmp/xwin/noop.txt
CC: clang
CXX: clang++
DEBUGINFO_CFLAGS: -O0 -g -fdebug-prefix-map=/tmp/ponyc/src/libponyrt=libsavi_runtime
CFLAGS: ${DEBUGINFO_CFLAGS} -march=native -mtune=generic
matrix:
# (when adding new matrix tasks, also add them as deps to the bundle_task)
- name: x86_64-unknown-linux-gnu
container:
image: ubuntu:20.04
environment:
TRIPLE: x86_64-unknown-linux-gnu
DEPS_INSTALL_PRE: apt-get update
DEPS_INSTALL: apt-get install -y --no-install-recommends apt-transport-https ca-certificates clang cmake curl git llvm make
# Without this next environment var, apt-get will try to ask us
# interactive questions, to which we will be unable to respond...
DEBIAN_FRONTEND: noninteractive
- name: x86_64-unknown-linux-musl
environment:
TRIPLE: x86_64-unknown-linux-musl
DEPS_INSTALL: apk add --no-cache --update alpine-sdk coreutils linux-headers clang-dev cmake llvm12-dev
PATCH_1: sed -i s/SO_RCVTIMEO/SO_RCVTIMEO_OLD/g /tmp/ponyc/src/libponyrt/lang/socket.c
PATCH_2: sed -i s/SO_SNDTIMEO/SO_SNDTIMEO_OLD/g /tmp/ponyc/src/libponyrt/lang/socket.c
# We skip the `-march` and `-mtune` CFLAGS on arm64.
# For some (unknown) reason, they aren't supported by current clang.
CFLAGS: ${DEBUGINFO_CFLAGS}
container:
image: alpine:3.15
- name: arm64-unknown-linux-musl
environment:
TRIPLE: arm64-unknown-linux-musl
DEPS_INSTALL: apk add --no-cache --update alpine-sdk coreutils linux-headers clang-dev cmake llvm12-dev
PATCH_1: sed -i s/SO_RCVTIMEO/SO_RCVTIMEO_OLD/g /tmp/ponyc/src/libponyrt/lang/socket.c
PATCH_2: sed -i s/SO_SNDTIMEO/SO_SNDTIMEO_OLD/g /tmp/ponyc/src/libponyrt/lang/socket.c
# We skip the `-march` and `-mtune` CFLAGS on arm64 platforms.
# For some (unknown) reason, they aren't supported by current clang.
CFLAGS: ${DEBUGINFO_CFLAGS}
arm_container:
image: alpine:3.15
- name: x86_64-unknown-freebsd
environment:
TRIPLE: x86_64-unknown-freebsd
DEPS_INSTALL_PRE: pkg update
DEPS_INSTALL: "pkg install -y cmake gmake libunwind git llvm14 \
&& ln -s /usr/local/bin/llvm-link14 /usr/local/bin/llvm-link"
freebsd_instance:
image: freebsd-13-1-release-amd64
- name: x86_64-unknown-dragonfly
environment:
TRIPLE: x86_64-unknown-dragonfly
DEPS_INSTALL_PRE: "pkg update \
&& pkg install -y cmake gmake libunwind git llvm14 \
&& ln -s /usr/local/bin/llvm-link14 /usr/local/bin/llvm-link"
DEPS_INSTALL: " \
curl -L --fail http://www.ravenports.com/repository/dragonfly:6.2:x86:64/All/ravensys-root-single-dragonfly-3.2_6.tzst \
| tar --strip-components=5 -xvzf - \
&& sh -c 'cd DragonFly/usr/lib/gcc80 && ln -s libgcc_pic.a libgcc.a' \
&& mkdir -p DragonFly/usr/include \
&& curl -L --fail https://raw.githubusercontent.com/DragonFlyBSD/DragonFlyBSD/DragonFly_RELEASE_6_2/lib/libexecinfo/execinfo.h \
> DragonFly/usr/include/execinfo.h \
&& patch /usr/include/sys/stdatomic.h \
platform-patches/dragonfly-stdatomic.patch \
-o DragonFly/usr/include/stdatomic.h \
"
CFLAGS: ${DEBUGINFO_CFLAGS} -IDragonFly/usr/include
EXTRA_CMAKE_FLAGS: >
-DCMAKE_C_COMPILER_TARGET=x86_64-unknown-dragonfly
-DCMAKE_SYSTEM_NAME=DragonFly
-DCMAKE_SYSTEM_PROCESSOR=x86_64
-DCMAKE_C_COMPILER_WORKS=true
-DCMAKE_CXX_COMPILER_WORKS=true
freebsd_instance:
image: freebsd-13-1-release-amd64
- name: x86_64-apple-macosx
environment:
TRIPLE: x86_64-apple-macosx
DEPS_INSTALL_PRE: brew update --preinstall && brew install llvm@12 && brew cleanup
DEPS_INSTALL: ln -s $(brew --prefix llvm@12)/bin/llvm-link /usr/local/bin/llvm-link
SDKROOT: /Applications/Xcode-12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: "1" # optimizes brew install
# We skip the `-march` and `-mtune` CFLAGS on MacOS.
# Not sure why, but it causes "illegal instruction" errors in Savi.
CFLAGS: ${DEBUGINFO_CFLAGS}
macos_instance:
image: big-sur-xcode-12.5
# Caching some homebrew directories helps save some of the otherwise huge
# amount of time that it takes to update brew from the CI base image.
brew_cache:
folder: "$HOME/Library/Caches/Homebrew"
brew_usr_local_cache:
folder: "/usr/local/Homebrew"
- name: arm64-apple-macosx
environment:
TRIPLE: arm64-apple-macosx
DEPS_INSTALL_PRE: brew update --preinstall && brew install llvm@12 && brew cleanup
DEPS_INSTALL: ln -s $(brew --prefix llvm@12)/bin/llvm-link /usr/local/bin/llvm-link
SDKROOT: /Applications/Xcode-12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: "1" # optimizes brew install
# We're compiling on an x86_64 host, but want to cross-compile to arm64.
EXTRA_CMAKE_FLAGS: "-DCMAKE_C_COMPILER_TARGET=arm64-apple-macosx -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=arm64"
# We skip the `-march` and `-mtune` CFLAGS on arm64 platforms.
# For some (unknown) reason, they aren't supported by current clang.
CFLAGS: ${DEBUGINFO_CFLAGS}
macos_instance:
image: big-sur-xcode-12.5
# Caching some homebrew directories helps save some of the otherwise huge
# amount of time that it takes to update brew from the CI base image.
brew_cache:
folder: "$HOME/Library/Caches/Homebrew"
brew_usr_local_cache:
folder: "/usr/local/Homebrew"
- name: x86_64-unknown-windows-msvc
container:
image: ubuntu:22.04
environment:
TRIPLE: x86_64-unknown-windows-msvc
DEPS_INSTALL_PRE: apt-get update && apt-get install -y --no-install-recommends apt-transport-https ca-certificates clang-12 cmake curl git llvm-12 make && ln -s /usr/bin/clang-12 /usr/bin/clang && ln -s /usr/bin/clang++-12 /usr/bin/clang++ && ln -s /usr/bin/llvm-link-12 /usr/bin/llvm-link
DEPS_INSTALL: curl -L --fail ${XWIN_RELEASE_URL} | tar --strip-components=1 --wildcards -xvzf - '*/xwin'
# Without this next environment var, apt-get will try to ask us
# interactive questions, to which we will be unable to respond...
DEBIAN_FRONTEND: noninteractive
# Without this next environment var, `xwin` won't download windows SDKs.
XWIN_ACCEPT_LICENSE: '1'
# This cache command will download SDKs and then the extract them
# to the correct output directory (unless they are already cached).
XWIN_CACHE_COMMAND: ./xwin splat --output /tmp/xwin && find /tmp/xwin # ./xwin download
# Here are the compilation settings we'll use to enable cross-compiling.
CC: clang++ # we pretend that clang++ is a C compiler (and not just C++)
CFLAGS: ${DEBUGINFO_CFLAGS} -fms-extensions -fms-compatibility -Wno-microsoft-cast -Wno-deprecated -Wno-nonportable-include-path -Wno-ignored-pragma-intrinsic -Wno-pragma-pack -Wno-unknown-pragmas -Wno-ignored-attributes -Wno-unused-local-typedef -Wno-missing-field-initializers -Wno-missing-braces -Wno-implicit-int-conversion -Wno-int-in-bool-context -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -mcx16 -D_CRT_USE_BUILTIN_OFFSETOF -I/tmp/xwin/sdk/include/ucrt -I/tmp/xwin/crt/include -I/tmp/xwin/sdk/include/um -I/tmp/xwin/sdk/include/shared -I/tmp/xwin/sdk/include/shared
EXTRA_CMAKE_FLAGS: -DCMAKE_C_COMPILER_TARGET=x86_64-unknown-windows-msvc -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_C_COMPILER_WORKS=true -DCMAKE_CXX_COMPILER_WORKS=true
deps_script:
- sh -xc "${DEPS_INSTALL_PRE:-echo}" && sh -xc "${DEPS_INSTALL:-echo}"
- clang --version
- clang++ --version
- llvm-link --version
xwin_cache:
folder: /tmp/xwin
fingerprint_script: echo "${TRIPLE} 20220504.1"
populate_script: sh -xc "${XWIN_CACHE_COMMAND}"
upload_caches: [xwin]
ponyc_clone_script: &ponyc_clone_script
- git clone -b ${PONYC_VERSION} --depth 1 ${PONYC_GIT_URL} /tmp/ponyc
- sh -xc "${PATCH_1:-echo}" && sh -xc "${PATCH_2:-echo}"
- cd /tmp/ponyc && git diff
- cd /tmp/ponyc && git apply ${CIRRUS_WORKING_DIR}/patches/*
build_script:
- mkdir /tmp/ponyc/src/libponyrt/build
- cmake -S /tmp/ponyc/src/libponyrt -B /tmp/ponyc/src/libponyrt/build -DPONY_RUNTIME_BITCODE:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ${EXTRA_CMAKE_FLAGS}
- cmake --build /tmp/ponyc/src/libponyrt/build --target libponyrt_bc
- cp /tmp/ponyc/src/libponyrt/build/libponyrt.bc /tmp/libsavi_runtime-${TRIPLE}.bc
- rm -rf /tmp/ponyc/src/libponyrt/build
build_with_runtime_stats_script:
- mkdir /tmp/ponyc/src/libponyrt/build
- cmake -S /tmp/ponyc/src/libponyrt -B /tmp/ponyc/src/libponyrt/build -DPONY_RUNTIME_BITCODE:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DPONY_USE_RUNTIMESTATS:BOOL=ON ${EXTRA_CMAKE_FLAGS}
- cmake --build /tmp/ponyc/src/libponyrt/build --target libponyrt_bc
- cp /tmp/ponyc/src/libponyrt/build/libponyrt.bc /tmp/libsavi_runtime-${TRIPLE}-with-runtime-stats.bc
- rm -rf /tmp/ponyc/src/libponyrt/build
publish_if_release_script:
- echo CIRRUS_RELEASE "${CIRRUS_RELEASE:-NO}"
- >-
sh -c '
test -z "${CIRRUS_RELEASE}" || \
curl -v --fail -X POST \
-H "Authorization: token ${GITHUB_API_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: application/octet-stream" \
--data-binary @/tmp/libsavi_runtime-${TRIPLE}.bc \
"https://uploads.github.com/repos/$CIRRUS_REPO_FULL_NAME/releases/$CIRRUS_RELEASE/assets?name=libsavi_runtime-${TRIPLE}.bc" \
'
- >-
sh -c '
test -z "${CIRRUS_RELEASE}" || \
curl -v --fail -X POST \
-H "Authorization: token ${GITHUB_API_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: application/octet-stream" \
--data-binary @/tmp/libsavi_runtime-${TRIPLE}-with-runtime-stats.bc \
"https://uploads.github.com/repos/$CIRRUS_REPO_FULL_NAME/releases/$CIRRUS_RELEASE/assets?name=libsavi_runtime-${TRIPLE}-with-runtime-stats.bc" \
'
# After each bitcode is published, publish a bundle containing them all.
bundle_task:
depends_on:
# Please ensure that this list always has the full set of matrix task names.
- x86_64-unknown-linux-musl
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- arm64-unknown-linux-musl
- x86_64-unknown-freebsd
- x86_64-unknown-dragonfly
- x86_64-apple-macosx
- arm64-apple-macosx
- x86_64-unknown-windows-msvc
environment: *environment
container:
image: alpine:3.15
# Download dependencies. Also explicitly check for the programs we intend
# to use only in the release-guarded scripts, since we want to fail fast
# on them being missing even on a CI run that isn't a release.
deps_script:
- apk add --no-cache --update coreutils findutils curl git jq tar gzip
- xargs --version
- curl --version
- jq --version
# Clone the ponyc source code and patch it for the Savi runtime,
# using the exact same script used by the earlier build task matrix.
ponyc_clone_script: *ponyc_clone_script
# Copy the relevant part of the (patched) ponyc source code into /tmp/out.
copy_source_script:
- mkdir -p /tmp/out
- cp -r /tmp/ponyc/src/libponyrt /tmp/out/src
# Download any/all *.bc files for this release into /tmp/out.
download_bitcode_if_release_script:
- mkdir -p /tmp/out
- >-
test -z "${CIRRUS_RELEASE}" || sh -c ' \
cd /tmp/out && \
curl -v --fail \
-H "Authorization: token ${GITHUB_API_TOKEN}" \
https://api.github.com/repos/$CIRRUS_REPO_FULL_NAME/releases/$CIRRUS_RELEASE \
| jq -r ".assets[] | select(.name | endswith(\".bc\")) | .browser_download_url" \
| xargs -n 1 curl --fail -L -O \
-H "Authorization: token ${GITHUB_API_TOKEN}" \
'
-
# Bundle everything in the /tmp/out directory into a single tar archive.
archive_script:
- tar -czvf /tmp/libsavi_runtime.tar.gz -C /tmp/out .
# Publish the bundle as an asset for the release.
publish_if_release_script:
- echo CIRRUS_RELEASE "${CIRRUS_RELEASE:-NO}"
- >-
sh -c '
test -z "${CIRRUS_RELEASE}" || \
curl -v --fail -X POST \
-H "Authorization: token ${GITHUB_API_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: application/octet-stream" \
--data-binary @/tmp/libsavi_runtime.tar.gz \
"https://uploads.github.com/repos/$CIRRUS_REPO_FULL_NAME/releases/$CIRRUS_RELEASE/assets?name=libsavi_runtime.tar.gz" \
'