diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 000000000..0f54e688f --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -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 diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 000000000..e24824c1d --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,10 @@ +name: Push + +on: + push: + branches: + - main + +jobs: + build: + uses: ./.github/workflows/test.yml diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml index e9308be6a..b4a845a82 100644 --- a/.github/workflows/schedule.yml +++ b/.github/workflows/schedule.yml @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/test.yml similarity index 62% rename from .github/workflows/build.yml rename to .github/workflows/test.yml index 2c676ecf3..cd7b5a8c9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/test.yml @@ -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: @@ -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: diff --git a/scripts/pull-fabric-images.sh b/scripts/pull-fabric-images.sh index ab8253ca4..5b92d015a 100755 --- a/scripts/pull-fabric-images.sh +++ b/scripts/pull-fabric-images.sh @@ -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