Skip to content

Commit

Permalink
chore: add new CI pipeline for release automation (#2011)
Browse files Browse the repository at this point in the history
* chore: update dependabot configuration

Signed-off-by: Nathan Klick <[email protected]>

* feat: add a new CI pipeline to handle publishing releases when tagging

Signed-off-by: Nathan Klick <[email protected]>

* chore: intentionally break the new CI pipeline

Signed-off-by: Nathan Klick <[email protected]>

* chore: restore the new CI pipeline to a working state

Signed-off-by: Nathan Klick <[email protected]>

* fix: ensure Git history is retrieved when calculating the tag info

Signed-off-by: Nathan Klick <[email protected]>

* fix: better tag name detection

Signed-off-by: Nathan Klick <[email protected]>

* fix: correct bash code typo

Signed-off-by: Nathan Klick <[email protected]>

* chore: update deprecated set-output clause

Signed-off-by: Nathan Klick <[email protected]>

* fix: resolve issue with passing arguments via CLI_ARGS

Signed-off-by: Nathan Klick <[email protected]>

* chore: fix issues preventing task publish from working

Signed-off-by: Nathan Klick <[email protected]>

* chore: use non-deprecated eslint node plugin

Signed-off-by: Nathan Klick <[email protected]>

* chore: normalize and update the build workflow to run on self-hosted runners

Signed-off-by: Nathan Klick <[email protected]>

* chore: enable verbose build

Signed-off-by: Nathan Klick <[email protected]>

* chore: temporarily remove stdout/stderr redirection

Signed-off-by: Nathan Klick <[email protected]>

* fix: resolve breakage caused by .npmrc variable

Signed-off-by: Nathan Klick <[email protected]>

* chore: additional workflow enhancements

Signed-off-by: Nathan Klick <[email protected]>

* chore: add continue on error temporarily to troubleshoot workflow

Signed-off-by: Nathan Klick <[email protected]>

* chore: normalize common JS workflow

Signed-off-by: Nathan Klick <[email protected]>

* chore: fixes publish

Signed-off-by: Nathan Klick <[email protected]>

* chore: switch to using npx instead of relative paths

Signed-off-by: Nathan Klick <[email protected]>

* chore: ensure playwright dependencies are installed

Signed-off-by: Nathan Klick <[email protected]>

* chore: resolve failures and improve naming

Signed-off-by: Nathan Klick <[email protected]>

* chore: standardize remaining workflows

Signed-off-by: Nathan Klick <[email protected]>

* chore: enable cache support

Signed-off-by: Nathan Klick <[email protected]>

* chore: add support for creating the Github release

Signed-off-by: Nathan Klick <[email protected]>

---------

Signed-off-by: Nathan Klick <[email protected]>
  • Loading branch information
nathanklick authored Nov 6, 2023
1 parent 4ecdcfd commit cc49d13
Show file tree
Hide file tree
Showing 27 changed files with 950 additions and 744 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
"plugin:jsdoc/recommended",
"plugin:import/errors",
"plugin:import/typescript",
"plugin:node/recommended",
"plugin:n/recommended",
"plugin:compat/recommended"
],
parser: "@typescript-eslint/parser",
Expand All @@ -31,9 +31,10 @@ module.exports = {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"no-irregular-whitespace": "off",
"no-process-exit": "off",

// allow import syntax as we compile that away with babel for node
"node/no-unsupported-features/es-syntax": [
"n/no-unsupported-features/es-syntax": [
"error",
{
ignores: ["dynamicImport", "modules"],
Expand Down
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
- package-ecosystem: npm
directory: "/"
schedule:
Expand Down
258 changes: 135 additions & 123 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,127 +1,139 @@
name: Build & Test

on:
push:
branches:
- main
- develop
- release/*
- integration-test-workflow
pull_request:
branches:
- main
- develop
- release/*

env:
PNPM_HOME: /home/runner/work/hedera-sdk-js
push:
branches:
- main
- develop
- release/*
- integration-test-workflow
pull_request:
branches:
- main
- develop
- release/*

defaults:
run:
shell: bash

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: ["16", "18"]

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.7.0

- name: Cache pnpm modules
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- uses: pnpm/[email protected]
with:
version: 7.6.0

- name: Build @hashgraph/sdk
run: task build

test:
runs-on: ubuntu-latest
strategy:
matrix:
node: ["16"]

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.7.0

- name: "Create env file"
run: |
touch .env
echo OPERATOR_KEY="302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137" >> .env
echo OPERATOR_ID="0.0.2" >> .env
echo HEDERA_NETWORK="local-node" >> .env
cat .env
- name: Cache pnpm modules
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- uses: pnpm/[email protected]
with:
version: 7.6.0

- name: Build @hashgraph/sdk
run: task build

- name: Start the local node
run: npx @hashgraph/hedera-local start -d --network local

- name: Run Hedera SDK Integration Tests Codecov
run: task test:integration:codecov

- name: Stop the local node
run: npx @hashgraph/hedera-local stop

- name: Build @hashgraph/cryptography
working-directory: packages/cryptography
run: task build

- name: Uint Test @hashgraph/cryptography
working-directory: packages/cryptography
run: task test:unit

- name: Codecov @hashgraph/cryptography
working-directory: packages/cryptography
run: task test:unit:codecov

- name: Unit Test @hashgraph/sdk
run: task test:unit

- name: Codecov @hashgraph/sdk
run: task test:unit:codecov
build:
name: Build using Node ${{ matrix.node }}
runs-on: [self-hosted, Linux, medium, ephemeral]
strategy:
matrix:
node: [ "16", "18" ]

steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: true

- name: Install Task
uses: arduino/setup-task@e26d8975574116b0097a1161e0fe16ba75d84c1c # v1.0.3
with:
version: 3.7.0

- name: Install PNPM
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
with:
version: 8.10.0

- name: Setup Node
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: ${{ matrix.node }}
cache: pnpm

- name: Build @hashgraph/sdk
run: task -v build

test:
name: Test using Node ${{ matrix.node }}
runs-on: [self-hosted, Linux, large, ephemeral]
strategy:
matrix:
node: [ "16" ]

steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive

- name: Install Task
uses: arduino/setup-task@e26d8975574116b0097a1161e0fe16ba75d84c1c # v1.0.3
with:
version: 3.7.0

- name: "Create env file"
run: |
touch .env
echo OPERATOR_KEY="302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137" >> .env
echo OPERATOR_ID="0.0.2" >> .env
echo HEDERA_NETWORK="local-node" >> .env
cat .env
- name: Install PNPM
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
with:
version: 8.10.0

- name: Setup Node
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: ${{ matrix.node }}
cache: pnpm

- name: Build @hashgraph/sdk
id: build-sdk
run: task build

- name: Install Playwright Dependencies
id: playwright-deps
if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }}
run: sudo npx playwright install-deps

- name: Start the local node
id: start-local-node
if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }}
run: |
npx @hashgraph/hedera-local start -d --network local
# Wait for the network to fully start
sleep 30
- name: Run Hedera SDK Integration Tests Codecov
if: ${{ steps.build-sdk.conclusion == 'success' && steps.start-local-node.conclusion == 'success' && !cancelled() && always() }}
run: task test:integration:codecov

- name: Stop the local node
id: stop-local-node
if: ${{ steps.start-local-node.conclusion == 'success' && !cancelled() && always() }}
run: npx @hashgraph/hedera-local stop

- name: Build @hashgraph/cryptography
working-directory: packages/cryptography
if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }}
run: task build

- name: Unit Test @hashgraph/cryptography
working-directory: packages/cryptography
if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }}
run: task test:unit

- name: Codecov @hashgraph/cryptography
working-directory: packages/cryptography
if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }}
run: task test:unit:codecov

- name: Unit Test @hashgraph/sdk
if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && steps.playwright-deps.conclusion == 'success' && !cancelled() && always() }}
run: task test:unit

- name: Codecov @hashgraph/sdk
if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }}
run: task test:unit:codecov
Loading

0 comments on commit cc49d13

Please sign in to comment.