Skip to content

Commit

Permalink
Refactor CI pipeline
Browse files Browse the repository at this point in the history
- Split tests to callable workflow to enable multi-release scheduled builds
- Automatic cancel of in-progress pull request builds on a new push

Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
  • Loading branch information
bestbeforetoday committed Jan 12, 2023
1 parent 9f2d573 commit 11561d8
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 36 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
30 changes: 2 additions & 28 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,6 @@ on:
schedule:
- cron: "5 0 * * *"

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

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
20 changes: 13 additions & 7 deletions .github/workflows/build.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
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:
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
2 changes: 1 addition & 1 deletion scripts/pull-fabric-images.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -e
set -euo pipefail

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

Expand Down

0 comments on commit 11561d8

Please sign in to comment.