-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(github): fix path filtering of required but skipped workflows
1. Migrated from the stock GitHub Actions yaml syntax to using this custom action[1] that allows us to skip the running of jobs based on path filtering. The difference compared to the old solution is that this one won't just skip the checks that are marked as required but it will pass them instead. 2. This is a suboptimal solution because we have to run each job so that the code can be checked out and then examined for changes. This uses resources that we should not have to expend, but currently there's no way to avoid this because of the way the GitHub handles required checks that are skipped (which cause a deadlock on the CI at the currently). 3. There is a relevant discussion thread about the problem here [2] which should be voted on heavily so that it gets the necessary attention from the product teams at GitHub. Quoting the relevant part of the GitHub documentation directly: > Handling skipped but required checks > Warning: If a workflow is skipped due to path filtering, branch > filtering or a commit message, then checks associated with that workflow > will remain in a "Pending" state. A pull request that requires those > checks to be successful will be blocked from merging. > > For this reason you should not use path or branch filtering to skip > workflow runs if the workflow is required. For more information, see > "Skipping workflow runs" and "Required workflows." > > If, however, a job within a workflow is skipped due to a conditional, > it will report its status as "Success". For more information, see > "Using conditions to control job execution." **Source** (link broken into multiple lines to avoid it being longer than 100 characters): https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/ collaborating-on-repositories-with-code-quality-features/ troubleshooting-required-status-checks#handling-skipped-but-required-checks [1] https://github.com/dorny/paths-filter [2] https://github.com/orgs/community/discussions/44490 Signed-off-by: Peter Somogyvari <[email protected]> Signed-off-by: Sandeep Nishad <[email protected]>
- Loading branch information
1 parent
1fb2551
commit 6465e93
Showing
11 changed files
with
665 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,20 +10,8 @@ on: | |
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- '.github/workflows/test_weaver-**' | ||
- 'weaver/**' | ||
- '!weaver/docs/**' | ||
- '!weaver/rfcs/**' | ||
- '!weaver/resources/**' | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- '.github/workflows/test_weaver-**' | ||
- 'weaver/**' | ||
- '!weaver/docs/**' | ||
- '!weaver/rfcs/**' | ||
- '!weaver/resources/**' | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
@@ -34,9 +22,24 @@ concurrency: | |
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
check_code_changed: | ||
outputs: | ||
status: ${{ steps.changes.outputs.weaver_code_changed }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- uses: dorny/[email protected] | ||
id: changes | ||
with: | ||
filters: | | ||
weaver_code_changed: | ||
- './weaver/**!(*.md|*.css|*.html|*.jpg|*.jpeg|*.png)' | ||
- '.github/workflows/test_weaver-asset-exchange-besu.yaml' | ||
asset-exchange-besu: | ||
if: ${{ false }} | ||
needs: check_code_changed | ||
if: ${{ false && needs.check_code_changed.outputs.status == 'true' }} | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
|
@@ -216,6 +219,8 @@ jobs: | |
working-directory: weaver/samples/besu/besu-cli | ||
|
||
asset-exchange-besu-local: | ||
needs: check_code_changed | ||
if: needs.check_code_changed.outputs.status == 'true' | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,20 +11,8 @@ on: | |
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- '.github/workflows/test_weaver-**' | ||
- 'weaver/**' | ||
- '!weaver/docs/**' | ||
- '!weaver/rfcs/**' | ||
- '!weaver/resources/**' | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- '.github/workflows/test_weaver-**' | ||
- 'weaver/**' | ||
- '!weaver/docs/**' | ||
- '!weaver/rfcs/**' | ||
- '!weaver/resources/**' | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
@@ -35,9 +23,24 @@ concurrency: | |
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
check_code_changed: | ||
outputs: | ||
status: ${{ steps.changes.outputs.weaver_code_changed }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- uses: dorny/[email protected] | ||
id: changes | ||
with: | ||
filters: | | ||
weaver_code_changed: | ||
- './weaver/**!(*.md|*.css|*.html|*.jpg|*.jpeg|*.png)' | ||
- '.github/workflows/test_weaver-asset-exchange-corda.yaml' | ||
asset-exchange-corda: | ||
if: ${{ false }} | ||
needs: check_code_changed | ||
if: ${{ false && needs.check_code_changed.outputs.status == 'true' }} | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
|
@@ -133,6 +136,8 @@ jobs: | |
working-directory: weaver/samples/corda/corda-simple-application | ||
|
||
asset-exchange-corda-local: | ||
needs: check_code_changed | ||
if: needs.check_code_changed.outputs.status == 'true' | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
|
@@ -227,7 +232,8 @@ jobs: | |
working-directory: weaver/samples/corda/corda-simple-application | ||
|
||
house-token-exchange-corda: | ||
if: ${{ false }} | ||
needs: check_code_changed | ||
if: ${{ false && needs.check_code_changed.outputs.status == 'true' }} | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
|
@@ -236,6 +242,14 @@ jobs: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/[email protected] | ||
|
||
- uses: dorny/[email protected] | ||
id: changes | ||
with: | ||
filters: | | ||
weaver_code_changed: | ||
- './weaver/**!(*.md|*.css|*.html|*.jpg|*.jpeg|*.png)' | ||
- '.github/workflows/test_weaver-asset-exchange-corda.yaml' | ||
- name: Set up JDK 8 | ||
uses: actions/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,20 +14,9 @@ on: | |
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- '.github/workflows/test_weaver-**' | ||
- 'weaver/**' | ||
- '!weaver/docs/**' | ||
- '!weaver/rfcs/**' | ||
- '!weaver/resources/**' | ||
|
||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- '.github/workflows/test_weaver-**' | ||
- 'weaver/**' | ||
- '!weaver/docs/**' | ||
- '!weaver/rfcs/**' | ||
- '!weaver/resources/**' | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
@@ -38,9 +27,24 @@ concurrency: | |
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
check_code_changed: | ||
outputs: | ||
status: ${{ steps.changes.outputs.weaver_code_changed }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- uses: dorny/[email protected] | ||
id: changes | ||
with: | ||
filters: | | ||
weaver_code_changed: | ||
- './weaver/**!(*.md|*.css|*.html|*.jpg|*.jpeg|*.png)' | ||
- '.github/workflows/test_weaver-asset-exchange-fabric.yaml' | ||
asset-exchange-fabric: | ||
if: ${{ false }} | ||
needs: check_code_changed | ||
if: ${{ false && needs.check_code_changed.outputs.status == 'true' }} | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
|
@@ -71,15 +75,18 @@ jobs: | |
sed -i "s/<personal-access-token>/${{ secrets.GITHUB_TOKEN }}/g" .npmrc | ||
cat .npmrc | ||
working-directory: weaver/samples/fabric/fabric-cli | ||
|
||
- name: Build Fabric CLI | ||
run: npm install | ||
working-directory: weaver/samples/fabric/fabric-cli | ||
|
||
- name: Setup Fabric CLI Config | ||
run: | | ||
echo ${GITHUB_WORKSPACE} | ||
cp config.template.json config.json | ||
sed -i "s#<PATH-TO-WEAVER>#${GITHUB_WORKSPACE}/weaver#g" config.json | ||
working-directory: weaver/samples/fabric/fabric-cli | ||
|
||
- name: Setup Fabric CLI ENV | ||
run: | | ||
echo ${GITHUB_WORKSPACE} | ||
|
@@ -114,6 +121,8 @@ jobs: | |
working-directory: weaver/samples/fabric/fabric-cli | ||
|
||
asset-exchange-fabric-local: | ||
needs: check_code_changed | ||
if: needs.check_code_changed.outputs.status == 'true' | ||
# if: ${{ false }} | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
Oops, something went wrong.