Skip to content

Commit 2bd3cf4

Browse files
committed
ci: remove deprecated action-rs for dtolnay instead
1 parent 652cad7 commit 2bd3cf4

File tree

3 files changed

+136
-50
lines changed

3 files changed

+136
-50
lines changed

.github/workflows/test.bak

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Check lock file, fmt, clippy
2+
# This workflow uses github runners.
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
# This may be adjusted to whatever suits best your runners config.
8+
# Current config will build on manual trigger or pull-request (each push)
9+
on:
10+
# pull_request can be removed, to save minutes on github runners
11+
pull_request:
12+
push:
13+
branches:
14+
- "main"
15+
workflow_dispatch:
16+
env:
17+
CARGO_TERM_COLOR: always
18+
jobs:
19+
test:
20+
runs-on: ubuntu-22.04
21+
steps:
22+
- name: checkout repo
23+
uses: actions/checkout@v4
24+
- name: set build cache
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
~/.cargo/bin/
29+
~/.cargo/registry/index/
30+
~/.cargo/registry/cache/
31+
~/.cargo/git/db/
32+
yellowstone-vixen/target/
33+
key: cargo-${{ hashFiles('**/Cargo.lock') }}-0002
34+
35+
# Cache Rust Nightly Toolchain
36+
- name: Cache Rust Nightly
37+
id: cache-rust-nightly
38+
uses: actions/cache@v4
39+
with:
40+
path: ~/.rustup
41+
key: rust-nightly-0001-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}
42+
43+
- name: Install Rust Nightly if Not Cached
44+
if: steps.cache-rust-nightly.outputs.cache-hit != 'true'
45+
uses: actions-rs/toolchain@v1
46+
with:
47+
toolchain: nightly
48+
components: rustfmt, clippy
49+
50+
- name: Check Rust Toolchain Version
51+
run: |
52+
rustc +nightly --version
53+
rustc --version
54+
cargo --version
55+
56+
- name: Install Latest Protoc
57+
run: |
58+
PROTOC_VERSION=26.1
59+
ARCH=x86_64
60+
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${ARCH}.zip
61+
sudo apt-get update
62+
sudo apt-get install -y unzip protobuf-compiler libprotobuf-dev
63+
unzip protoc-${PROTOC_VERSION}-linux-${ARCH}.zip -d $HOME/.local
64+
echo "$HOME/.local/bin" >> $GITHUB_PATH
65+
protoc --version
66+
67+
# Cargo.lock
68+
- name: Check lock file
69+
run: |
70+
cargo tree
71+
git checkout Cargo.lock
72+
cargo tree
73+
74+
# fmt
75+
- name: Check fmt
76+
run: cargo +nightly fmt --all -- --check
77+
78+
# clippy
79+
- name: Check clippy
80+
run: cargo clippy --all-targets --tests -- -Dwarnings

.github/workflows/test.yml

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,83 @@
1-
name: Check lock file, fmt, clippy
2-
# This workflow uses github runners.
1+
---
2+
name: Test code
33
concurrency:
44
group: ${{ github.workflow }}-${{ github.ref }}
55
cancel-in-progress: true
66

7-
# This may be adjusted to whatever suits best your runners config.
8-
# Current config will build on manual trigger or pull-request (each push)
97
on:
10-
# pull_request can be removed, to save minutes on github runners
11-
pull_request:
128
push:
13-
branches:
14-
- "main"
159
workflow_dispatch:
10+
1611
env:
1712
CARGO_TERM_COLOR: always
13+
1814
jobs:
1915
test:
20-
runs-on: ubuntu-22.04
16+
strategy:
17+
matrix:
18+
os: [ubuntu-22.04]
19+
20+
runs-on: ["${{ matrix.os }}"]
2121
steps:
22-
- name: checkout repo
23-
uses: actions/checkout@v4
24-
- name: set build cache
25-
uses: actions/cache@v4
22+
- uses: actions/checkout@v4
23+
with:
24+
submodules: recursive
25+
fetch-depth: 0
26+
27+
- uses: actions/cache@v4
2628
with:
2729
path: |
2830
~/.cargo/bin/
2931
~/.cargo/registry/index/
3032
~/.cargo/registry/cache/
3133
~/.cargo/git/db/
32-
yellowstone-vixen/target/
33-
key: cargo-${{ hashFiles('**/Cargo.lock') }}-0002
34+
./target
35+
key: v0001-${{ matrix.os }}-rust-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
36+
restore-keys: |
37+
v0001-${{ matrix.os }}-rust-${{ hashFiles('rust-toolchain.toml') }}
3438
35-
# Cache Rust Nightly Toolchain
36-
- name: Cache Rust Nightly
37-
id: cache-rust-nightly
38-
uses: actions/cache@v4
39-
with:
40-
path: ~/.rustup
41-
key: rust-nightly-0001-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}
39+
- name: Set rust version
40+
run: |
41+
echo "channel=$(cat rust-toolchain.toml | grep channel | awk '{print $3}' | sed 's/"//g')" >> "$GITHUB_ENV"
42+
echo "targets=$(cat rust-toolchain.toml | grep targets | awk '{print $3}' | sed 's/\[//' | sed 's/\]//' | sed 's/"//g')" >> "$GITHUB_ENV"
43+
echo "components=$(cat rust-toolchain.toml | grep components | awk -F = '{print $2}' | sed 's/\[//' | sed 's/\]//' | sed 's/"//g')" >> "$GITHUB_ENV"
4244
43-
- name: Install Rust Nightly if Not Cached
44-
if: steps.cache-rust-nightly.outputs.cache-hit != 'true'
45-
uses: actions-rs/toolchain@v1
45+
- uses: dtolnay/rust-toolchain@stable
4646
with:
4747
toolchain: nightly
48-
components: rustfmt, clippy
4948

50-
- name: Check Rust Toolchain Version
51-
run: |
52-
rustc +nightly --version
53-
rustc --version
54-
cargo --version
55-
56-
- name: Install Latest Protoc
57-
run: |
58-
PROTOC_VERSION=26.1
59-
ARCH=x86_64
60-
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${ARCH}.zip
61-
sudo apt-get update
62-
sudo apt-get install -y unzip protobuf-compiler libprotobuf-dev
63-
unzip protoc-${PROTOC_VERSION}-linux-${ARCH}.zip -d $HOME/.local
64-
echo "$HOME/.local/bin" >> $GITHUB_PATH
65-
protoc --version
49+
- uses: dtolnay/rust-toolchain@stable
50+
with:
51+
toolchain: ${{ env.channel }}
52+
components: ${{ env.components }}
6653

67-
# Cargo.lock
68-
- name: Check lock file
54+
- name: cargo tree
6955
run: |
7056
cargo tree
7157
git checkout Cargo.lock
72-
cargo tree
58+
cargo tree --frozen --offline
7359
74-
# fmt
75-
- name: Check fmt
60+
- name: Install toolchain components
61+
run: |
62+
rustup component add --toolchain nightly rustfmt
63+
rustup component add --toolchain ${{ env.channel }} clippy
64+
65+
- name: Run fmt
7666
run: cargo +nightly fmt --all -- --check
7767

78-
# clippy
79-
- name: Check clippy
68+
- name: cargo deny check advisories
69+
uses: EmbarkStudios/cargo-deny-action@v1
70+
with:
71+
command: check advisories
72+
73+
- name: install protoc
74+
run: |
75+
sudo apt update
76+
sudo apt install protobuf-compiler
77+
78+
- name: Run clippy
8079
run: cargo clippy --all-targets --tests -- -Dwarnings
80+
81+
- name: Test build
82+
run: |
83+
cargo build

rust-toolchain.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[toolchain]
2-
channel = "stable"
2+
channel = "1.85.0"
3+
components = ["rustfmt", "clippy"]
4+
targets = []
5+
profile = "minimal"

0 commit comments

Comments
 (0)