diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57952707..88b2dbf8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,42 +4,17 @@ on: branches: - main pull_request: + workflow_call: + workflow_dispatch: jobs: - check_commit: - name: Check Commit Message - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - # A PR should not contain too many commits - fetch-depth: 10 - - name: Validate commit messages - run: | - git show-ref - curl -sSfL https://github.com/convco/convco/releases/latest/download/convco-ubuntu.zip | zcat > convco - chmod +x convco - ./convco check ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} - rm convco - - check_fmt_clippy: - name: Check Format - needs: check_commit - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - - - name: cargo-fmt - run: cargo fmt --all --check - - #- name: clippy - # run: cargo clippy --all-features -- -D warnings + pr_check: + name: pr-check + uses: ./.github/workflows/pull-request.yml linux: name: linux - needs: check_commit + needs: pr-check runs-on: ubuntu-latest strategy: #fail-fast: true @@ -86,7 +61,7 @@ jobs: windows: name: windows - needs: check_commit + needs: pr-check runs-on: windows-latest strategy: matrix: @@ -114,7 +89,7 @@ jobs: macos: name: macos - needs: check_commit + needs: pr-check runs-on: macos-latest strategy: matrix: diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 00000000..76b510a6 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,36 @@ +name: Pull request +# This workflow is triggered on pushes to the repository. +on: [ pull_request ] + +jobs: + check: + name: Check Commit Message + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + # A PR should not contain too many commits + fetch-depth: 10 + - name: Validate commit messages + run: | + git show-ref + curl -sSfL https://github.com/convco/convco/releases/latest/download/convco-ubuntu.zip | zcat > convco + chmod +x convco + ./convco check ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} + rm convco + + check_fmt_clippy: + name: Check Format + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + + - name: cargo-fmt + run: cargo fmt --all --check + + #- name: clippy + # run: cargo clippy --all-features -- -D warnings +