-
Notifications
You must be signed in to change notification settings - Fork 13
68 lines (63 loc) · 2.79 KB
/
rust.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
name: Rust
on: [push, pull_request]
# See https://rust-cli.github.io/book/tutorial/packaging.html#building-binary-releases-on-ci and
# https://github.com/sharkdp/bat/blob/master/.github/workflows/CICD.yml for a more intricate CI/CD
jobs:
CI:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features
- name: Check
run: cargo check --all-targets --verbose
- name: Check (features=debug)
run: cargo check --all-targets --verbose --features debug
- name: Check Documentation
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --no-deps --document-private-items
- name: Tests
run: cargo test --verbose
- name: Tests (features=debug)
run: cargo test --verbose --features debug
- name: Benchmark
run: |
cargo build --release
./benchmark.sh --bkt=target/release/bkt -- sleep 1
CD:
needs: CI
name: CD (${{ matrix.arch.target }} - ${{ matrix.arch.os }})
runs-on: ${{ matrix.arch.os }}
strategy:
fail-fast: false
matrix:
arch:
- { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04 , use-cross: true }
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04 , use-cross: true }
- { target: i686-unknown-linux-gnu , os: ubuntu-20.04 , use-cross: true }
- { target: i686-unknown-linux-musl , os: ubuntu-20.04 , use-cross: true }
- { target: x86_64-apple-darwin , os: macos-12 }
- { target: x86_64-pc-windows-msvc , os: windows-2019 , suffix: .exe }
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 }
- { target: x86_64-unknown-linux-musl , os: ubuntu-20.04 , use-cross: true }
steps:
- uses: actions/checkout@v3
- name: Extract crate information
shell: bash
run: |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml)" >> "$GITHUB_ENV"
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> "$GITHUB_ENV"
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.arch.use-cross }}
command: build
args: --release --target=${{ matrix.arch.target }}
- name: Upload package artifact
uses: actions/upload-artifact@master
with:
name: '${{ env.PROJECT_NAME }}.v${{ env.PROJECT_VERSION }}.${{ matrix.arch.target }}'
path: 'target/${{ matrix.arch.target }}/release/${{ env.PROJECT_NAME }}${{ matrix.arch.suffix }}'