diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index dd0e125..fa52843 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,8 +10,8 @@ env: CARGO_TERM_COLOR: always jobs: - build: - name: Rust Tests + lint: + name: Lint runs-on: ubuntu-latest timeout-minutes: 30 steps: @@ -54,16 +54,51 @@ jobs: profile: minimal toolchain: nightly override: true - components: rustfmt, clippy - - - name: Build - run: cargo build --verbose + components: clippy - name: Check lint run: cargo clippy -- -D warnings - - name: Check formatting - run: cargo fmt -- --check + test: + name: Test + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Use Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + cache: "yarn" + cache-dependency-path: "yarn.lock" + + - name: Install dependencies 📦 + run: yarn install --frozen-lockfile + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Generate contract Rust bindings + run: forge bind -b src/bindings/ --module --overwrite + + - name: Cache Cargo registry + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Build + run: cargo build - name: Run tests - run: cargo test --verbose + run: cargo test