-
Notifications
You must be signed in to change notification settings - Fork 7
151 lines (143 loc) · 4.1 KB
/
development.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
name: Development
on:
- push
- workflow_dispatch
jobs:
test-build:
name: Build & Test
strategy:
matrix:
os:
- ubuntu-20.04
- macos-11
- windows-2019
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --all-features
- name: Test
uses: bp3d-actions/cargo@main
with:
check-name: cargo test (${{ matrix.os }})
command: test
args: --all-features --no-fail-fast
token: ${{ secrets.GITHUB_TOKEN }}
clippy:
name: Check | Clippy
if: ${{ always() }}
needs: test-build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Run check
uses: bp3d-actions/clippy-check@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
audit:
name: Check | Audit
if: ${{ always() }}
needs: test-build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Audit Tool
run: cargo install cargo-audit
- name: Run check
uses: bp3d-actions/audit-check@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
fmt:
name: Format Code
if: ${{ always() && github.ref != 'refs/heads/master' }}
needs:
- clippy
- audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Run code formatter
uses: bp3d-actions/rustfmt-check@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
version:
name: Get Version
needs: test-build
runs-on: ubuntu-latest
outputs:
name: ${{ steps.version.outputs.name }}
version: ${{ steps.version.outputs.version }}
isnew: ${{ steps.version.outputs.isnew }}
ispre: ${{ steps.version.outputs.ispre }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get Version
id: version
uses: bp3d-actions/cargo-version@main
with:
mode: get
token: ${{ secrets.GITHUB_TOKEN }}
create-pre-release:
name: Create Pre Release
needs: version
if: github.ref == 'refs/heads/develop' && needs.version.outputs.isnew == 'true' && needs.version.outputs.ispre == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Setup cargo
run: cargo login ${{ secrets.RELEASE_TOKEN }}
- name: Publish
run: cargo publish
- name: Create
uses: ncipollo/release-action@main
with:
tag: ${{ needs.version.outputs.version }}
commit: ${{ github.ref }}
prerelease: true
name: ${{ needs.version.outputs.name }} release ${{ needs.version.outputs.version }}
body: "[Link to crates.io](https://crates.io/crates/${{ needs.version.outputs.name }})"
create-release-pr:
name: Create Release Pull Request
needs: version
if: needs.version.outputs.isnew == 'true' && needs.version.outputs.ispre == 'false'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create Pull Request
uses: repo-sync/pull-request@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_branch: master
pr_title: Release ${{ needs.version.outputs.version }}