Merge pull request #77 from rustfs/nugine/ci-accel

ci: use skip-check and rust-cache
This commit is contained in:
weisd
2024-10-12 00:52:47 +08:00
committed by GitHub
2 changed files with 61 additions and 30 deletions
+28 -14
View File
@@ -1,6 +1,7 @@
name: e2e name: E2E
on: on:
workflow_dispatch:
push: push:
pull_request: pull_request:
branches: [ "main" ] branches: [ "main" ]
@@ -9,14 +10,34 @@ env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
jobs: jobs:
build: skip-check:
permissions:
actions: write
contents: read
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'same_content_newer'
cancel_others: true
paths_ignore: '["*.md"]'
e2e:
# See this url if required matrix jobs are hanging
# https://github.com/fkirc/skip-duplicate-actions#how-to-use-skip-check-with-required-matrix-jobs
needs: skip-check
if: needs.skip-check.outputs.should_skip != 'true'
timeout-minutes: 30 timeout-minutes: 30
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
rust: rust:
- stable - stable
- nightly # - nightly
steps: steps:
- name: cache protoc bin - name: cache protoc bin
@@ -58,14 +79,15 @@ jobs:
chmod +x /usr/local/bin/flatc chmod +x /usr/local/bin/flatc
rm -rf Linux.flatc.binary.g++-13.zip rm -rf Linux.flatc.binary.g++-13.zip
- uses: actions/checkout@v4
- name: toolchain - name: toolchain
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@master
with: with:
toolchain: ${{ matrix.rust }} toolchain: ${{ matrix.rust }}
# components: rustfmt, clippy # components: rustfmt, clippy
- name: checkout - uses: Swatinem/rust-cache@v2
uses: actions/checkout@v4
- name: run fs start - name: run fs start
working-directory: . working-directory: .
@@ -79,11 +101,3 @@ jobs:
- name: e2e test - name: e2e test
run: cargo test -p e2e_test --lib run: cargo test -p e2e_test --lib
- name: cache cargo
uses: actions/cache@v4
env:
cache-name: cache-cargo
with:
path: ~/.cargo
key: ${{ runner.os }}-build-${{ env.cache-name }}-v0.0.1
+33 -16
View File
@@ -9,7 +9,27 @@ env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
jobs: jobs:
skip-check:
permissions:
actions: write
contents: read
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'same_content_newer'
cancel_others: true
paths_ignore: '["*.md"]'
build: build:
# See this url if required matrix jobs are hanging
# https://github.com/fkirc/skip-duplicate-actions#how-to-use-skip-check-with-required-matrix-jobs
needs: skip-check
if: needs.skip-check.outputs.should_skip != 'true'
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
@@ -57,24 +77,21 @@ jobs:
chmod +x /usr/local/bin/flatc chmod +x /usr/local/bin/flatc
rm -rf Linux.flatc.binary.g++-13.zip rm -rf Linux.flatc.binary.g++-13.zip
- name: toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
# components: rustfmt, clippy
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: cargo build - name: toolchain
run: cargo build uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: cargo fmt
run: cargo fmt --all --check
- name: cargo clippy
run: cargo clippy -- -D warnings
- name: cargo test - name: cargo test
run: cargo test --all --exclude e2e_test run: cargo test --all --exclude e2e_test
- name: cache cargo
uses: actions/cache@v4
env:
cache-name: cache-cargo
with:
path: ~/.cargo
key: ${{ runner.os }}-build-${{ env.cache-name }}-v0.0.1