diff --git a/.github/workflows/ci-aptos-contract.yml b/.github/workflows/ci-aptos-contract.yml index 33b74c8ee5..0c02995936 100644 --- a/.github/workflows/ci-aptos-contract.yml +++ b/.github/workflows/ci-aptos-contract.yml @@ -1,6 +1,7 @@ on: pull_request: paths: + - .github/workflows/ci-aptos-contract.yml - target_chains/aptos/contracts/** push: branches: @@ -19,10 +20,22 @@ jobs: - uses: actions/checkout@v3 - name: Download CLI - run: wget https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-v3.1.0/aptos-cli-3.1.0-Ubuntu-22.04-x86_64.zip + run: wget https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-v6.1.1/aptos-cli-6.1.1-Ubuntu-22.04-x86_64.zip - name: Unzip CLI - run: unzip aptos-cli-3.1.0-Ubuntu-22.04-x86_64.zip + run: unzip aptos-cli-6.1.1-Ubuntu-22.04-x86_64.zip + + - name: Install movefmt + run: ./aptos update movefmt + + - name: Check Formatting + run: ./aptos move fmt + if: success() || failure() + + - name: Lint + run: ./aptos move lint --check-test-code --dev + if: success() || failure() - name: Run tests run: ./aptos move test + if: success() || failure() diff --git a/.github/workflows/ci-cosmwasm-contract.yml b/.github/workflows/ci-cosmwasm-contract.yml index 9bcb9ee0ef..cdac37b467 100644 --- a/.github/workflows/ci-cosmwasm-contract.yml +++ b/.github/workflows/ci-cosmwasm-contract.yml @@ -3,6 +3,7 @@ name: Test CosmWasm Contract on: pull_request: paths: + - .github/workflows/ci-cosmwasm-contract.yml - target_chains/cosmwasm/** - wormhole_attester/sdk/rust/** push: @@ -26,7 +27,15 @@ jobs: toolchain: 1.82.0 components: rustfmt, clippy override: true + - name: Format check + run: cargo fmt --all -- --check + if: success() || failure() + - name: Clippy check + run: cargo clippy --tests -- --deny warnings + if: success() || failure() - name: Build run: cargo build --verbose + if: success() || failure() - name: Run tests run: cargo test --verbose + if: success() || failure() diff --git a/.github/workflows/ci-fortuna.yml b/.github/workflows/ci-fortuna.yml index 837c85d67f..dd37da7c41 100644 --- a/.github/workflows/ci-fortuna.yml +++ b/.github/workflows/ci-fortuna.yml @@ -3,12 +3,16 @@ name: Check Fortuna on: pull_request: paths: + - .github/workflows/ci-fortuna.yml - apps/fortuna/** push: branches: [main] jobs: test: runs-on: ubuntu-latest + defaults: + run: + working-directory: apps/fortuna steps: - uses: actions/checkout@v2 - uses: Swatinem/rust-cache@v2 @@ -19,5 +23,12 @@ jobs: profile: minimal toolchain: 1.82.0 override: true - - name: Run executor tests - run: cargo test --manifest-path ./apps/fortuna/Cargo.toml + - name: Format check + run: cargo fmt --all -- --check + if: success() || failure() + - name: Clippy check + run: cargo clippy --tests -- --deny warnings + if: success() || failure() + - name: Run tests + run: cargo test + if: success() || failure() diff --git a/.github/workflows/ci-hermes-server.yml b/.github/workflows/ci-hermes-server.yml index 0bde6e1f08..30835d2722 100644 --- a/.github/workflows/ci-hermes-server.yml +++ b/.github/workflows/ci-hermes-server.yml @@ -3,12 +3,16 @@ name: Check Hermes Server on: pull_request: paths: + - .github/workflows/ci-hermes-server.yml - apps/hermes/server/** push: branches: [main] jobs: test: runs-on: ubuntu-latest + defaults: + run: + working-directory: apps/hermes/server steps: - uses: actions/checkout@v2 - uses: Swatinem/rust-cache@v2 @@ -24,5 +28,12 @@ jobs: uses: arduino/setup-protoc@v3 with: repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Format check + run: cargo fmt --all -- --check + if: success() || failure() + - name: Clippy check + run: cargo clippy --tests -- --deny warnings + if: success() || failure() - name: Run executor tests - run: cargo test --manifest-path ./apps/hermes/server/Cargo.toml + run: cargo test + if: success() || failure() diff --git a/.github/workflows/ci-lazer-rust.yml b/.github/workflows/ci-lazer-rust.yml index 6191d11e92..f744f8e582 100644 --- a/.github/workflows/ci-lazer-rust.yml +++ b/.github/workflows/ci-lazer-rust.yml @@ -5,6 +5,7 @@ on: - main pull_request: paths: + - .github/workflows/ci-lazer-rust.yml - lazer/** jobs: @@ -36,7 +37,15 @@ jobs: echo "$HOME/.local/share/solana/install/active_release/bin" >> "$GITHUB_PATH" - name: check Cargo.toml formatting run: find . -name Cargo.toml -exec taplo fmt --check --diff {} \; + - name: Format check + run: cargo fmt --all -- --check + if: success() || failure() + - name: Clippy check + run: cargo clippy --all-targets -- --deny warnings + if: success() || failure() - name: Build Solana programs run: cargo build-sbf + if: success() || failure() - name: test run: cargo test + if: success() || failure() diff --git a/.github/workflows/ci-message-buffer-idl.yml b/.github/workflows/ci-message-buffer.yml similarity index 80% rename from .github/workflows/ci-message-buffer-idl.yml rename to .github/workflows/ci-message-buffer.yml index 79c3cf0fd3..27a2a4328b 100644 --- a/.github/workflows/ci-message-buffer-idl.yml +++ b/.github/workflows/ci-message-buffer.yml @@ -1,14 +1,15 @@ -name: Message Buffer IDL Check +name: Message Buffer Check on: pull_request: paths: + - .github/workflows/ci-message-buffer.yml - pythnet/message_buffer/** push: branches: - main jobs: abi-check: - name: Check Message Buffer IDL files are up to date + name: Check Message Buffer formatting & IDL files runs-on: ubuntu-latest defaults: run: @@ -33,10 +34,10 @@ jobs: - name: Install Anchor run: | cargo install --git https://github.com/coral-xyz/anchor --tag v0.27.0 anchor-cli --locked - - name: Build and generate IDLs - run: anchor build - - name: Copy anchor target files - run: cp ./target/idl/message_buffer.json idl/ && cp ./target/types/message_buffer.ts idl/ + - name: Install g++ 12 + run: | + sudo apt-get install g++-12 + echo "CXX=/usr/bin/g++-12" >> "${GITHUB_ENV}" # Libusb is a build requirement for the node-hid package and so pnpm # install will fail if this isn't in the build environment and if a # precompiled binary isn't found. @@ -46,6 +47,10 @@ jobs: name: Install pnpm - name: Install prettier globally run: pnpm install -g prettier@2.7.1 + - name: Build and generate IDLs + run: anchor build + - name: Copy anchor target files + run: cp ./target/idl/message_buffer.json idl/ && cp ./target/types/message_buffer.ts idl/ - name: Run prettier (to avoid pre-commit failures) run: | pnpm dlx prettier@2.7.1 --write "./idl/*" @@ -53,3 +58,10 @@ jobs: # Fails if the IDL files are not up to date. Please use anchor build to regenerate the IDL files for # the current version of the contract and update idl directory. run: git diff --exit-code idl/* + if: success() || failure() + - name: Cargo format + run: cargo fmt --all -- --check + if: success() || failure() + - name: Cargo clippy + run: cargo clippy --tests -- --deny warnings + if: success() || failure() diff --git a/.github/workflows/ci-pythnet-sdk.yml b/.github/workflows/ci-pythnet-sdk.yml new file mode 100644 index 0000000000..7e33385b67 --- /dev/null +++ b/.github/workflows/ci-pythnet-sdk.yml @@ -0,0 +1,34 @@ +name: Check Pythnet SDK + +on: + pull_request: + paths: + - .github/workflows/ci-pythnet-sdk.yml + - pythnet/pythnet_sdk/** + push: + branches: [main] +jobs: + test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: pythnet/pythnet_sdk + steps: + - uses: actions/checkout@v2 + - uses: Swatinem/rust-cache@v2 + with: + workspaces: "pythnet/pythnet_sdk -> target" + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.82.0 + override: true + - name: Format check + run: cargo fmt --all -- --check + if: success() || failure() + - name: Clippy check + run: cargo clippy --tests -- --deny warnings + if: success() || failure() + - name: Run executor tests + run: cargo test + if: success() || failure() diff --git a/.github/workflows/ci-remote-executor.yml b/.github/workflows/ci-remote-executor.yml index 1a1ffce1ff..170ba01e73 100644 --- a/.github/workflows/ci-remote-executor.yml +++ b/.github/workflows/ci-remote-executor.yml @@ -3,12 +3,16 @@ name: Check Remote Executor on: pull_request: paths: + - .github/workflows/ci-remote-executor.yml - governance/remote_executor/** push: branches: [main] jobs: test: runs-on: ubuntu-latest + defaults: + run: + working-directory: governance/remote_executor steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 @@ -25,5 +29,12 @@ jobs: run: | sh -c "$(curl -sSfL https://release.solana.com/v1.18.23/install)" echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH + - name: Format check + run: cargo fmt --all -- --check + if: success() || failure() + - name: Clippy check + run: cargo clippy --tests -- --deny warnings + if: success() || failure() - name: Run executor tests - run: cargo test-sbf --manifest-path ./governance/remote_executor/Cargo.toml + run: cargo test-sbf + if: success() || failure() diff --git a/.github/workflows/ci-solana-contract.yml b/.github/workflows/ci-solana-contract.yml index 451d98451e..b6d1c905bb 100644 --- a/.github/workflows/ci-solana-contract.yml +++ b/.github/workflows/ci-solana-contract.yml @@ -3,6 +3,7 @@ name: Test Solana Contract on: pull_request: paths: + - .github/workflows/ci-solana-contract.yml - target_chains/solana/** - pythnet/pythnet_sdk/** push: @@ -32,9 +33,18 @@ jobs: run: | sh -c "$(curl -sSfL https://release.solana.com/v1.16.20/install)" echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH + - name: Format check + run: cargo fmt --all -- --check + if: success() || failure() + - name: Clippy check + run: cargo clippy --tests -- --deny warnings + if: success() || failure() - name: Build run: cargo-build-sbf + if: success() || failure() - name: Run tests run: cargo-test-sbf + if: success() || failure() - name: Run sdk tests run: cargo test --package pyth-solana-receiver-sdk + if: success() || failure() diff --git a/target_chains/aptos/contracts/sources/governance/governance_action.move b/target_chains/aptos/contracts/sources/governance/governance_action.move index 77a5bd2ca5..d9ee369da1 100644 --- a/target_chains/aptos/contracts/sources/governance/governance_action.move +++ b/target_chains/aptos/contracts/sources/governance/governance_action.move @@ -11,6 +11,7 @@ module pyth::governance_action { value: u8, } + #[lint::skip(unnecessary_numerical_extreme_comparison)] public fun from_u8(value: u8): GovernanceAction { assert!(CONTRACT_UPGRADE <= value && value <= SET_STALE_PRICE_THRESHOLD, error::invalid_governance_action()); GovernanceAction { value }