-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (128 loc) · 4.31 KB
/
ci.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
name: CI
on:
push:
jobs:
audit:
name: Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- uses: actions-rust-lang/audit@v1
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- name: Install Toolchains
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 'stable'
target: 'thumbv7em-none-eabihf'
- name: Cargo Doc
run: cargo doc --verbose --no-deps --document-private-items --features=xmc4100
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- name: Install nightly toolchain with rustfmt available
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
components: rustfmt
- name: Run cargo fmt
uses: actions-rust-lang/rustfmt@v1
# test:
# needs: [format, docs]
# strategy:
# fail-fast: false
# matrix:
# rust-channel: [ 'stable', 'nightly' ]
# rust-target: [ 'x86_64-unknown-linux-gnu', 'thumbv7em-none-eabihf' ]
# device: ['xmc4100', 'xmc4200', 'xmc4300', 'xmc4400', 'xmc4500', 'xmc4700', 'xmc4800']
# name: Test-${{ matrix.rust-channel }}-x86_64-unknown-linux-gnu-${{ matrix.device }}
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4.1.1
# - name: Install toolchain
# uses: actions-rust-lang/setup-rust-toolchain@v1
# with:
# toolchain: ${{ matrix.rust-channel }}
# target: 'x86_64-unknown-linux-gnu'
# - name: Cargo Test
# run: cargo test --lib --target x86_64-unknown-linux-gnu --features ${{ matrix.device }}
build:
needs: [format, docs] # Need tests once they are enabled again
strategy:
fail-fast: false
matrix:
rust-channel: [ 'stable', 'nightly' ]
rust-target: [ 'x86_64-unknown-linux-gnu', 'thumbv7em-none-eabihf' ]
device: ['xmc4100', 'xmc4200', 'xmc4300', 'xmc4400', 'xmc4500', 'xmc4700', 'xmc4800']
name: Build-${{ matrix.rust-channel }}-${{ matrix.rust-target }}-${{ matrix.device }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- name: Install toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.rust-channel }}
target: ${{ matrix.rust-target }}
- name: Cargo Check
run: cargo check --target ${{ matrix.rust-target }} --features=${{ matrix.device }}
- name: Cargo Build
run: cargo build --verbose --target ${{ matrix.rust-target }} --features=${{ matrix.device }}
examples:
needs: [build]
strategy:
matrix:
device: ['xmc4100', 'xmc4200', 'xmc4300', 'xmc4400', 'xmc4500', 'xmc4700', 'xmc4800']
name: Examples-${{ matrix.device }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- name: Setup toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 'stable'
target: 'thumbv7em-none-eabihf'
- name: Build Examples
run: cargo build --examples --features=${{ matrix.device }}
release-please:
name: Execute release chores
needs: build
if: contains(github.ref, 'master')
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
outputs:
created: ${{ steps.release.outputs.release_created }}
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
release-type: rust
token: ${{ secrets.GH_PERSONAL_TOKEN }}
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@v4
- name: Install toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
target: thumbv7em-none-eabihf
- 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
--features xmc4200
--token ${{ secrets.CRATES_TOKEN }}