Skip to content

Commit

Permalink
chore(CI): split cargo clippy and test into 2 jobs (#1100)
Browse files Browse the repository at this point in the history
* chore(CI): split cargo clippy and test into 2 jobs
Fix error: No space left on device

* chore(CI): fix godwoken-tests.yml
MANUAL_BUILD_POLYJUICE env is duplicated.
  • Loading branch information
Flouse authored Oct 20, 2023
1 parent 972f340 commit 41b25f7
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 51 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/godwoken-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ jobs:
MANUAL_BUILD_WEB3_INDEXER=true
WEB3_GIT_URL="https://github.com/${{ github.repository }}"
WEB3_GIT_CHECKOUT=${{ github.ref }}
MANUAL_BUILD_POLYJUICE=true
POLYJUICE_GIT_URL=https://github.com/${{ github.repository }}
POLYJUICE_GIT_CHECKOUT=${{ github.ref }}
GODWOKEN_KICKER_REPO=godwokenrises/godwoken-kicker
GODWOKEN_KICKER_REF=develop
DOCKER_MANUAL_BUILD_IMAGE=retricsu/godwoken-manual-build:node18
113 changes: 69 additions & 44 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,85 @@ name: Build and Test
on: [push, pull_request]

jobs:
rust-clippy-and-test:
runs-on: ubuntu-latest
rustfmt-and-clippy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust components
run: rustup component add rustfmt && rustup component add clippy
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ runner.arch }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-cargo-test
${{ runner.os }}-${{ runner.arch }}-cargo
- name: Install moleculec v0.7.2
run: CARGO_TARGET_DIR=target/ cargo install moleculec --version 0.7.2
- name: Check format
run: cargo fmt -- --check
- name: Cargo clippy check
env:
RUSTFLAGS: -D warnings
run: cargo clippy --tests --all-features --all-targets
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache of Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ runner.arch }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-cargo-clippy
- name: Install Rust components
run: |
cargo fmt --version || rustup component add rustfmt
cargo clippy --version || rustup component add clippy
- name: Check format
run: cargo fmt --all -- --check --verbose
- name: Cargo clippy check
env:
RUSTFLAGS: -D warnings
run: cargo clippy --tests --all-features --all-targets


rust-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache of Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ runner.arch }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-cargo-test
- name: Cache of component.gwos-evm
id: godwoken-polyjuice-cache
uses: actions/cache@v3
with:
path: |
gwos-evm/build/*generator*
gwos-evm/build/*validator*
key: component.gwos-evm-${{ hashFiles('gwos-evm/**') }}
- name: Build godwoken-polyjuice
if: steps.godwoken-polyjuice-cache.outputs.cache-hit != 'true'
working-directory: gwos-evm
run: |
test "$(moleculec --version)" = "Moleculec 0.7.2" \
|| cargo install moleculec --version 0.7.2 --force
git submodule update --init --recursive --depth=1
make all-via-docker
- name: Cache of component.gwos-evm
id: godwoken-polyjuice-cache
uses: actions/cache@v3
with:
path: |
gwos-evm/build/*generator*
gwos-evm/build/*validator*
key: component.gwos-evm-${{ hashFiles('gwos-evm/**') }}
- name: Build godwoken-polyjuice
if: steps.godwoken-polyjuice-cache.outputs.cache-hit != 'true'
working-directory: gwos-evm
run: |
git submodule update --init --recursive --depth=1
make all-via-docker
- name: Test all targets
run: RUST_BACKTRACE=1 cargo test --all-targets

- name: Tests all targets
run: RUST_BACKTRACE=1 cargo test --all-targets

test-generate-example-config:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache of Cargo
id: cargo-test-cache
uses: actions/cache@v3
with:
path: |
Expand All @@ -67,6 +93,5 @@ jobs:
key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-cargo-build
${{ runner.os }}-${{ runner.arch }}-cargo
- name: Test TOML serialization
run: cargo run --bin godwoken -- generate-example-config -o test.toml
12 changes: 8 additions & 4 deletions .github/workflows/web3-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ jobs:
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-web3-indexer-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-web3-indexer
- name: Build
run: cargo build --verbose
- name: Check format
Expand Down

0 comments on commit 41b25f7

Please sign in to comment.