-
Notifications
You must be signed in to change notification settings - Fork 8
98 lines (80 loc) · 2.38 KB
/
main.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
name: Main
on:
push:
env:
CARGO_TERM_COLOR: always
jobs:
build-test:
name: Build and test (${{ matrix.os }})
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: swatinem/rust-cache@v2
- name: Build
run: >
cargo build
--locked
--verbose
- name: Run tests (without coverage)
if: matrix.os != 'ubuntu-latest'
run: >
cargo test
--verbose
- name: Install cargo-tarpaulin (for coverage)
# As recommened by `cargo-binstall` team:
# https://github.com/cargo-bins/cargo-binstall/tree/d5549ce99ebc82b1ceee93a41375137b7dbd1a1f#faq
uses: taiki-e/install-action@v2
if: matrix.os == 'ubuntu-latest'
with:
tool: cargo-tarpaulin
- name: Install (minimal) nightly toolchain
if: matrix.os == 'ubuntu-latest'
run: rustup toolchain install --profile minimal nightly
- name: Run tests (with coverage)
if: matrix.os == 'ubuntu-latest'
run: >
cargo tarpaulin
--verbose
--out Xml
--engine llvm
--skip-clean
--doc
--exclude-files 'benches/*,build.rs,src/macros.rs'
- name: Upload coverage reports to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
release-please:
name: Execute release chores
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
needs: build-test
outputs:
created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: rust
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
needs: release-please
if: needs.release-please.outputs.created
environment: crates.io
steps:
- uses: actions/checkout@v3
- uses: swatinem/rust-cache@v2
- name: Publish
# https://doc.rust-lang.org/cargo/reference/config.html?highlight=CARGO_REGISTRY_TOKEN#credentials
run: >
cargo publish
--verbose
--locked
--no-verify
--token ${{ secrets.CARGO_REGISTRY_TOKEN }}