fix(ci): refactor ci check

This commit is contained in:
Nugine
2025-06-13 17:34:53 +08:00
parent 8452c11e9a
commit e82a69c9ca
2 changed files with 33 additions and 88 deletions

View File

@@ -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 }}

View File

@@ -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