diff --git a/.github/workflows/program.yml b/.github/workflows/program.yml new file mode 100644 index 0000000..4d7779c --- /dev/null +++ b/.github/workflows/program.yml @@ -0,0 +1,72 @@ +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 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 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], };