diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..9d6ebf9a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: CI +on: + push: + branches: + - '*' + pull_request: + branches: + - '*' +jobs: + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # cancel concurrent builds on the same branch + concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: false + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly-2022-04-24 + components: rustfmt, llvm-tools-preview + target: wasm32-unknown-unknown + default: true + + - name: Cache restore + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Clean + if: ${{ github.event.inputs.CLEAN_BUILD == 'true' }} + run: cargo clean + + - name: Check format + run: cargo fmt --all -- --check + + - name: Check release + run: cargo check --release + + - name: Build + run: cargo build --release + + - name: Test + run: cargo test --release + + - name: Benchmarking + run: cargo test --features runtime-benchmarks