Skip to content

Commit 43a98b0

Browse files
authored
Try #580:
2 parents 8515d40 + ca7ca3a commit 43a98b0

File tree

7 files changed

+136
-111
lines changed

7 files changed

+136
-111
lines changed

.github/bors.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ block_labels = ["needs-decision", "S-waiting-on-team"]
22
delete_merged_branches = true
33
required_approvals = 1
44
status = [
5+
"Rustfmt",
56
"CI",
67
]
78
timeout_sec = 14400

.github/workflows/ci.yml

Lines changed: 79 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,80 @@ jobs:
99
ci:
1010
name: CI
1111
runs-on: ubuntu-latest
12-
needs: [ci-linux]
13-
steps:
12+
needs: [check, ci-linux, ci-serde]
13+
steps:
1414
- name: Done
1515
run: exit 0
16+
17+
check:
18+
name: Cargo check
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
TARGET: [x86_64-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc]
23+
24+
steps:
25+
- uses: actions/checkout@v2
26+
27+
- uses: actions-rs/toolchain@v1
28+
with:
29+
profile: minimal
30+
toolchain: stable
31+
override: true
32+
target: ${{ matrix.TARGET }}
33+
34+
- name: Cache Dependencies
35+
uses: Swatinem/rust-cache@v1
36+
with:
37+
key: ${{ matrix.TARGET }}
38+
39+
- uses: actions-rs/cargo@v1
40+
with:
41+
command: check
42+
args: --target ${{ matrix.TARGET }}
43+
44+
prebuild:
45+
name: Prebuild
46+
runs-on: ubuntu-latest
47+
strategy:
48+
matrix:
49+
rust: [stable, nightly, 1.46.0]
50+
51+
steps:
52+
- uses: actions/checkout@v2
53+
54+
- uses: actions-rs/toolchain@v1
55+
with:
56+
profile: minimal
57+
toolchain: ${{ matrix.rust }}
58+
override: true
59+
60+
- name: Cache
61+
uses: Swatinem/rust-cache@v1
62+
with:
63+
sharedKey: prebuilded
64+
65+
- name: Self install
66+
run: |
67+
cargo install svd2rust --path .
68+
1669
ci-linux:
1770
runs-on: ubuntu-latest
71+
needs: [check, prebuild]
1872
strategy:
19-
fail-fast: false
2073
matrix:
2174
# All generated code should be running on stable now
2275
rust: [stable]
2376

2477
# All vendor files we want to test on stable
25-
vendor: [rustfmt, Atmel, Freescale, Fujitsu, Holtek, Microchip, Nordic, Nuvoton, NXP, RISC-V, SiliconLabs, Spansion, STMicro, Toshiba]
26-
27-
# The default target we're compiling on and for
28-
TARGET: [x86_64-unknown-linux-gnu]
29-
30-
# Temporary hack as long as we use the current CI script
31-
TRAVIS_OS_NAME: [linux]
32-
33-
FEATURES: [""]
78+
vendor: [Atmel, Freescale_1, Freescale_2, Fujitsu_1, Fujitsu_2, Holtek, Microchip, Nordic, Nuvoton, NXP, RISC-V, SiliconLabs, Spansion, STMicro, Toshiba]
3479

3580
# Options are all, none, strict and const
3681
options: [all, none]
3782
exclude:
38-
- vendor: Fujitsu
83+
- vendor: Fujitsu_1
84+
options: all
85+
- vendor: Fujitsu_2
3986
options: all
4087
- vendor: Spansion
4188
options: all
@@ -47,66 +94,55 @@ jobs:
4794
# Test MSRV
4895
- rust: 1.46.0
4996
vendor: Nordic
50-
TARGET: x86_64-unknown-linux-gnu
51-
TRAVIS_OS_NAME: linux
5297

5398
# Use nightly for architectures which don't support stable
5499
- rust: nightly
55-
experimental: true
56100
vendor: OTHER
57-
TARGET: x86_64-unknown-linux-gnu
58-
TRAVIS_OS_NAME: linux
59101

60-
# Use nightly for architectures which don't support stable
102+
# Use nightly for architectures which don't support stable
61103
- rust: nightly
62-
experimental: true
63104
vendor: Espressif
64-
TARGET: x86_64-unknown-linux-gnu
65-
TRAVIS_OS_NAME: linux
66-
67-
# OSX
68-
- rust: stable
69-
TARGET: x86_64-apple-darwin
70-
TRAVIS_OS_NAME: osx
71-
72-
# Windows
73-
- rust: stable
74-
TARGET: x86_64-pc-windows-msvc
75-
TRAVIS_OS_NAME: windows
76105

77106
steps:
78107
- uses: actions/checkout@v2
108+
79109
- uses: actions-rs/toolchain@v1
80110
with:
81111
profile: minimal
82112
toolchain: ${{ matrix.rust }}
83-
target: ${{ matrix.TARGET }}
84113
override: true
85-
components: rustfmt
114+
115+
- name: Cache
116+
uses: Swatinem/rust-cache@v1
117+
with:
118+
sharedKey: prebuilded
119+
86120
- name: Run CI script for `${{ matrix.vendor }}` under rust `${{ matrix.rust }}` with options=`${{ matrix.options }}`
87121
env:
88-
TARGET: ${{ matrix.TARGET }}
89122
VENDOR: ${{ matrix.vendor }}
90-
FEATURES: ${{ matrix.FEATURES }}
91123
OPTIONS: ${{ matrix.options }}
92-
TRAVIS_OS_NAME: ${{ matrix.TRAVIS_OS_NAME }}
93124
run: bash ci/script.sh
125+
94126
ci-serde:
95127
runs-on: ubuntu-latest
96128
steps:
97129
- uses: actions/checkout@v2
130+
98131
- uses: actions-rs/toolchain@v1
99132
with:
100133
profile: minimal
101134
toolchain: stable
102135
override: true
103-
components: rustfmt
104-
- name: Install svdtools
105-
uses: actions-rs/install@v0.1
136+
137+
- name: Cache
138+
uses: Swatinem/rust-cache@v1
106139
with:
107-
crate: svdtools
108-
version: 0.2.0
109-
use-tool-cache: true
140+
key: svdtools-0.2.0
141+
142+
- name: Install svdtools
143+
run: |
144+
cargo install svdtools --version 0.2.0 --target-dir target
145+
110146
- name: Run CI script
111147
run: |
112148
wget https://stm32-rs.github.io/stm32-rs/stm32f411.svd.patched

.github/workflows/clippy.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v2
9+
910
- uses: actions-rs/toolchain@v1
1011
with:
1112
profile: minimal
1213
toolchain: stable
1314
override: true
1415
components: clippy
16+
17+
- name: Cache Dependencies
18+
uses: Swatinem/rust-cache@v1
19+
1520
- uses: actions-rs/clippy-check@v1
1621
with:
1722
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/rustfmt.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
on:
2+
push:
3+
branches: [ staging, trying, master ]
4+
pull_request:
5+
6+
name: Code formatting check
7+
8+
jobs:
9+
fmt:
10+
name: Rustfmt
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- uses: actions-rs/toolchain@v1
16+
with:
17+
profile: minimal
18+
toolchain: stable
19+
override: true
20+
components: rustfmt
21+
22+
- name: Cache Dependencies
23+
uses: Swatinem/rust-cache@v1
24+
25+
- uses: actions-rs/cargo@v1
26+
with:
27+
command: fmt
28+
args: --all -- --check

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1616

1717
### Added
1818

19+
- GHA: rust dependency caching
1920
- Support of reading SVD from YAML or JSON files instead of XML
2021

2122
### Changed

ci/install.sh

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)