Skip to content

chore: refactor ensure checks to avoid code duplication #366

chore: refactor ensure checks to avoid code duplication

chore: refactor ensure checks to avoid code duplication #366

Workflow file for this run

name: PR Checks
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:
env:
NODE_VER: 18.x
jobs:
test:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v3
- name: Install & display rust toolchain
run: |
rustup show
rustup component add rust-src
- name: Check targets are installed correctly
run: rustup target list --installed
- name: Cache Crates
uses: actions/cache@v3
with:
path: ~/.cargo
key: ${{ runner.os }}-rust-${{ hashFiles('rust-toolchain.toml') }}
restore-keys: |
${{ runner.os }}-rust
- name: Check if cargo-contract exists
id: check-cargo-contract
continue-on-error: true
run: cargo contract --version
- name: Install cargo contract
if: ${{ steps.check-cargo-contract.outcome == 'failure' }}
run: |
cargo install cargo-dylint dylint-link
cargo install --force --locked cargo-contract
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VER }}
- name: yarn test
run: yarn && yarn test
lint-check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VER }}
- name: yarn lint
run: yarn && yarn lint
build-check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VER }}
- name: yarn build
run: yarn && yarn build