From e82a69c9cabb5cb6504a875c4d094c44ef77f36d Mon Sep 17 00:00:00 2001 From: Nugine Date: Fri, 13 Jun 2025 17:34:53 +0800 Subject: [PATCH] fix(ci): refactor ci check --- .github/actions/setup/action.yml | 7 +- .github/workflows/ci.yml | 114 ++++++++----------------------- 2 files changed, 33 insertions(+), 88 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 8c4399ac..a90ca472 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -13,9 +13,9 @@ inputs: description: "Cache key for shared cache" cache-save-if: required: true - default: true + default: ${{ github.ref == 'refs/heads/main' }} description: "Cache save condition" - run-os: + runs-on: required: true default: "ubuntu-latest" description: "Running system" @@ -24,7 +24,7 @@ runs: using: "composite" steps: - name: Install system dependencies - if: inputs.run-os == 'ubuntu-latest' + if: inputs.runs-on == 'ubuntu-latest' shell: bash run: | sudo apt update @@ -45,7 +45,6 @@ runs: - uses: Swatinem/rust-cache@v2 with: - cache-on-failure: true cache-all-crates: true shared-key: ${{ inputs.cache-shared-key }} save-if: ${{ inputs.cache-save-if }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44f6d75a..dbca6e90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,9 +11,6 @@ on: - cron: '0 0 * * 0' # at midnight of each sunday workflow_dispatch: -env: - CARGO_TERM_COLOR: always - jobs: skip-check: permissions: @@ -30,103 +27,52 @@ jobs: cancel_others: true paths_ignore: '["*.md"]' - # Quality checks for pull requests - pr-checks: - name: Pull Request Quality Checks - if: github.event_name == 'pull_request' + develop: + needs: skip-check + if: needs.skip-check.outputs.should_skip != 'true' runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup + + - name: Test + run: cargo test --all --exclude e2e_test + + - name: Format + run: cargo fmt --all --check + + - name: Lint + run: cargo clippy --all-targets --all-features -- -D warnings + + s3s-e2e: + name: E2E (s3s-e2e) + needs: skip-check + if: needs.skip-check.outputs.should_skip != 'true' + runs-on: ubuntu-latest + timeout-minutes: 30 steps: - uses: actions/checkout@v4.2.2 - uses: ./.github/actions/setup - # - name: Format Check - # run: cargo fmt --all --check - - - name: Lint Check - run: cargo check --all-targets - - - name: Clippy Check - run: cargo clippy --all-targets --all-features -- -D warnings - - - name: Unit Tests - run: cargo test --all --exclude e2e_test - - - name: Format Code - run: cargo fmt --all - - s3s-e2e: - name: E2E (s3s-e2e) - needs: - - skip-check - - develop - if: needs.skip-check.outputs.should_skip != 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.2.2 - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 + - name: Install s3s-e2e + uses: taiki-e/cache-cargo-install-action@v2 with: - cache-on-failure: true - cache-all-crates: true - - - name: Install system dependencies - run: | - sudo apt update - sudo apt install -y musl-tools build-essential lld libdbus-1-dev libwayland-dev libwebkit2gtk-4.1-dev libxdo-dev - - - name: Test - run: cargo test --all --exclude e2e_test + tool: s3s-e2e + git: https://github.com/Nugine/s3s.git + rev: b7714bfaa17ddfa9b23ea01774a1e7bbdbfc2ca3 - name: Build debug run: | touch rustfs/build.rs cargo build -p rustfs --bins - - name: Pack artifacts - run: | - mkdir -p ./target/artifacts - cp target/debug/rustfs ./target/artifacts/rustfs-debug - - - uses: actions/upload-artifact@v4 - with: - name: rustfs - path: ./target/artifacts/* - - - name: Install s3s-e2e - run: | - cargo install s3s-e2e --git https://github.com/Nugine/s3s.git - s3s-e2e --version - - - uses: actions/download-artifact@v4 - with: - name: rustfs - path: ./target/artifacts - - name: Run s3s-e2e - timeout-minutes: 10 run: | - ./scripts/e2e-run.sh ./target/artifacts/rustfs-debug /tmp/rustfs + s3s-e2e --version + ./scripts/e2e-run.sh ./target/debug/rustfs /tmp/rustfs - uses: actions/upload-artifact@v4 with: name: s3s-e2e.logs path: /tmp/rustfs.log - - - - develop: - needs: skip-check - if: needs.skip-check.outputs.should_skip != 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.2.2 - - uses: ./.github/actions/setup - - - name: Format - run: cargo fmt --all --check - - - name: Lint - run: cargo check --all-targets - - - name: Clippy - run: cargo clippy --all-targets --all-features -- -D warnings