-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (103 loc) · 3.85 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
name: ci
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
build_runtime:
name: Build Runtime
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
archive: tgz
experimental: false
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
archive: tgz
apt-arch: arm64
experimental: false
- target: x86_64-apple-darwin
os: macos-latest
opts: --no-default-features --features=rt,rt-wasm3,rt-wasmtime,hal-mock
archive: tgz
experimental: false
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
archive: tgz
apt-arch: armhf
opts: --no-default-features --features=rt,rt-wasm3,hal-linux,hal-mock
experimental: false
- target: x86_64-pc-windows-msvc
os: windows-latest
archive: zip
opts: --no-default-features --features=rt,rt-wasmtime,hal-mock
ext: .exe
experimental: true
steps:
- uses: actions/checkout@v2
- uses: FranzDiebold/[email protected]
- name: Configure toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2021-11-01
target: ${{ matrix.target }}
override: true
components: rustfmt, clippy
- name: Setup caching
uses: actions/cache@v2
with:
key: rt-${{ matrix.os }}-${{ matrix.target }}
path: |
~/.cargo/registry
~/.cargo/git
target/${{ matrix.target }}
- name: Install libclang for bindgen
if: ${{ matrix.os == 'ubuntu-latest'}}
run: |
sudo apt install libclang-dev
- name: Install cross toolchain (armv7)
if: ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }}
run: sudo apt install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
- name: Install cross toolchain (aarch64)
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
run: sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Build Runtime
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.use_cross }}
command: build
args: --target ${{ matrix.target }} --release ${{ matrix.opts }}
- name: Upload runtime artifacts
uses: actions/upload-artifact@v2
with:
name: rt-${{matrix.target}}
path: target/${{ matrix.target }}/release/wasm-embedded-rt${{ matrix.ext }}
- name: Copy release artifact
run: cp target/${{ matrix.target }}/release/wasm-embedded-rt${{ matrix.ext }} wasm-embedded-rt${{ matrix.ext }}
- name: Create archive (tgz, linux)
if: ${{ matrix.os != 'macos-latest' && matrix.os != 'windows-latest' }}
run: tar -czvf wasm-embedded-rt-${{ matrix.target }}.tgz wasm-embedded-rt${{ matrix.ext }}
- name: Create archive (zip, windows)
if: ${{ matrix.os == 'windows-latest' }}
run: tar.exe -a -c -f wasm-embedded-rt-${{ matrix.target }}.zip wasm-embedded-rt${{ matrix.ext }}
- name: Create archive (zip, macos)
if: ${{ matrix.os == 'macos-latest' }}
run: zip wasm-embedded-rt-${{ matrix.target }}.zip wasm-embedded-rt${{ matrix.ext }}
- name: Upload binary to release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: wasm-embedded-rt-${{ matrix.target }}.${{ matrix.archive }}
asset_name: wasm-embedded-rt-${{ matrix.target }}.${{ matrix.archive }}
tag: ${{ github.ref }}
overwrite: true