Skip to content

Commit

Permalink
refactor(ci/github): run weaver tests on schedule, re-use workflows
Browse files Browse the repository at this point in the history
Primary change:

Creates a central workflow to
run all 13 weaver test workflows from either a
push, a pull request, a github command,
or a schedule.

Passes a 'run_all' boolean to sub-workflows
to specify if all tests should be run, not
just those with changes.

Secondary changes:
- update concurrency groups to allow triggering
  from central workflow
- remove ability to run the 13 workflows
  individually to declutter ci menu

check whether RUN_ALL can be calculated in the environment instead of as a job

rename weaver test file

update actionlint to latest

Depends on #3446

Signed-off-by: Jennifer Bell <jenniferlianne@gmail.com>
  • Loading branch information
Jennifer Bell authored and sandeepnRES committed Aug 7, 2024
1 parent aadaca3 commit e8763fd
Show file tree
Hide file tree
Showing 13 changed files with 174 additions and 105 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/ci_weaver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Weaver_CI

# Controls when the workflow will run
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
# run at 1am the first day of every month
- cron: "0 1 1 * *"

env:
RUN_ALL: "${{github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}"

jobs:

fabric-fabric-satp:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-fabric-fabric-satp.yaml
asset-exchange-corda:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-asset-exchange-corda.yaml
asset-transfer:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-asset-transfer.yaml
relay:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-relay.yaml
corda-interop-app:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-corda-interop-app.yaml
pre-release:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-pre-release.yaml
asset-exchange-fabric:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-asset-exchange-fabric.yaml
data-sharing:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-data-sharing.yaml
node-pkgs:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-node-pkgs.yaml
docker-build:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-docker-build.yaml
asset-exchange-besu:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-asset-exchange-besu.yaml
go:
with:
run_all: $RUN_ALL
uses: ./.github/workflows/test_weaver-go.yaml

15 changes: 6 additions & 9 deletions .github/workflows/test_weaver-asset-exchange-besu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@ env:

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
workflow_call:
inputs:
run_all:
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: asset-exchange-besu-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/test_weaver-asset-exchange-corda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ name: Test Asset Exchange Corda
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
workflow_call:
inputs:
run_all:
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: asset-exchange-corda-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
Expand Down Expand Up @@ -137,7 +135,7 @@ jobs:

asset-exchange-corda-local:
needs: check_code_changed
if: needs.check_code_changed.outputs.status == 'true'
if: inputs.run_all == 'true' || needs.check_code_changed.outputs.status == 'true'
# The type of runner that the job will run on
runs-on: ubuntu-22.04

Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/test_weaver-asset-exchange-fabric.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,15 @@ env:

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]

pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
workflow_call:
inputs:
run_all:
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: asset-exchange-fabric-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
Expand Down Expand Up @@ -122,7 +119,7 @@ jobs:

asset-exchange-fabric-local:
needs: check_code_changed
if: needs.check_code_changed.outputs.status == 'true'
if: ${{ inputs.run_all == 'true' || needs.check_code_changed.outputs.status == 'true' }}
# if: ${{ false }}
# The type of runner that the job will run on
runs-on: ubuntu-22.04
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/test_weaver-asset-transfer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ env:
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
workflow_call:
inputs:
run_all:
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: asset-transfer-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
Expand Down Expand Up @@ -687,7 +685,7 @@ jobs:

asset-transfer-local:
needs: check_code_changed
if: needs.check_code_changed.outputs.status == 'true'
if: inputs.run_all == 'true' || needs.check_code_changed.outputs.status == 'true'
# if: ${{ false }}
# The type of runner that the job will run on
runs-on: ubuntu-22.04
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/test_weaver-corda-interop-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
name: Unit Test Corda Interop App

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_call:
inputs:
run_all:
required: true
type: string


concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: corda-interop-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
Expand All @@ -36,7 +38,7 @@ jobs:
unit_test_interop_cordapp:
needs: check_code_changed
if: needs.check_code_changed.outputs.interop_cordapp_changed == 'true'
if: inputs.run_all == 'true' || needs.check_code_changed.outputs.interop_cordapp_changed == 'true'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4.1.1
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/test_weaver-data-sharing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@ env:

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_call:
inputs:
run_all:
required: true
type: string

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: data-sharing-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
Expand Down Expand Up @@ -410,7 +408,7 @@ jobs:

data-sharing-docker-local:
needs: check_code_changed
if: needs.check_code_changed.outputs.status == 'true'
if: inputs.run_all == 'true' || needs.check_code_changed.outputs.status == 'true'
# if: ${{ false }}
# The type of runner that the job will run on
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -835,7 +833,7 @@ jobs:

data-sharing-local:
needs: check_code_changed
if: needs.check_code_changed.outputs.status == 'true'
if: inputs.run_all == 'true' || needs.check_code_changed.outputs.status == 'true'
# if: ${{ false }}
# The type of runner that the job will run on
runs-on: ubuntu-22.04
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/test_weaver-docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ env:
NODEJS_VERSION: v18.18.2

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_call:
inputs:
run_all:
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: docker-build-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -61,7 +62,7 @@ jobs:
build_docker_relay:
needs: check_code_changed
if: needs.check_code_changed.outputs.relay_changed == 'true'
if: inputs.run_all == 'true' || needs.check_code_changed.outputs.relay_changed == 'true'
# if: ${{ false }}
runs-on: ubuntu-22.04
steps:
Expand All @@ -74,7 +75,7 @@ jobs:

build_docker_fabric_driver_local:
needs: check_code_changed
if: needs.check_code_changed.outputs.fabric_driver_changed == 'true'
if: inputs.run_all == 'true' || needs.check_code_changed.outputs.fabric_driver_changed == 'true'
# if: ${{ false }}
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -126,7 +127,7 @@ jobs:

build_docker_corda_driver_local:
needs: check_code_changed
if: needs.check_code_changed.outputs.corda_driver_changed == 'true'
if: inputs.run_all == 'true' || needs.check_code_changed.outputs.corda_driver_changed == 'true'
runs-on: ubuntu-22.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand Down Expand Up @@ -186,7 +187,7 @@ jobs:

build_docker_iin_agent_local:
needs: check_code_changed
if: needs.check_code_changed.outputs.iin_agent_changed == 'true'
if: inputs.run_all == 'true' || needs.check_code_changed.outputs.iin_agent_changed == 'true'
runs-on: ubuntu-22.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/test_weaver-fabric-fabric-satp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ name: Secure Test Asset Transfer
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
workflow_call:
inputs:
run_all:
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: fabric-satp-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
Expand Down
Loading

0 comments on commit e8763fd

Please sign in to comment.