-
Notifications
You must be signed in to change notification settings - Fork 21
269 lines (264 loc) · 10.4 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
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
269
name: Release
on:
release:
types: [published]
workflow_dispatch:
jobs:
# linux x86_64 cpu/tpu
linux:
# We intentionally build on ubuntu 20 to compile against
# an older version of glibc
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: "24"
elixir-version: "1.12.3"
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "5.3.0"
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- run: python -m pip install --upgrade pip numpy
# Build and upload the archives
- run: mix deps.get
- run: .github/scripts/compile_unless_exists.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
CC: gcc-9
- run: .github/scripts/compile_unless_exists.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: tpu
CC: gcc-9
- run: .github/scripts/upload_archives.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # linux x86_64 cpu musl
# alpine:
# runs-on: ubuntu-20.04
# strategy:
# fail-fast: false
# container: hexpm/elixir:1.13.4-erlang-25.0.2-alpine-3.16.0
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# XLA_TARGET: cpu
# BAZEL_VERSION: "5.3.0"
# BAZEL_SHA256SUM: "ee801491ff0ec3a562422322a033c9afe8809b64199e4a94c7433d4e14e6b921 bazel-5.3.0-dist.zip"
# JAVA_HOME: "/usr/lib/jvm/default-jvm"
# steps:
# - name: Install system packages
# run: |
# apk update && apk upgrade && \
# apk add --no-cache python3 py3-pip python3-dev py3-numpy && \
# apk add --no-cache libstdc++ openjdk11 && \
# apk add --no-cache bash curl git wget && \
# apk add --no-cache musl-dev make libexecinfo libexecinfo-dev && \
# apk add --no-cache coreutils gcc g++ linux-headers unzip zip && \
# apk add --no-cache automake gcc subversion && \
# apk add --no-cache github-cli && \
# DIR=$(mktemp -d) && cd ${DIR} && \
# curl -sLO https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-dist.zip && \
# echo ${BAZEL_SHA256SUM} | sha256sum --check && \
# unzip bazel-${BAZEL_VERSION}-dist.zip && \
# EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" bash ./compile.sh && \
# cp ${DIR}/output/bazel /usr/local/bin/ && \
# rm -rf ${DIR}
# - name: Install hex
# run: mix local.hex --force && mix local.rebar --force
# # Prevent git from checking the repository owner and erroring with "dubious ownership"
# - run: git config --global --add safe.directory '*'
# - uses: actions/checkout@v3
# # Build and upload the archive
# - run: mix deps.get
# - run: .github/scripts/compile_unless_exists.sh
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# XLA_TARGET: cpu
# - run: .github/scripts/upload_archives.sh
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# darwin x86_64 cpu
macos:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- run: brew install elixir
- run: mix local.hex --force
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "5.3.0"
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- run: python -m pip install --upgrade pip numpy
# Build and upload the archive
- run: mix deps.get
- run: .github/scripts/compile_unless_exists.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
CC: gcc-9
- run: .github/scripts/upload_archives.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# darwin aarch64 cpu (cross-compiled)
macos_arm:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- run: brew install elixir
- run: mix local.hex --force
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "5.3.0"
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- run: python -m pip install --upgrade pip numpy
# Build and upload the archive
- run: mix deps.get
- run: .github/scripts/compile_unless_exists.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
# Explicitly cross-compile for arm64
BUILD_FLAGS: "--config=macos_arm64"
CC: gcc-9
- name: Rename archive
run: |
# Ensure tasks are compiled
mix compile
build_archive_dir=$(mix xla.info build_archive_dir)
if [[ -d $build_archive_dir ]]; then
archive_path=$(find $build_archive_dir -type f)
actual_archive_path="${archive_path/x86_64/aarch64}"
echo "$archive_path -> $actual_archive_path"
mv $archive_path $actual_archive_path
fi;
- run: .github/scripts/upload_archives.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# linux x86_64 cuda
linux_cuda:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
# Note: we use exact references, because the images may be updated with cuDNN
# version bumps unexpectedly
# - container: nvidia/cuda:11.4.3-cudnn8-devel-ubuntu20.04
- container: nvidia/cuda@sha256:275d35f7985cfe12dc3e6e40a3df5fff2bb217b1c248f0f70dadaa298d1b938b
xla_target: cuda114
python: "3.9"
# - container: nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04
- container: nvidia/cuda@sha256:3e11776b02b6bb3a0e707e68b9b2524e3cfc436d2ca8fb1aef60c999cff5064b
xla_target: cuda118
python: "3.9"
# - container: nvidia/cuda:12.0.0-cudnn8-devel-ubuntu20.04
- container: nvidia/cuda@sha256:c004833aa563c0c1068a9fe3f77d92ce1a07425b1ddc8637ba4f274e63403b26
xla_target: cuda120
python: "3.9"
container: ${{ matrix.container }}
env:
# This env is normally set by default, but we need to mirror it into the container
# ourselves (used by the actions/setup-beam).
ImageOS: ubuntu20
# Set the missing UTF-8 locale, otherwise Elixir warns
LC_ALL: C.UTF-8
# Make sure installing packages (like tzdata) doesn't prompt for configuration
DEBIAN_FRONTEND: noninteractive
steps:
# The base images are minimalistic, so we bring a few necessary system packages
- name: Install system packages
run: |
# We need to install "add-apt-repository" first
apt-get update && apt-get install -y software-properties-common
# Add repository with the latest git version for action/checkout to properly clone the repo
add-apt-repository ppa:git-core/ppa
# We run as root, so sudo is not necessary per se, but some actions (like setup-bazel) make use of it
apt-get update && apt-get install -y ca-certificates curl git sudo unzip wget
# Install GitHub CLI used by our scripts
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
apt-get update && apt-get install -y gh
# Prevent git from checking the repository owner and erroring with "dubious ownership"
- run: git config --global --add safe.directory '*'
# Proceed with the regular steps
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: "24"
elixir-version: "1.12.3"
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "5.3.0"
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
env:
# Avoid permission errors for /github/home, in this case the directory
# is used for pip cache and is not relevant either way
HOME: /root
- run: python -m pip install --upgrade pip numpy
# Build and upload the archive
- run: mix deps.get
- run: .github/scripts/compile_unless_exists.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: ${{ matrix.xla_target }}
- run: .github/scripts/upload_archives.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# linux aarch64 cpu (cross-compiled)
linux_arm:
# We intentionally build on ubuntu 20 to compile against
# an older version of glibc
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: "24"
elixir-version: "1.12.3"
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "5.3.0"
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- run: python -m pip install --upgrade pip numpy
# Build and upload the archives
- run: mix deps.get
# Hide system OpenSSL as suggested in https://github.com/tensorflow/tensorflow/issues/48401#issuecomment-818377995
- run: sudo mv /usr/include/openssl /usr/include/openssl.original
- run: .github/scripts/compile_unless_exists.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
# Explicitly cross-compile for arm64
BUILD_FLAGS: "--config=elinux_aarch64"
CC: gcc-9
- name: Rename archive
run: |
# Ensure tasks are compiled
mix compile
build_archive_dir=$(mix xla.info build_archive_dir)
if [[ -d $build_archive_dir ]]; then
archive_path=$(find $build_archive_dir -type f)
actual_archive_path="${archive_path/x86_64/aarch64}"
echo "$archive_path -> $actual_archive_path"
mv $archive_path $actual_archive_path
fi;
- run: .github/scripts/upload_archives.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}