149 lines (143 loc) · 4.71 KB
/
build.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
name: Rust Build and Test
### https://github.com/harmless-tech/rust-github-actions
on:
push:
branches: [ main ]
paths: [ .github/workflows/build.yml, keys/**, src/**, test/**, build.rs, Cargo.lock, Cargo.toml, Cross.toml ]
pull_request:
branches: [ main ]
paths: [ .github/workflows/build.yml, keys/**, src/**, test/**, build.rs, Cargo.lock, Cargo.toml, Cross.toml ]
workflow_dispatch:
env:
feature-set: ''
CARGO_TERM_COLOR: always
jobs:
ink-cross:
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-unknown-linux-gnu
can-test: false
- target: aarch64-unknown-linux-musl
can-test: false
- target: armv7-unknown-linux-gnueabihf
can-test: false
- target: armv7-unknown-linux-musleabihf
can-test: false
- target: powerpc64le-unknown-linux-gnu
can-test: false
- target: riscv64gc-unknown-linux-gnu
can-test: false
- target: s390x-unknown-linux-gnu
can-test: false
- target: x86_64-unknown-linux-gnu
can-test: true
- target: x86_64-unknown-linux-musl
can-test: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Run tests
if: ${{ matrix.can-test }}
run: |
docker run --rm \
--userns host --user $(id -u):$(id -g) \
-v ./:/project \
ghcr.io/cargo-prebuilt/ink-cross:stable-${{ matrix.target }} \
test --verbose --workspace --target ${{ matrix.target }} ${{ env.feature-set }}
- name: Build with ink cross
run: |
docker run --rm \
--userns host --user $(id -u):$(id -g) \
-v ./:/project \
ghcr.io/cargo-prebuilt/ink-cross:stable-${{ matrix.target }} \
build --verbose --workspace --target ${{ matrix.target }} ${{ env.feature-set }}
cross:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-freebsd
can-test: false
- target: x86_64-unknown-netbsd
can-test: false
- target: x86_64-unknown-illumos
can-test: false
- target: powerpc64-unknown-linux-gnu
can-test: true
- target: x86_64-pc-windows-gnu
can-test: true
ending: .exe
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update Rust and add target
run: |
rustup update
rustc --version
rustup target add ${{ matrix.target }}
- uses: cargo-prebuilt/cargo-prebuilt-action@v3
with:
pkgs: cross
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Run tests
if: ${{ matrix.can-test }}
run: cross test --verbose --workspace --target ${{ matrix.target }} ${{ env.feature-set }}
- name: Build
run: cross build --verbose --workspace --target ${{ matrix.target }} ${{ env.feature-set }}
apple-darwin:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
can-test: true
- target: aarch64-apple-darwin
can-test: false
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Update Rust and add target
run: |
rustup update
rustc --version
rustup target add ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Run tests
if: ${{ matrix.can-test }}
run: cargo test --verbose --workspace --target ${{ matrix.target }} ${{ env.feature-set }}
- name: Build
run: cargo build --verbose --workspace --target ${{ matrix.target }} ${{ env.feature-set }}
pc-windows-msvc:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-msvc
can-test: true
- target: aarch64-pc-windows-msvc
can-test: false
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Update Rust and add target
run: |
rustup update
rustc --version
rustup target add ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Run tests
if: ${{ matrix.can-test }}
run: cargo test --verbose --workspace --target ${{ matrix.target }} ${{ env.feature-set }}
- name: Build
run: cargo build --verbose --workspace --target ${{ matrix.target }} ${{ env.feature-set }}