From 4568430232bd4b73e0fea46aeebfe74bb4d82ef6 Mon Sep 17 00:00:00 2001 From: microwavedcola1 Date: Mon, 20 Dec 2021 11:04:40 +0100 Subject: [PATCH 1/3] github instead of travis for ci tests Signed-off-by: microwavedcola1 --- .github/workflows/program.yml | 76 +++++++++++++++++++++++++++++++++++ .travis.yml | 27 ------------- 2 files changed, 76 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/program.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/program.yml b/.github/workflows/program.yml new file mode 100644 index 0000000..f2eb9f5 --- /dev/null +++ b/.github/workflows/program.yml @@ -0,0 +1,76 @@ +name: CI + +on: + push: + branches: [master, v*.*] + pull_request: + branches: [master, v*.*] + +env: + CARGO_TERM_COLOR: always + SOLANA_VERSION: "1.9.1" + RUST_TOOLCHAIN: nightly-2021-12-15 + +defaults: + run: + working-directory: ./ + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Install Rust nightly + uses: actions-rs/toolchain@v1 + with: + override: true + profile: minimal + toolchain: ${{ env.RUST_TOOLCHAIN }} + components: rustfmt, clippy + - name: Cache dependencies + uses: Swatinem/rust-cache@v1 + + - name: Run fmt + run: cargo fmt -- --check + # The style and complexity lints have not been processed yet. + - name: Run clippy + run: cargo clippy -- --deny=warnings --allow=clippy::style --allow=clippy::complexity + + tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Install Linux dependencies + run: sudo apt-get install -y pkg-config build-essential libudev-dev + - name: Install Rust nightly + uses: actions-rs/toolchain@v1 + with: + override: true + profile: minimal + toolchain: ${{ env.RUST_TOOLCHAIN }} + - name: Cache dependencies + uses: Swatinem/rust-cache@v1 + + # Install Solana + - name: Cache Solana binaries + uses: actions/cache@v2 + with: + path: ~/.cache/solana + key: ${{ runner.os }}-${{ env.SOLANA_VERSION }} + - name: Install Solana + run: | + sh -c "$(curl -sSfL https://release.solana.com/v${{ env.SOLANA_VERSION }}/install)" + echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH + export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" + solana --version + echo "Generating keypair..." + solana-keygen new -o "$HOME/.config/solana/id.json" --no-passphrase --silent + + - name: Run unit tests + run: cargo test --lib + - name: Build program + run: cargo build-bpf + - name: Run tests + run: cargo test-bpf diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f2001dc..0000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -dist: bionic -language: rust -rust: - - stable -env: - global: - - NODE_VERSION="v17.0.1" - - SOLANA_VERSION="v1.8.0" - -_defaults: &defaults - before_install: - - nvm install $NODE_VERSION - - sudo apt-get install -y pkg-config build-essential libudev-dev - - sh -c "$(curl -sSfL https://release.solana.com/${SOLANA_VERSION}/install)" - - export PATH="/home/travis/.local/share/solana/install/active_release/bin:$PATH" - - export NODE_PATH="/home/travis/.nvm/versions/node/${NODE_VERSION}/lib/node_modules/:${NODE_PATH}" - - yes | solana-keygen new - - cargo install --git https://github.com/project-serum/anchor anchor-cli --locked - -jobs: - include: - - <<: *defaults - name: Runs the tests - script: - - yarn - - yarn test - - cargo test --lib From f43c715539ff6dc0587a20ef99952847480a1a53 Mon Sep 17 00:00:00 2001 From: microwavedcola1 Date: Mon, 20 Dec 2021 11:07:45 +0100 Subject: [PATCH 2/3] remove redundant cmds Signed-off-by: microwavedcola1 --- .github/workflows/program.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/program.yml b/.github/workflows/program.yml index f2eb9f5..4d7779c 100644 --- a/.github/workflows/program.yml +++ b/.github/workflows/program.yml @@ -68,9 +68,5 @@ jobs: echo "Generating keypair..." solana-keygen new -o "$HOME/.config/solana/id.json" --no-passphrase --silent - - name: Run unit tests - run: cargo test --lib - - name: Build program - run: cargo build-bpf - name: Run tests run: cargo test-bpf From 1477c29a0f104ccf0409f535e70b1e2717048d96 Mon Sep 17 00:00:00 2001 From: microwavedcola1 Date: Mon, 20 Dec 2021 11:09:51 +0100 Subject: [PATCH 3/3] linter-fix Signed-off-by: microwavedcola1 --- .../src/instructions/configure_voting_mint.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/voter-stake-registry/src/instructions/configure_voting_mint.rs b/programs/voter-stake-registry/src/instructions/configure_voting_mint.rs index 1e556a3..828dec5 100644 --- a/programs/voter-stake-registry/src/instructions/configure_voting_mint.rs +++ b/programs/voter-stake-registry/src/instructions/configure_voting_mint.rs @@ -102,7 +102,7 @@ pub fn configure_voting_mint( deposit_scaled_factor, lockup_scaled_factor, lockup_saturation_secs, - grant_authority: grant_authority.unwrap_or(Pubkey::default()), + grant_authority: grant_authority.unwrap_or_default(), padding: [0; 31], };