-
Notifications
You must be signed in to change notification settings - Fork 3
170 lines (143 loc) · 4.28 KB
/
prerelease.yaml
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
name: Prerelease tvm-cli
on:
workflow_dispatch:
push:
branches:
- main
- 'rc-[0-9]+.[0-9]+'
- 'rc-[0-9]+.[0-9]+.[0-9]+'
tags:
- '[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
result:
- tvm-cli-darwin-arm64
- tvm-cli-darwin-amd64
- tvm-cli-linux-arm64
- tvm-cli-linux-amd64
include:
# targets
- result: tvm-cli-darwin-arm64
target: aarch64-apple-darwin
os: macos-13
- result: tvm-cli-darwin-amd64
target: x86_64-apple-darwin
os: macos-13
- result: tvm-cli-linux-arm64
target: aarch64-unknown-linux-musl
os: ubuntu-latest
- result: tvm-cli-linux-amd64
target: x86_64-unknown-linux-musl
os: ubuntu-latest
name: Build ${{ matrix.target }}
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_VERSION: ${{ vars.SCCACHE_GHA_VERSION || 1 }} # Setting this env var enables the caching
RUSTC_WRAPPER: sccache
CMAKE_C_COMPILER_LAUNCHER: sccache
CMAKE_CXX_COMPILER_LAUNCHER: sccache
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set VERSION
id: version
run: |
echo "VERSION=$(cat version.json | jq -r .version)" >> "$GITHUB_OUTPUT"
- name: Configure sccache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Setup cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: builder-${{ runner.os }}-cargo
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install Linux tools
if: startsWith(matrix.os, 'ubuntu-')
env:
packages: >-
build-essential
cmake
curl
clang
librocksdb-dev
protobuf-compiler
python3-pip
run: |
sudo apt update -yq
sudo apt install -yq $packages
pip3 install ziglang
[[ -f ~/.cargo/bin/cargo-zigbuild ]] || cargo install cargo-zigbuild
- name: Install MacOS tools
if: startsWith(matrix.os, 'macos-')
run: |
brew install protobuf
- name: Build Binary
env:
CARGO_INCREMENTAL: 0 # important for cache size too
CARGO_NET_RETRY: 10
RUST_BACKTRACE: full
RUSTUP_MAX_RETRIES: 10
run: |
cargo update
if [[ "${{ runner.os }}" == "macOS" ]]; then
cargo build -r --target ${{ matrix.target }} -p tvm_cli --bin tvm-cli
else
cargo zigbuild -r --target ${{ matrix.target }} -p tvm_cli --bin tvm-cli
fi
ls -lA target/${{ matrix.target }}/release
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
path: target/${{ matrix.target }}/release/tvm-cli
name: ${{ matrix.result }}
if-no-files-found: error
retention-days: 3
outputs:
version: ${{ steps.version.outputs.VERSION }}
release:
needs:
- build
runs-on: ubuntu-latest
strategy:
matrix:
result:
- tvm-cli-darwin-arm64
- tvm-cli-darwin-amd64
- tvm-cli-linux-arm64
- tvm-cli-linux-amd64
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: ls -R
- name: Make archive
run: |
chmod +x ${{ matrix.result }}/*
cd ${{ matrix.result }}
tar -czvf ../${{ matrix.result }}.tar.gz .
- name: Upload Prerelease
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: ${{ github.ref_name }}
files: |
${{ matrix.result }}.tar.gz
name: "Version: ${{ github.ref_name }}"
body: ""