-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (84 loc) · 2.21 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: test
on:
push:
branches:
- main
- master
pull_request:
workflow_dispatch:
release:
types: [created]
env:
CARGO_TERM_COLOR: always
jobs:
build-doc-draft:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- name: Checkout main
uses: actions/checkout@v4
- name: Build only
uses: shalzz/zola-deploy-action@v0.18.0
env:
BUILD_DIR: docs
BUILD_ONLY: true
BUILD_FLAGS: --drafts
build_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: 🔨 Build
run: cargo build
- name: ✔️ Tests
run: cargo test
bench:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: ⏲️ Bench
run: cargo bench
dry_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v2
with:
dry-run: true
publish:
runs-on: ubuntu-latest
needs: [dry_publish,build_test,build-doc-draft]
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
release:
runs-on: ubuntu-latest
name: release ${{ matrix.target }}
if: github.event_name == 'release' && github.event.action == 'created'
needs: [dry_publish,build_test,build-doc-draft]
strategy:
fail-fast: false
matrix:
target: [x86_64-pc-windows-gnu, x86_64-unknown-linux-musl, x86_64-apple-darwin]
steps:
- uses: actions/checkout@master
- name: Compile and release
uses: rust-build/rust-build.action@v1.4.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
RUSTTARGET: ${{ matrix.target }}
EXTRA_FILES: "README.md LICENSE"
TOOLCHAIN_VERSION: 1.76