-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (153 loc) · 4.58 KB
/
rust-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
on:
push:
branches:
- main
tags:
- "*"
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: CI
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: wasm32-unknown-unknown
components: rustc-dev, clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: check rustfmt
run: cargo fmt -- --check --color always
- run: cargo fetch
- name: cargo clippy
run: cargo clippy --all-features --all-targets -- --no-deps -D warnings
test:
name: Tests
strategy:
matrix:
os: [macos-latest, windows-2022, ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: wasm32-unknown-unknown
components: rustc-dev, clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fetch
- name: cargo test build
run: cargo build --tests --release
- name: run tests
run: ./test.sh
msrv-check:
name: Minimum Stable Rust Version Check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.80.0"
- uses: Swatinem/rust-cache@v2
- run: cargo fetch
- name: cargo check
run: cargo check --all-targets
build-aarch64-apple-darwin:
name: Build aarch64-apple-darwin
runs-on: macos-latest
env:
TRIPLE: aarch64-apple-darwin
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ env.TRIPLE }}
- uses: Swatinem/rust-cache@v2
- run: cargo fetch --target ${{ env.TRIPLE }}
- run: cargo build --release --target ${{ env.TRIPLE }}
# deny-check:
# name: cargo-deny
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v3
# - uses: EmbarkStudios/cargo-deny-action@v1
# check-self:
# name: archival
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v3
# - uses: dtolnay/rust-toolchain@stable
# with:
# targets: x86_64-unknown-linux-musl
# - run: sudo apt install -y musl-tools
# - uses: Swatinem/rust-cache@v2
# - run: cargo run --release --target x86_64-unknown-linux-musl -- generate --fail about.hbs
publish-check:
name: Publish Check
runs-on: ubuntu-22.04
container: ghcr.io/cross-rs/aarch64-unknown-linux-musl:edge
strategy:
matrix:
include:
- target: aarch64-unknown-linux-musl
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: apt-get update && apt-get --assume-yes install libssl-dev
- run: cargo fetch
- name: cargo publish
run: cargo publish --dry-run --all-features --target ${{ matrix.target }}
release:
name: Release
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
include:
- os: ubuntu-22.04
target: x86_64-unknown-linux-musl
- os: ubuntu-22.04
target: aarch64-unknown-linux-musl
container: ghcr.io/cross-rs/aarch64-unknown-linux-musl:edge
- os: windows-2022
target: x86_64-pc-windows-msvc
- os: macOS-latest
target: x86_64-apple-darwin
- os: macOS-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Install musl tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt install -y musl-tools
- name: Checkout
uses: actions/checkout@v3
- name: cargo fetch
run: cargo fetch --target ${{ matrix.target }}
- name: Release build
run: cargo build --release --target ${{ matrix.target }}
- name: Package
shell: bash
env:
NAME: archival
TARGET: ${{ matrix.target }}
run: .github/scripts/package.sh
- name: Publish
uses: softprops/action-gh-release@v1
with:
draft: false
files: "archival*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}