diff --git a/.github/workflows/tests.yml b/.github/workflows/integration-tests.yml similarity index 72% rename from .github/workflows/tests.yml rename to .github/workflows/integration-tests.yml index f53ade037..d2d613d42 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/integration-tests.yml @@ -1,39 +1,12 @@ -name: Tests +name: Integration Tests on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] + workflow_call: jobs: - unit-tests: - name: Unit Tests - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [14.x, 16.x] - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - name: Check correct usage of Caliper package names - run: ./scripts/check-package-names.sh - - name: Install project dependencies - run: npm install - - name: Bootstrap lerna - run: npm run bootstrap - - name: Check the version consistency of subpackages - run: ./packages/caliper-publish/publish.js version check - - name: Run unit tests - run: npm test - fabric-integration-tests: name: Fabric Integration Tests runs-on: ubuntu-latest - needs: unit-tests strategy: matrix: node-version: [14.x, 16.x] @@ -51,7 +24,6 @@ jobs: ethereum-integration-tests: name: Ethereum Integration Tests runs-on: ubuntu-latest - needs: unit-tests strategy: matrix: node-version: [14.x, 16.x] @@ -69,7 +41,6 @@ jobs: besu-integration-tests: name: Besu Integration Tests runs-on: ubuntu-latest - needs: unit-tests strategy: matrix: node-version: [14.x, 16.x] @@ -87,7 +58,6 @@ jobs: fisco-bcos-integration-tests: name: FISCO BCOS Integration Tests runs-on: ubuntu-latest - needs: unit-tests strategy: matrix: node-version: [14.x, 16.x] @@ -105,7 +75,6 @@ jobs: generator-integration-tests: name: Generator Integration Tests runs-on: ubuntu-latest - needs: unit-tests strategy: matrix: node-version: [14.x, 16.x] diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..890936443 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,12 @@ +name: CI (Publish) + +on: + push: + branches: [ "main" ] + +jobs: + unit-tests: + uses: ./.github/workflows/unit-tests.yml + publish-caliper: + uses: ./.github/workflows/publish.yml + needs: unit-tests diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 000000000..b11b5ed41 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,12 @@ +name: CI (PR) + +on: + pull_request: + branches: [ "main" ] + +jobs: + unit-tests: + uses: ./.github/workflows/unit-tests.yml + integration-tests: + uses: ./.github/workflows/integration-tests.yml + needs: unit-tests diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..957d47b9f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,21 @@ +name: Publish + +on: + workflow_call: + +jobs: + publish-caliper: + name: Publish Caliper + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js 16.x + uses: actions/setup-node@v3 + with: + node-version: 16.x + - name: Publish Caliper + run: .build/publish-caliper.sh + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKER_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 000000000..33b64d419 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,28 @@ +name: Unit Tests + +on: + workflow_call: + +jobs: + unit-tests: + name: Unit Tests + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x, 16.x] + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Check correct usage of Caliper package names + run: ./scripts/check-package-names.sh + - name: Install project dependencies + run: npm install + - name: Bootstrap lerna + run: npm run bootstrap + - name: Check the version consistency of subpackages + run: ./packages/caliper-publish/publish.js version check + - name: Run unit tests + run: npm test diff --git a/README.md b/README.md index 382718785..c3a963340 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # ![Hyperledger Caliper](https://wiki.hyperledger.org/download/attachments/2392434/Hyperledger_Caliper_Logo_Color.svg?version=1&modificationDate=1548883186000&api=v2) -[![Build Status](https://dev.azure.com/Hyperledger/Caliper/_apis/build/status/Caliper?branchName=main)](https://dev.azure.com/Hyperledger/Caliper/_build/latest?definitionId=33&branchName=main) -[![Tests](https://github.com/hyperledger/caliper/actions/workflows/tests.yml/badge.svg)](https://github.com/hyperledger/caliper/actions/workflows/tests.yml) +[![CI](https://github.com/hyperledger/caliper/actions/workflows/main.yml/badge.svg)](https://github.com/hyperledger/caliper/actions/workflows/main.yml) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2381/badge)](https://bestpractices.coreinfrastructure.org/projects/2381) [![license](https://img.shields.io/badge/license-Apache%202.0-blue)](https://github.com/hyperledger/caliper/blob/main/LICENSE) [![node (scoped)](https://img.shields.io/node/v/@hyperledger/caliper-cli)](https://www.npmjs.com/package/@hyperledger/caliper-cli) diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 3c288f1d6..000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,36 +0,0 @@ -trigger: - branches: - include: - - main - -pr: - branches: - include: - - main - -pool: - vmImage: "ubuntu-latest" - -variables: - - group: credentials - - name: NODEVER - value: 14.x - -stages: - - stage: Publish - displayName: Publish Caliper - condition: eq(variables['Build.Reason'], 'IndividualCI') - jobs: - - job: PublishCaliper - displayName: "Publish Caliper to NPM and DockerHub" - steps: - - task: NodeTool@0 - inputs: - versionSpec: "$(NODEVER)" - displayName: "Install Node.js" - - script: .build/publish-caliper.sh - displayName: Publish Caliper - env: - NPM_TOKEN: "$(npm)" - DOCKER_USER: "$(DockerHub-Username)" - DOCKER_TOKEN: "$(DockerHub-Password)"