github instead of travis for ci tests

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2021-12-20 11:04:40 +01:00
parent 0e45b0d8a4
commit 4568430232
2 changed files with 76 additions and 27 deletions

76
.github/workflows/program.yml vendored Normal file
View File

@ -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

View File

@ -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