Skip to content

Commit

Permalink
Run scheduled builds using workflows from target branch
Browse files Browse the repository at this point in the history
Refactor the CI pipeline so that scheduled builds run tests for the release-2.2 branch using the callable workflow defined in that branch.

Automatically cancel redundant builds when a new change is pushed to a pull request.

Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
  • Loading branch information
bestbeforetoday committed Jan 12, 2023
1 parent 9f2d573 commit 2eaba32
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 38 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Pull request

on:
pull_request:
branches:
- main

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

jobs:
build:
uses: ./.github/workflows/test.yml
10 changes: 10 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Push

on:
push:
branches:
- main

jobs:
build:
uses: ./.github/workflows/test.yml
38 changes: 10 additions & 28 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,15 @@ name: Scheduled build
on:
schedule:
- cron: "5 0 * * *"

env:
FABRIC_VERSION: "2.2"
GOPATH: ${{ github.workspace }}/src/test/fixture
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
java-version:
- "8"
- "11"
- "17"
ref:
- main
- release-2.2
steps:
- uses: actions/checkout@v3
with:
ref: ${{ matrix.ref }}
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: temurin
cache: maven
- name: Integration tests
run: ./scripts/run-integration-tests.sh
main:
uses: ./.github/workflows/test.yml
release-2_2:
name: release-2.2
uses: hyperledger/fabric-sdk-java/.github/workflows/test.yml@release-2.2
with:
checkout-ref: release-2.2
22 changes: 14 additions & 8 deletions .github/workflows/build.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_call:
inputs:
fabric-version:
default: '2.2'
required: false
type: string
checkout-ref:
default: ''
required: false
type: string

env:
FABRIC_VERSION: "2.2"
FABRIC_VERSION: ${{ inputs.fabric-version }}
GOPATH: ${{ github.workspace }}/src/test/fixture

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand All @@ -24,6 +28,8 @@ jobs:
- "17"
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions scripts/pull-fabric-images.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash -e
set -euo pipefail

# FABRIC_VERSION is set in .github/workflows/build.yml
VERSION=${FABRIC_VERSION:-2.2}
# FABRIC_VERSION is overridden by CI pipeline
VERSION=${FABRIC_VERSION:-2.5}
STABLE_TAG=amd64-${VERSION}-stable

for image in peer orderer tools ccenv baseos javaenv nodeenv; do
Expand Down

0 comments on commit 2eaba32

Please sign in to comment.