Skip to content

Commit

Permalink
[CI] Abstarct an independent action to checkout and patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Azure-stars committed Oct 19, 2024
1 parent 3ae4e1e commit d147637
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 32 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/actions/ext-patch/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Checkout repo and patch dependencies

inputs:
package:
description: 'The package that triggers the external test'
required: true
type: string

runs:
using: "composite"
if: ${{ inputs.package != '' }}
steps:
- name: Install patch tool
run: cargo install dependencies-patch
- name: Patch for the commit to be tested
run: dependencies-patch -c . \
-n ${{ inputs.package }} \
-t git --git-repo ${{ github.repository }} \
--commit ${{ github.sha }}
22 changes: 6 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,9 @@ jobs:
with:
repository: ${{ env.prj-repo }}
ref: ${{ inputs.ref }}
- name: Patch for the commit to be tested
if: inputs.package != ''
run: |
cargo install dependencies-patch
dependencies-patch -c . \
-n ${{ inputs.package }} \
-t git --git-repo ${{ github.repository }} \
--commit ${{ github.sha }}
- uses: ./.github/workflows/actions/ext-patch
with:
package: ${{ inputs.package }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-toolchain }}
Expand Down Expand Up @@ -84,14 +79,9 @@ jobs:
with:
repository: ${{ env.prj-repo }}
ref: ${{ inputs.ref }}
- name: Patch for the commit to be tested
if: inputs.package != ''
run: |
cargo install dependencies-patch
dependencies-patch -c . \
-n ${{ inputs.package }} \
-t git --git-repo ${{ github.repository }} \
--commit ${{ github.sha }}
- uses: ./.github/workflows/actions/ext-patch
with:
package: ${{ inputs.package }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-toolchain }}
Expand Down
22 changes: 6 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,9 @@ jobs:
with:
repository: ${{ env.prj-repo }}
ref: ${{ inputs.ref }}
- name: Patch for the commit to be tested
if: inputs.package != ''
run: |
cargo install dependencies-patch
dependencies-patch -c . \
-n ${{ inputs.package }} \
-t git --git-repo ${{ github.repository }} \
--commit ${{ github.sha }}
- uses: ./.github/workflows/actions/ext-patch
with:
package: ${{ inputs.package }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust-toolchain }}
Expand All @@ -62,14 +57,9 @@ jobs:
with:
repository: ${{ env.prj-repo }}
ref: ${{ inputs.ref }}
- name: Patch for the commit to be tested
if: inputs.package != ''
run: |
cargo install dependencies-patch
dependencies-patch -c . \
-n ${{ inputs.package }} \
-t git --git-repo ${{ github.repository }} \
--commit ${{ github.sha }}
- uses: ./.github/workflows/actions/ext-patch
with:
package: ${{ inputs.package }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust-toolchain }}
Expand Down

0 comments on commit d147637

Please sign in to comment.