-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy path.cirrus.yml
187 lines (172 loc) · 8 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
# We use Cirrus CI to create release builds for a handful of platforms.
#
# This task builds the Savi compiler, and then packages it all up in a tar.gz
# file to be attached to the release in GitHub, for easy download and use.
task:
environment:
GITHUB_API_TOKEN: ENCRYPTED[5f9b960dd53fb09b34bcb26f7f8a926071f0177e0ec814e7d122db0e2184d3e913ec78d5748e27664c0fef66fde950fe]
MAKE: make
CC: clang
CXX: clang++
CRYSTAL_VERSION: "1.10.1"
matrix:
- name: x86_64-unknown-linux-gnu
environment:
TRIPLE: x86_64-unknown-linux-gnu
DEPS_INSTALL: "\
apt-get update && \
apt-get install -y --no-install-recommends \
apt-transport-https ca-certificates curl clang make \
zlib1g-dev libgc-dev libevent-dev libpcre3-dev llvm-10-dev && \
curl -L --fail --retry 10 https://github.com/crystal-lang/crystal/releases/download/${CRYSTAL_VERSION}/crystal-${CRYSTAL_VERSION}-1-linux-x86_64-bundled.tar.gz | tar -xvzf - -C /tmp && \
echo $PATH && \
ln -s /tmp/crystal-${CRYSTAL_VERSION}-1/bin/crystal /usr/local/bin/crystal && \
crystal --version"
# 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
container:
image: ubuntu:20.04
cpu: 2
memory: 8G
- name: x86_64-unknown-linux-musl
environment:
TRIPLE: x86_64-unknown-linux-musl
DEPS_INSTALL: "\
apk add --no-cache --update \
bash curl alpine-sdk coreutils \
gcc g++ clang make linux-headers llvm-dev zlib-static \
pcre-dev libevent-static gc-dev crystal shards"
# For some reason clang doesn't like it if we omit the "alpine" vendor
# in the triple, where we'd otherwise use `x86_64-unknown-linux-musl`.
MAKE_EXTRA_ARGS: CLANG_TARGET_PLATFORM=x86_64-alpine-linux-musl
container:
image: alpine:3.19
cpu: 2
memory: 8G
- name: arm64-unknown-linux-musl
environment:
TRIPLE: arm64-unknown-linux-musl
DEPS_INSTALL: "\
apk add --no-cache --update \
bash curl alpine-sdk coreutils \
gcc g++ clang make linux-headers llvm-dev zlib-static \
pcre-dev libevent-static gc-dev crystal shards"
# For some reason clang doesn't like it if we omit the "alpine" vendor
# in the triple, where we'd otherwise use `arm64-unknown-linux-musl`.
# We also need to use `aarch64` instead of `arm64` here...
MAKE_EXTRA_ARGS: CLANG_TARGET_PLATFORM=aarch64-alpine-linux-musl
arm_container:
image: alpine:3.19
cpu: 2
memory: 8G
- name: x86_64-unknown-freebsd
environment:
TRIPLE: x86_64-unknown-freebsd
DEPS_INSTALL: "\
pkg update && \
pkg install -y llvm14 gmake libunwind bash curl crystal shards boehm-gc-threaded && \
ln -s /usr/local/bin/llvm-config14 /usr/bin/llvm-config"
MAKE: gmake
MAKE_EXTRA_ARGS: " \
LIB_GC=/usr/local/lib/libgc-threaded.a \
CLANG=/usr/local/bin/clang14 \
CLANGXX=/usr/local/bin/clang++14"
freebsd_instance:
image: freebsd-13-2-release-amd64
cpu: 2
memory: 8G
- name: arm64-apple-macosx
environment:
TRIPLE: arm64-apple-macosx
DEPS_INSTALL: "
brew update --preinstall && brew install libiconv libgc libevent pcre && brew cleanup && \
curl -L --fail --retry 10 https://github.com/crystal-lang/crystal/releases/download/${CRYSTAL_VERSION}/crystal-${CRYSTAL_VERSION}-1-darwin-universal.tar.gz | tar -xvzf - -C /tmp && \
echo $PATH && \
sudo mkdir -p /usr/local/bin && \
sudo ln -s /tmp/crystal-${CRYSTAL_VERSION}-1/bin/crystal /usr/local/bin/crystal && \
crystal --version"
# Set up the SDKROOT path specific to the present XCode version.
SDKROOT: /Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: "1" # optimizes brew install
MACOSX_DEPLOYMENT_TARGET: "10.11" # set minimum MacOS version
macos_instance:
image: ghcr.io/cirruslabs/macos-runner:sonoma
# 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-apple-macosx
environment:
TRIPLE: x86_64-apple-macosx
IS_CROSS_COMPILE: "1"
# Download x86_64 versions of the libraries needed by Crystal runtime.
DEPS_INSTALL: "
brew update --preinstall && brew cleanup && \
curl -L --fail --retry 10 https://github.com/crystal-lang/crystal/releases/download/${CRYSTAL_VERSION}/crystal-${CRYSTAL_VERSION}-1-darwin-universal.tar.gz | tar -xvzf - -C /tmp && \
echo $PATH && \
sudo mkdir -p /usr/local/bin && \
sudo ln -s /tmp/crystal-${CRYSTAL_VERSION}-1/bin/crystal /usr/local/bin/crystal && \
crystal --version && \
mkdir /tmp/x86_64 && \
brew fetch --bottle-tag=ventura libgc && \
brew fetch --bottle-tag=ventura libevent && \
brew fetch --bottle-tag=ventura pcre && \
tar -xvf `brew --cache --bottle-tag=ventura libgc` -C /tmp/x86_64 --strip-components=2 && \
tar -xvf `brew --cache --bottle-tag=ventura libevent` -C /tmp/x86_64 --strip-components=2 && \
tar -xvf `brew --cache --bottle-tag=ventura pcre` -C /tmp/x86_64 --strip-components=2 && \
ls /tmp/x86_64/lib"
# Tell make to use those x86_64 versions we downloaded above.
MAKE_EXTRA_ARGS: " \
TARGET_PLATFORM=x86_64-apple-macosx \
LLVM_STATIC_PLATFORM=arm64-apple-macosx \
LIB_GC=/tmp/x86_64/lib/libgc.a \
LIB_EVENT=/tmp/x86_64/lib/libevent.a \
LIB_PCRE=/tmp/x86_64/lib/libpcre.a"
# Set up the SDKROOT path specific to the present XCode version.
SDKROOT: /Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: "1" # optimizes brew install
MACOSX_DEPLOYMENT_TARGET: "10.11" # set minimum MacOS version
macos_instance:
image: ghcr.io/cirruslabs/macos-runner:sonoma
# 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"
os_info_script:
- uname
- uname -m
- uname -a
deps_script:
- echo "${DEPS_INSTALL}"
- sh -c "${DEPS_INSTALL}"
build_script:
- mkdir -p out/bin
- ${MAKE} -j2 build/savi-release lib/libsavi_runtime SAVI_VERSION=${CIRRUS_TAG:-unknown} ${MAKE_EXTRA_ARGS}
- mv build/savi-release out/bin/savi
copy_core_script:
- mkdir -p out
- cp -r core out/core
copy_runtime_script:
- mkdir -p out/lib
- cp -r lib/libsavi_runtime out/lib/libsavi_runtime
smoke_test_unless_cross_compile_script:
- test -n "${IS_CROSS_COMPILE}" || out/bin/savi info llvm-platform
- test -n "${IS_CROSS_COMPILE}" || out/bin/savi eval --backtrace --print-perf 'env.out.print("No smoke!")'
archive_script:
- tar -czvf /tmp/savi.tar.gz -C out .
publish_if_release_script:
- >-
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/savi.tar.gz \
"https://uploads.github.com/repos/$CIRRUS_REPO_FULL_NAME/releases/$CIRRUS_RELEASE/assets?name=${TRIPLE}-savi.tar.gz" \
'