Skip to content

Commit 71d6a89

Browse files
authored
chore: Rust toolchain/CI update and workspace setup (#2830)
* chore: Rust toolchain/CI update and workspace setup * chore: clean up clippy.toml
1 parent c4203db commit 71d6a89

File tree

112 files changed

+7788
-24944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+7788
-24944
lines changed

.github/workflows/ci-cosmwasm-contract.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,12 @@ jobs:
2121
working-directory: target_chains/cosmwasm/contracts/pyth
2222
steps:
2323
- uses: actions/checkout@v2
24-
- uses: actions-rs/toolchain@v1
25-
with:
26-
toolchain: 1.82.0
27-
components: rustfmt, clippy
28-
override: true
24+
- uses: actions-rust-lang/setup-rust-toolchain@v1
2925
- name: Format check
3026
run: cargo fmt --all -- --check
3127
if: success() || failure()
3228
- name: Clippy check
33-
run: cargo clippy --tests -- --deny warnings
29+
run: cargo clippy --all-targets -- --deny warnings
3430
if: success() || failure()
3531
- name: Build
3632
run: cargo build --verbose

.github/workflows/ci-fortuna.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,13 @@ jobs:
1616
working-directory: apps/fortuna
1717
steps:
1818
- uses: actions/checkout@v2
19-
- uses: Swatinem/rust-cache@v2
20-
with:
21-
workspaces: "apps/fortuna -> target"
22-
- uses: actions-rs/toolchain@v1
23-
with:
24-
toolchain: 1.82.0
25-
override: true
26-
components: rustfmt, clippy
19+
- uses: actions-rust-lang/setup-rust-toolchain@v1
2720
- name: Format check
2821
run: cargo fmt --all -- --check
2922
if: success() || failure()
3023
- name: Clippy check
31-
run: cargo clippy --tests -- --deny warnings
24+
run: cargo clippy -p fortuna --all-targets -- --deny warnings
3225
if: success() || failure()
3326
- name: Run tests
34-
run: cargo test
27+
run: cargo test -p fortuna -- --test-threads=1
3528
if: success() || failure()

.github/workflows/ci-fuel-contract.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ jobs:
1919
working-directory: target_chains/fuel/contracts/
2020
steps:
2121
- uses: actions/checkout@v2
22-
- uses: Swatinem/rust-cache@v2
2322
with:
24-
workspaces: "target_chains/fuel/contracts -> target"
23+
cache-workspaces: "target_chains/fuel/contracts -> target"
2524
- name: Install Fuel toolchain
2625
run: |
2726
curl https://install.fuel.network | sh

.github/workflows/ci-hermes-server.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,9 @@ jobs:
1515
working-directory: apps/hermes/server
1616
steps:
1717
- uses: actions/checkout@v2
18-
- uses: Swatinem/rust-cache@v2
18+
- uses: actions-rust-lang/setup-rust-toolchain@v1
1919
with:
20-
workspaces: "apps/hermes/server -> target"
21-
- uses: actions-rs/toolchain@v1
22-
with:
23-
toolchain: 1.82.0
24-
components: rustfmt, clippy
25-
override: true
20+
cache-workspaces: "apps/hermes/server -> target"
2621
- name: Install protoc
2722
uses: arduino/setup-protoc@v3
2823
with:
@@ -31,7 +26,7 @@ jobs:
3126
run: cargo fmt --all -- --check
3227
if: success() || failure()
3328
- name: Clippy check
34-
run: cargo clippy --tests -- --deny warnings
29+
run: cargo clippy --all-targets -- --deny warnings
3530
if: success() || failure()
3631
- name: Run executor tests
3732
run: cargo test

.github/workflows/ci-lazer-rust.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ jobs:
2020
with:
2121
submodules: recursive
2222
- uses: actions-rust-lang/setup-rust-toolchain@v1
23-
with:
24-
toolchain: 1.82.0
25-
components: clippy,rustfmt
26-
- uses: Swatinem/rust-cache@v2
27-
with:
28-
workspaces: "lazer -> target"
2923
- name: Install Protoc
3024
uses: arduino/setup-protoc@v3
3125
with:
@@ -45,11 +39,8 @@ jobs:
4539
run: cargo fmt --all -- --check
4640
if: success() || failure()
4741
- name: Clippy check
48-
run: cargo clippy --all-targets -- --deny warnings
49-
if: success() || failure()
50-
- name: Build Solana programs
51-
run: cargo build-sbf
42+
run: cargo clippy -p pyth-lazer-protocol -p pyth-lazer-client -p pyth-lazer-publisher-sdk --all-targets -- --deny warnings
5243
if: success() || failure()
5344
- name: test
54-
run: cargo test
45+
run: cargo test -p pyth-lazer-protocol -p pyth-lazer-client -p pyth-lazer-publisher-sdk
5546
if: success() || failure()

.github/workflows/ci-lazer-solana-contract.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/checkout@v4
2020
- uses: actions-rust-lang/setup-rust-toolchain@v1
2121
with:
22-
toolchain: 1.82.0
22+
cache-workspaces: "lazer/contracts/solana -> target"
2323
- name: install taplo
2424
run: cargo install --locked taplo-cli@0.9.3
2525
- uses: actions/setup-node@v4
@@ -45,7 +45,19 @@ jobs:
4545
- name: Install Anchor
4646
run: |
4747
rustup install 1.79.0
48+
# anchor requires nightly for ABI generation and it's broken for more recent nightly versions
4849
rustup install nightly-2025-04-15
50+
# This anchor version doesn't build with newer Rust
4951
RUSTFLAGS= cargo +1.79.0 install --git https://github.com/coral-xyz/anchor --tag v0.30.1 --locked anchor-cli
5052
- name: Run anchor tests
5153
run: pnpm run test:anchor
54+
- name: check Cargo.toml formatting
55+
run: find . -name Cargo.toml -exec taplo fmt --check --diff {} \;
56+
- name: Format check
57+
run: cargo fmt --all -- --check
58+
- name: Clippy check
59+
run: cargo clippy --all-targets -- --deny warnings
60+
- name: Build contract
61+
run: cargo build-sbf
62+
- name: test
63+
run: cargo test

.github/workflows/ci-message-buffer.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,9 @@ jobs:
1717
steps:
1818
- name: Checkout sources
1919
uses: actions/checkout@v3
20-
- uses: Swatinem/rust-cache@v2
20+
- uses: actions-rust-lang/setup-rust-toolchain@v1
2121
with:
22-
workspaces: "pythnet/message_buffer -> target"
23-
- uses: actions-rs/toolchain@v1
24-
with:
25-
toolchain: 1.66.1
26-
components: rustfmt, clippy
22+
cache-workspaces: "pythnet/message_buffer -> target"
2723
- name: Install Solana
2824
run: |
2925
wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
@@ -32,7 +28,10 @@ jobs:
3228
echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
3329
- name: Install Anchor
3430
run: |
35-
cargo install --git https://github.com/coral-xyz/anchor --tag v0.27.0 anchor-cli --locked
31+
unset CARGO_UNSTABLE_SPARSE_REGISTRY
32+
unset CARGO_REGISTRIES_CRATES_IO_PROTOCOL
33+
# Anchor doesn't build with newer Rust
34+
cargo +1.66.1 install --git https://github.com/coral-xyz/anchor --tag v0.27.0 anchor-cli --locked
3635
- name: Install g++ 12
3736
run: |
3837
sudo apt-get install g++-12
@@ -50,7 +49,12 @@ jobs:
5049
with:
5150
run_install: true
5251
- name: Build and generate IDLs
53-
run: anchor build
52+
run: |
53+
unset CARGO_UNSTABLE_SPARSE_REGISTRY
54+
unset CARGO_REGISTRIES_CRATES_IO_PROTOCOL
55+
rustup override set 1.66.1
56+
anchor build
57+
rustup override unset
5458
- name: Copy anchor target files
5559
run: cp ./target/idl/message_buffer.json idl/ && cp ./target/types/message_buffer.ts idl/
5660
- name: Fix formatting (to avoid pre-commit failures)
@@ -64,5 +68,4 @@ jobs:
6468
run: cargo fmt --all -- --check
6569
if: success() || failure()
6670
- name: Cargo clippy
67-
run: cargo clippy --tests -- --deny warnings
68-
if: success() || failure()
71+
run: cargo clippy --all-targets -- --deny warnings

.github/workflows/ci-near-contract.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
working-directory: target_chains/near/receiver
2323
steps:
2424
- uses: actions/checkout@v2
25-
- uses: Swatinem/rust-cache@v2
25+
- uses: actions-rust-lang/setup-rust-toolchain@v1
2626
with:
27-
workspaces: "target_chains/near/receiver -> target"
27+
cache-workspaces: "target_chains/near/receiver -> target"
2828
- name: Test
2929
run: ./workspace-test.sh
3030
reproducible-build:
@@ -35,11 +35,11 @@ jobs:
3535
working-directory: target_chains/near/receiver
3636
steps:
3737
- uses: actions/checkout@v2
38-
- uses: Swatinem/rust-cache@v2
38+
- uses: actions-rust-lang/setup-rust-toolchain@v1
3939
with:
40-
workspaces: "target_chains/near/receiver -> target"
40+
cache-workspaces: "target_chains/near/receiver -> target"
4141
- run: sudo apt-get update && sudo apt-get install -y libudev-dev
42-
- run: cargo +stable install --locked cargo-near@0.13.3
42+
- run: cargo install --locked cargo-near@0.13.3
4343
- run: cargo near build reproducible-wasm
4444
- name: Upload artifact
4545
uses: actions/upload-artifact@v4

.github/workflows/ci-pyth-lazer-agent.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,12 @@ jobs:
2020
with:
2121
submodules: recursive
2222
- uses: actions-rust-lang/setup-rust-toolchain@v1
23-
with:
24-
toolchain: 1.87.0
25-
components: clippy,rustfmt
26-
- uses: Swatinem/rust-cache@v2
27-
with:
28-
workspaces: "apps/pyth-lazer-agent -> target"
2923
- name: Format check
3024
run: cargo fmt --all -- --check
3125
if: success() || failure()
3226
- name: Clippy check
33-
run: cargo clippy --all-targets -- --deny warnings
27+
run: cargo clippy -p pyth-lazer-agent --all-targets -- --deny warnings
3428
if: success() || failure()
3529
- name: test
36-
run: cargo test
30+
run: cargo test -p pyth-lazer-agent
3731
if: success() || failure()

.github/workflows/ci-pythnet-sdk.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,13 @@ jobs:
1515
working-directory: pythnet/pythnet_sdk
1616
steps:
1717
- uses: actions/checkout@v2
18-
- uses: Swatinem/rust-cache@v2
19-
with:
20-
workspaces: "pythnet/pythnet_sdk -> target"
21-
- uses: actions-rs/toolchain@v1
22-
with:
23-
toolchain: 1.82.0
24-
components: rustfmt, clippy
25-
override: true
18+
- uses: actions-rust-lang/setup-rust-toolchain@v1
2619
- name: Format check
2720
run: cargo fmt --all -- --check
2821
if: success() || failure()
2922
- name: Clippy check
30-
run: cargo clippy --tests -- --deny warnings
23+
run: cargo clippy -p pythnet-sdk --all-targets -- --deny warnings
3124
if: success() || failure()
3225
- name: Run executor tests
33-
run: cargo test
26+
run: cargo test -p pythnet-sdk
3427
if: success() || failure()

0 commit comments

Comments
 (0)