Skip to content

Commit

Permalink
Port the publish workflow to GitHub Actions (#1384)
Browse files Browse the repository at this point in the history
* Port the publish workflow to GitHub Actions

Signed-off-by: CaptainIRS <[email protected]>

* Change dependency and remove Azure Pipelines

Signed-off-by: CaptainIRS <[email protected]>

* Move to using reusable workflows

Signed-off-by: CaptainIRS <[email protected]>

* Remove integration tests from CI for main branch

Signed-off-by: CaptainIRS <[email protected]>
  • Loading branch information
CaptainIRS authored Jun 22, 2022
1 parent ae23774 commit e7a5a17
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 71 deletions.
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
28 changes: 28 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
36 changes: 0 additions & 36 deletions azure-pipelines.yml

This file was deleted.

0 comments on commit e7a5a17

Please sign in to comment.