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 5d9f19e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 32 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/actions/ext-patch/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Checkout repo and patch dependencies

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

runs:
using: "composite"
steps:
- name: Install patch tool
if: inputs.package != ''
shell: bash
run: cargo install dependencies-patch
- name: Patch for the commit to be tested
if: inputs.package != ''
shell: bash
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 5d9f19e

Please sign in to comment.