Skip to content

Commit 626626a

Browse files
authored
Merge pull request astarte-platform#438 from joshuachp/chore/rust-toolchain
chore(rustup): add rust-toolchain.toml config
2 parents 8a38442 + 6ac7fc5 commit 626626a

File tree

8 files changed

+84
-145
lines changed

8 files changed

+84
-145
lines changed

.github/workflows/check.yaml

Lines changed: 44 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -29,72 +29,54 @@ env:
2929
CARGO_TERM_COLOR: always
3030
SCCACHE_GHA_ENABLED: "true"
3131
RUSTC_WRAPPER: "sccache"
32+
RUSTFLAGS: -D warnings
33+
RUSTDOCFLAGS: -D warnings
3234
jobs:
3335
fmt:
3436
runs-on: ubuntu-24.04
35-
name: stable / fmt
3637
steps:
3738
- uses: actions/checkout@v4
38-
- name: Install stable
39-
uses: dtolnay/rust-toolchain@stable
40-
with:
41-
components: rustfmt
39+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
4240
- name: Check formatting
4341
run: cargo fmt --check --all
4442
clippy:
4543
runs-on: ubuntu-24.04
46-
name: ${{ matrix.toolchain }} / clippy
47-
strategy:
48-
fail-fast: false
49-
matrix:
50-
toolchain: [stable, beta]
5144
steps:
5245
- uses: actions/checkout@v4
5346
- name: Install system dependencies
5447
run: |
55-
sudo apt update
56-
sudo apt-get -y install libsqlite3-dev libssl-dev
57-
- name: Install ${{ matrix.toolchain }}
58-
uses: dtolnay/rust-toolchain@master
59-
with:
60-
toolchain: ${{ matrix.toolchain }}
61-
components: clippy
62-
- name: Install sccache-cache
63-
uses: mozilla-actions/sccache-action@v0.0.9
48+
sudo apt-get update
49+
sudo apt-get -y install libsqlite3-dev
50+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
51+
- uses: mozilla-actions/sccache-action@v0.0.9
6452
- name: cargo clippy
65-
run: cargo clippy --locked --all-targets --all-features --workspace -- -D warnings
53+
run: cargo clippy --locked --all-targets --all-features --workspace
6654
doc:
6755
runs-on: ubuntu-24.04
68-
name: nightly / doc
69-
env:
70-
RUSTDOCFLAGS: -Dwarnings
7156
steps:
7257
- uses: actions/checkout@v4
7358
- name: Install system dependencies
7459
run: |
75-
sudo apt update
76-
sudo apt-get -y install libsqlite3-dev libssl-dev
77-
- name: Install nightly
78-
uses: dtolnay/rust-toolchain@nightly
79-
- name: Install sccache-cache
80-
uses: mozilla-actions/sccache-action@v0.0.9
60+
sudo apt-get update
61+
sudo apt-get -y install libsqlite3-dev
62+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
63+
with:
64+
toolchain: nightly
65+
- uses: mozilla-actions/sccache-action@v0.0.9
8166
- name: Install cargo-docs-rs
8267
uses: dtolnay/install@cargo-docs-rs
8368
- run: cargo docs-rs --locked
8469

85-
hack:
70+
features:
8671
runs-on: ubuntu-24.04
87-
name: ubuntu / stable / features
8872
steps:
8973
- uses: actions/checkout@v4
9074
- name: Install system dependencies
9175
run: |
92-
sudo apt update
93-
sudo apt-get -y install libsqlite3-dev libssl-dev
94-
- name: Install stable
95-
uses: dtolnay/rust-toolchain@stable
96-
- name: Install sccache-cache
97-
uses: mozilla-actions/sccache-action@v0.0.9
76+
sudo apt-get update
77+
sudo apt-get -y install libsqlite3-dev
78+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
79+
- uses: mozilla-actions/sccache-action@v0.0.9
9880
- name: cargo install cargo-hack
9981
uses: taiki-e/install-action@cargo-hack
10082
- name: cargo hack test
@@ -103,61 +85,53 @@ jobs:
10385
run: cargo hack --each-feature test --locked
10486
minimal-versions:
10587
runs-on: ubuntu-24.04
106-
name: ubuntu / stable / minimal-versions
10788
steps:
10889
- uses: actions/checkout@v4
10990
- name: Install system dependencies
11091
run: |
111-
sudo apt update
112-
sudo apt-get -y install libsqlite3-dev libssl-dev
113-
- name: Install stable
114-
uses: dtolnay/rust-toolchain@stable
115-
- name: Install nightly for -Zminimal-versions
116-
uses: dtolnay/rust-toolchain@nightly
117-
- name: Install cargo hack
118-
uses: taiki-e/install-action@cargo-hack
119-
- name: Install cargo minimal-versions
120-
uses: taiki-e/install-action@cargo-minimal-versions
121-
- name: Install sccache-cache
122-
uses: mozilla-actions/sccache-action@v0.0.9
123-
- name: rustup default stable
124-
run: rustup default stable
92+
sudo apt-get update
93+
sudo apt-get -y install libsqlite3-dev
94+
- name: install rust stable
95+
uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
96+
- name: install rust nightly
97+
uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
98+
with:
99+
toolchain: nightly
100+
- uses: mozilla-actions/sccache-action@v0.0.9
101+
- uses: taiki-e/install-action@v2.49.43
102+
with:
103+
tool: cargo-hack,cargo-minimal-versions
104+
- run: rustup default stable
125105
- name: Check minimal versions
126106
run: cargo minimal-versions check --workspace --ignore-private --detach-path-deps=skip-exact --direct
127-
env:
128-
RUSTFLAGS: -D warnings
129107
msrv:
130108
runs-on: ubuntu-24.04
131109
strategy:
132110
matrix:
133111
msrv: [1.78]
134-
name: ubuntu / ${{ matrix.msrv }}
112+
name: msrv / ${{ matrix.msrv }}
135113
steps:
136114
- uses: actions/checkout@v4
137115
- name: Install system dependencies
138116
run: |
139117
sudo apt update
140-
sudo apt-get -y install libsqlite3-dev libssl-dev
141-
- name: Install ${{ matrix.msrv }}
142-
uses: dtolnay/rust-toolchain@master
118+
sudo apt-get -y install libsqlite3-dev
119+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
143120
with:
144121
toolchain: ${{ matrix.msrv }}
145-
- name: Install sccache-cache
146-
uses: mozilla-actions/sccache-action@v0.0.9
147-
- name: Install cargo hack
148-
uses: taiki-e/install-action@cargo-hack
122+
- uses: mozilla-actions/sccache-action@v0.0.9
123+
- uses: taiki-e/install-action@cargo-hack
149124
- name: cargo +${{ matrix.msrv }} check
150-
run: cargo +${{ matrix.msrv }} hack --no-dev-deps check --all-features --exclude astarte-device-sdk-mock --exclude e2e-test
125+
run: cargo +${{ matrix.msrv }} hack --no-dev-deps check --all-features -p astarte-device-sdk
151126
# Run semver-check on release branch push or PR
152127
semver:
153128
if: startsWith(github.base_ref, 'release-') || startsWith(github.ref, 'release-')
154-
name: stable / semver
155129
runs-on: ubuntu-24.04
156130
steps:
157131
- uses: actions/checkout@v4
158-
- name: Install sccache-cache
159-
uses: mozilla-actions/sccache-action@v0.0.9
160-
- name: Check semver
132+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
133+
- uses: mozilla-actions/sccache-action@v0.0.9
134+
- name: Check library API semver breakages
161135
uses: obi1kenobi/cargo-semver-checks-action@v2
162136
with:
163137
release-type: patch
@@ -170,9 +144,7 @@ jobs:
170144
- name: Install system dependencies
171145
run: |
172146
sudo apt update
173-
sudo apt-get -y install libsqlite3-dev libssl-dev
174-
- name: Install sccache-cache
175-
uses: mozilla-actions/sccache-action@v0.0.9
176-
- name: Install stable
177-
uses: dtolnay/rust-toolchain@stable
147+
sudo apt-get -y install libsqlite3-dev
148+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
149+
- uses: mozilla-actions/sccache-action@v0.0.9
178150
- run: ./scripts/check-for-publish.sh

.github/workflows/e2e-test.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ jobs:
4646
- name: Install system dependencies
4747
run: |
4848
sudo apt update
49-
sudo apt-get -y install libsqlite3-dev libssl-dev
49+
sudo apt-get -y install libsqlite3-dev
50+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
51+
- uses: mozilla-actions/sccache-action@v0.0.9
5052
- name: Wait for Astarte to be healthy
5153
timeout-minutes: 10
5254
run: ./scripts/wait-for-astarte.sh
@@ -64,10 +66,6 @@ jobs:
6466
TOKEN=$(astartectl utils gen-jwt appengine)
6567
echo "E2E_TOKEN=$TOKEN" >> $GITHUB_ENV
6668
echo "E2E_STORE_DIR=$(mktemp -d)" >> $GITHUB_ENV
67-
- name: Install stable
68-
uses: dtolnay/rust-toolchain@stable
69-
- name: Install sccache-cache
70-
uses: mozilla-actions/sccache-action@v0.0.9
7169
- name: Run test
7270
# use the full command to use the sccache
7371
run: |

.github/workflows/multi-platform.yaml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# SPDX-License-Identifier: Apache-2.0
1818

1919
# Tests that don't run on linux
20-
name: multi-platfrom
20+
name: multi-platform
2121
on:
2222
workflow_call:
2323
workflow_dispatch:
@@ -27,22 +27,19 @@ env:
2727
CARGO_TERM_COLOR: always
2828
SCCACHE_GHA_ENABLED: "true"
2929
RUSTC_WRAPPER: "sccache"
30-
# Enable logging otherwise the logging lines will count as not covered in the test coverage
31-
RUST_LOG: trace
30+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
3231
jobs:
3332
test:
3433
runs-on: ${{ matrix.os }}
35-
name: ${{ matrix.os }} / stable / test
34+
name: ${{ matrix.os }} / test
3635
strategy:
3736
fail-fast: false
3837
matrix:
3938
os: [windows-latest]
4039
steps:
4140
- uses: actions/checkout@v4
42-
- name: Install stable
43-
uses: dtolnay/rust-toolchain@stable
44-
- name: Install sccache-cache
45-
uses: mozilla-actions/sccache-action@v0.0.9
41+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
42+
- uses: mozilla-actions/sccache-action@v0.0.9
4643
# Setup vcpkg binary cache
4744
# https://learn.microsoft.com/en-us/vcpkg/users/binarycaching#gha-quickstart
4845
- uses: actions/github-script@v7
@@ -53,9 +50,6 @@ jobs:
5350
- name: Set VCPKG_ROOT
5451
run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
5552
- name: Install dependencies
56-
run: vcpkg install --binarysource="clear;x-gha,readwrite" openssl:x64-windows-static-md sqlite3:x64-windows-static-md
57-
- name: cargo generate-lockfile
58-
if: hashFiles('Cargo.lock') == ''
59-
run: cargo generate-lockfile
53+
run: vcpkg install sqlite3:x64-windows-static-md
6054
- name: cargo test
61-
run: cargo test --locked --all-features --all-targets --workspace
55+
run: cargo test --locked --all-features --workspace

.github/workflows/publish.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ concurrency:
3434
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
3535
# It's not safe to cancel the publish
3636
cancel-in-progress: false
37+
env:
38+
CARGO_TERM_COLOR: always
39+
SCCACHE_GHA_ENABLED: "true"
40+
RUSTC_WRAPPER: "sccache"
3741
jobs:
3842
# Check that the create can be compiled with only the packaged files
3943
for-publish:
@@ -44,9 +48,9 @@ jobs:
4448
- name: Install system dependencies
4549
run: |
4650
sudo apt update
47-
sudo apt-get -y install libsqlite3-dev libssl-dev
48-
- name: Install sccache-cache
49-
uses: mozilla-actions/sccache-action@v0.0.9
51+
sudo apt-get -y install libsqlite3-dev
52+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
53+
- uses: mozilla-actions/sccache-action@v0.0.9
5054
- name: Install stable
5155
uses: dtolnay/rust-toolchain@stable
5256
- run: ./scripts/check-for-publish.sh
@@ -58,10 +62,9 @@ jobs:
5862
- uses: actions/checkout@v4
5963
- name: Install system dependencies
6064
run: |
61-
sudo apt update
62-
sudo apt-get -y install libsqlite3-dev libssl-dev
63-
- name: Install stable
64-
uses: dtolnay/rust-toolchain@stable
65+
sudo apt-get update
66+
sudo apt-get -y install libsqlite3-dev
67+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
6568
- name: publish creates
6669
env:
6770
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

.github/workflows/test.yaml

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,57 +29,36 @@ env:
2929
CARGO_TERM_COLOR: always
3030
SCCACHE_GHA_ENABLED: "true"
3131
RUSTC_WRAPPER: "sccache"
32-
# Enable logging otherwise the logging lines will count as not covered in the test coverage
33-
RUST_LOG: trace
3432
jobs:
35-
required:
33+
test:
3634
runs-on: ubuntu-24.04
37-
name: ubuntu / ${{ matrix.toolchain }}
38-
strategy:
39-
matrix:
40-
toolchain: [stable, beta]
4135
steps:
4236
- uses: actions/checkout@v4
4337
- name: Install system dependencies
4438
run: |
4539
sudo apt update
46-
sudo apt-get -y install libsqlite3-dev libssl-dev
47-
- name: Install ${{ matrix.toolchain }}
48-
uses: dtolnay/rust-toolchain@master
49-
with:
50-
toolchain: ${{ matrix.toolchain }}
51-
- name: Install sccache-cache
52-
uses: mozilla-actions/sccache-action@v0.0.9
53-
- name: cargo generate-lockfile
54-
if: hashFiles('Cargo.lock') == ''
55-
run: cargo generate-lockfile
56-
- name: Run cargo test --locked
40+
sudo apt-get -y install libsqlite3-dev
41+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
42+
- uses: mozilla-actions/sccache-action@v0.0.9
43+
- name: cargo test --locked
5744
run: cargo test --locked --all-features --all-targets --workspace
5845
# https://github.com/rust-lang/cargo/issues/6669
5946
- name: Run cargo test --doc
6047
run: cargo test --locked --all-features --doc --workspace
6148
coverage:
6249
runs-on: ubuntu-24.04
63-
name: ubuntu / stable / coverage
6450
steps:
6551
- uses: actions/checkout@v4
6652
- name: Install system dependencies
6753
run: |
6854
sudo apt update
69-
sudo apt-get -y install libsqlite3-dev libssl-dev
70-
- name: Install stable
71-
uses: dtolnay/rust-toolchain@stable
72-
with:
73-
components: llvm-tools
74-
- name: Install sccache-cache
75-
uses: mozilla-actions/sccache-action@v0.0.9
55+
sudo apt-get -y install libsqlite3-dev
56+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
57+
- uses: mozilla-actions/sccache-action@v0.0.9
7658
- name: cargo install cargo-tarpaulin
7759
uses: taiki-e/install-action@cargo-tarpaulin
78-
- name: cargo generate-lockfile
79-
if: hashFiles('Cargo.lock') == ''
80-
run: cargo generate-lockfile
8160
- name: Run cargo-tarpaulin with xml output
82-
run: cargo +stable tarpaulin --engine llvm --locked --all-features --ignore-tests --lib --out xml -- --test-threads 1
61+
run: cargo tarpaulin --engine llvm --locked --all-features --ignore-tests --lib --out xml -- --test-threads 1
8362
# Upload the coverage if we are not a PR from a fork, see ".github/workflows/coverage.yaml"
8463
- name: Upload to codecov.io
8564
if: ${{ github.event_name == 'push' }}

.github/workflows/warmup-caches.yaml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,14 @@ env:
3232
jobs:
3333
build:
3434
runs-on: ubuntu-24.04
35-
strategy:
36-
matrix:
37-
toolchain: [stable, beta, nightly]
38-
name: ${{ matrix.toolchain }} / build
35+
name: build
3936
steps:
4037
- uses: actions/checkout@v4
4138
- name: Install system dependencies
4239
run: |
4340
sudo apt update
44-
sudo apt-get -y install libsqlite3-dev libssl-dev
45-
- name: Install stable
46-
uses: dtolnay/rust-toolchain@master
47-
with:
48-
toolchain: ${{ matrix.toolchain }}
49-
- name: Install sccache-cache
50-
uses: mozilla-actions/sccache-action@v0.0.9
41+
sudo apt-get -y install libsqlite3-dev
42+
- uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
43+
- uses: mozilla-actions/sccache-action@v0.0.9
5144
- name: Build with all features
5245
run: cargo build --locked --all-targets --all-features --workspace

0 commit comments

Comments
 (0)