-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (111 loc) · 2.92 KB
/
test.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
name: Test
on:
- push
- pull_request
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup Rust stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: Check code format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
test:
name: Test (${{ matrix.rust-toolchain }})
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
rust-toolchain:
- stable
- beta
- nightly
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup Rust ${{ matrix.rust-toolchain }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust-toolchain }}
override: true
- name: Setup cache for cargo
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-${{ matrix.rust-toolchain }}
- name: Test with ${{ matrix.feature }} feature
uses: actions-rs/cargo@v1
with:
command: test
cover:
name: Coverage
runs-on: ubuntu-latest
needs: test
if: "!startsWith(github.ref, 'refs/tags/v')"
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup Rust stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Setup cache for cargo
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-${{ matrix.rust-toolchain }}
- name: Measure code coverage with ${{ matrix.feature }} feature
uses: actions-rs/tarpaulin@v0.1
with:
version: '0.16.0'
args: '-v --out Xml --ciserver github-actions'
- name: Upload coverage statistics
uses: codecov/codecov-action@v2
publish:
needs: test
runs-on: ubuntu-latest
environment: Crates.io
if: "startsWith(github.ref, 'refs/tags/v')"
name: Publish
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup Rust ${{ matrix.rust-toolchain }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Package and publish declaration crate
uses: actions-rs/cargo@v1
with:
command: publish
args: '--token ${{ secrets.CRATES_IO_TOKEN }}'
release:
name: Release
environment: GitHub Releases
needs: publish
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Update release notes
if: startsWith(github.ref, 'refs/tags/')
uses: rasmus-saks/release-a-changelog-action@v1.0.1
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'