-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (143 loc) · 7.26 KB
/
ci.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
# One approach to testing changes to the asset upload to release process is to:
# 1. Fork this repo to your personal account
# 2. Go into the repo settings on your fork, go to _Actions_, go to _General_, under _Workflow permissions_, select _Read and Write permissions_, then _Save_
# 3. Add your fork as a new remote and push your branch to it
# 4. Publish a release in your personal fork with the target of the release set to the branch with your changes
# 5. Confirm the workflow completes and that assets are attached to the release as expected
name: Build wasm-mutate runtime only
on:
workflow_dispatch:
# Build and attach assets to any published releases
release:
types:
- published
# Test on main
push:
branches:
- main
paths:
- "wasm-tools/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
compile_cli:
name: compile_cli-${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: linux
os: ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
path: wasm-tools/target/x86_64-unknown-linux-gnu/release/wasm-tools
asset_name: wasm-tools-runtime-x86_64-linux-${{ github.event.release.tag_name }}
shasum_cmd: sha256sum
features: --features wasm-mutate/runtime-only
target: x86_64-unknown-linux-gnu
# - name: linux-arm64
#os: ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
# path: target/aarch64-unknown-linux-gnu/release/dtw-tools
# asset_name: dtw-tools-arm-linux-${{ github.event.release.tag_name }}
# shasum_cmd: sha256sum
# target: aarch64-unknown-linux-gnu
- name: macos
os: macos-latest
path: wasm-tools/target/x86_64-apple-darwin/release/wasm-tools
asset_name: wasm-tools-runtime-x86_64-macos-${{ github.event.release.tag_name }}
shasum_cmd: shasum -a 256
features: --features wasm-mutate/runtime-only
target: x86_64-apple-darwin
- name: wasm
os: macos-latest
path: wasm-tools/target/wasm32-wasi/release/wasm-tools.wasm
asset_name: wasm-tools-wasm-${{ github.event.release.tag_name }}
shasum_cmd: shasum -a 256
features: --no-default-features --features mutate,wasm-mutate/runtime-only
target: wasm32-wasi
- name: macos-arm64
os: macos-latest
path: wasm-tools/target/aarch64-apple-darwin/release/wasm-tools
asset_name: wasm-tools-runtime-arm-macos-${{ github.event.release.tag_name }}
shasum_cmd: shasum -a 256
features: --features wasm-mutate/runtime-only
target: aarch64-apple-darwin
- name: linux-all
os: ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
path: wasm-tools/target/x86_64-unknown-linux-gnu/release/wasm-tools
asset_name: wasm-tools-all-x86_64-linux-${{ github.event.release.tag_name }}
shasum_cmd: sha256sum
features: --features wasm-mutate/default
target: x86_64-unknown-linux-gnu
# - name: linux-arm64
#os: ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
# path: target/aarch64-unknown-linux-gnu/release/dtw-tools
# asset_name: dtw-tools-arm-linux-${{ github.event.release.tag_name }}
# shasum_cmd: sha256sum
# target: aarch64-unknown-linux-gnu
- name: macos-all
os: macos-latest
path: wasm-tools/target/x86_64-apple-darwin/release/wasm-tools
asset_name: wasm-tools-all-x86_64-macos-${{ github.event.release.tag_name }}
shasum_cmd: shasum -a 256
features: --features wasm-mutate/default
target: x86_64-apple-darwin
- name: wasm-all
os: macos-latest
path: wasm-tools/target/wasm32-wasi/release/wasm-tools.wasm
asset_name: wasm-tools-wasm-all-${{ github.event.release.tag_name }}
shasum_cmd: shasum -a 256
features: --no-default-features --features mutate,wasm-mutate/default
target: wasm32-wasi
- name: macos-arm64-all
os: macos-latest
path: wasm-tools/target/aarch64-apple-darwin/release/wasm-tools
asset_name: wasm-tools-all-arm-macos-${{ github.event.release.tag_name }}
shasum_cmd: shasum -a 256
features: --features wasm-mutate/default
target: aarch64-apple-darwin
#- name: windows
# os: windows-latest
# path: target\x86_64-pc-windows-msvc\release\dtw-tools.exe
# asset_name: dtw-tools-x86_64-windows-${{ github.event.release.tag_name }}
# shasum_cmd: sha256sum
# target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: ./.github/actions/install-rust
# Should no-op except for macos-arm and linux-arm cases where that target won't be installed
- name: Install target
run: rustup target add wasm32-wasi wasm32-unknown-unknown ${{ matrix.target }}
# wasmtime-fiber and binaryen fail to compile without this
- name: Install Aarch64 GCC toolchain
run: sudo apt-get --assume-yes install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu || true
if: matrix.target == 'aarch64-unknown-linux-gnu'
- name: Build CLI ${{ matrix.os }}
run: cd wasm-tools && cargo build --release ${{ matrix.features }} --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Archive assets
run: gzip -k -f ${{ matrix.path }} && mv ${{ matrix.path }}.gz ${{ matrix.asset_name }}.gz
- name: Upload assets to artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.asset_name }}.gz
path: ${{ matrix.asset_name }}.gz
- name: Upload assets to release
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GH }}
run: gh release upload ${{ github.event.release.tag_name }} ${{ matrix.asset_name }}.gz
- name: Generate asset hash
run: ${{ matrix.shasum_cmd }} ${{ matrix.asset_name }}.gz | awk '{ print $1 }' > ${{ matrix.asset_name }}.gz.sha256
- name: Upload asset hash to artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.asset_name }}.gz.sha256
path: ${{ matrix.asset_name }}.gz.sha256
- name: Upload asset hash to release
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GH }}
run: gh release upload ${{ github.event.release.tag_name }} ${{ matrix.asset_name }}.gz.sha256