Skip to content

Commit 8cc4d5b

Browse files
committed
try to add dependency caching
1 parent 0c18cb1 commit 8cc4d5b

File tree

8 files changed

+118
-77
lines changed

8 files changed

+118
-77
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/changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout sources
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v3
1313

1414
- name: Changelog updated
1515
uses: Zomzog/changelog-checker@v1.2.0

.github/workflows/ci.yml

Lines changed: 78 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,73 @@ 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@v3
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@v3
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-v0.22
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, Fujitsu, Holtek, Microchip, Nordic, Nuvoton, NXP, RISC-V, SiliconLabs, Spansion, STMicro, Toshiba]
3479

3580
# Options are all, none, strict and const
3681
options: [all, none]
@@ -51,66 +96,55 @@ jobs:
5196
# Test MSRV
5297
- rust: 1.46.0
5398
vendor: Nordic
54-
TARGET: x86_64-unknown-linux-gnu
55-
TRAVIS_OS_NAME: linux
5699

57100
# Use nightly for architectures which don't support stable
58101
- rust: nightly
59-
experimental: true
60102
vendor: OTHER
61-
TARGET: x86_64-unknown-linux-gnu
62-
TRAVIS_OS_NAME: linux
63103

64-
# Use nightly for architectures which don't support stable
104+
# Use nightly for architectures which don't support stable
65105
- rust: nightly
66-
experimental: true
67106
vendor: Espressif
68-
TARGET: x86_64-unknown-linux-gnu
69-
TRAVIS_OS_NAME: linux
70-
71-
# OSX
72-
- rust: stable
73-
TARGET: x86_64-apple-darwin
74-
TRAVIS_OS_NAME: osx
75-
76-
# Windows
77-
- rust: stable
78-
TARGET: x86_64-pc-windows-msvc
79-
TRAVIS_OS_NAME: windows
80107

81108
steps:
82-
- uses: actions/checkout@v2
109+
- uses: actions/checkout@v3
110+
83111
- uses: actions-rs/toolchain@v1
84112
with:
85113
profile: minimal
86114
toolchain: ${{ matrix.rust }}
87-
target: ${{ matrix.TARGET }}
88115
override: true
89-
components: rustfmt
116+
117+
- name: Cache
118+
uses: Swatinem/rust-cache@v1
119+
with:
120+
sharedKey: prebuilded-v0.22
121+
90122
- name: Run CI script for `${{ matrix.vendor }}` under rust `${{ matrix.rust }}` with options=`${{ matrix.options }}`
91123
env:
92-
TARGET: ${{ matrix.TARGET }}
93124
VENDOR: ${{ matrix.vendor }}
94-
FEATURES: ${{ matrix.FEATURES }}
95125
OPTIONS: ${{ matrix.options }}
96-
TRAVIS_OS_NAME: ${{ matrix.TRAVIS_OS_NAME }}
97126
run: bash ci/script.sh
127+
98128
ci-serde:
99129
runs-on: ubuntu-latest
100130
steps:
101-
- uses: actions/checkout@v2
131+
- uses: actions/checkout@v3
132+
102133
- uses: actions-rs/toolchain@v1
103134
with:
104135
profile: minimal
105136
toolchain: stable
106137
override: true
107-
components: rustfmt
108-
- name: Install svdtools
109-
uses: actions-rs/install@v0.1
138+
139+
- name: Cache
140+
uses: Swatinem/rust-cache@v1
110141
with:
111-
crate: svdtools
112-
version: 0.2.0
113-
use-tool-cache: true
142+
key: svdtools-0.2.1
143+
144+
- name: Install svdtools
145+
run: |
146+
cargo install svdtools --version 0.2.1 --target-dir target
147+
114148
- name: Run CI script
115149
run: |
116150
wget https://stm32-rs.github.io/stm32-rs/stm32f411.svd.patched

.github/workflows/clippy.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ jobs:
55
clippy_check:
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@v2
8+
- uses: actions/checkout@v3
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@v3
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
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
- GHA: rust dependency caching
1011
- remove unnedded fields clone
1112
- Use reexport instead of type aliases in `derive_from_base`
1213

ci/install.sh

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

ci/script.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ main() {
9191

9292
# test crate
9393
cargo init --name foo $td
94-
echo 'cortex-m = "0.7.0"' >> $td/Cargo.toml
95-
echo 'cortex-m-rt = "0.6.13"' >> $td/Cargo.toml
96-
echo 'vcell = "0.1.2"' >> $td/Cargo.toml
94+
echo 'cortex-m = "0.7.4"' >> $td/Cargo.toml
95+
echo 'cortex-m-rt = "0.7.1"' >> $td/Cargo.toml
96+
echo 'vcell = "0.1.3"' >> $td/Cargo.toml
9797
echo '[profile.dev]' >> $td/Cargo.toml
9898
echo 'incremental = false' >> $td/Cargo.toml
9999

0 commit comments

Comments
 (0)