Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add new CI pipeline for release automation #2011

Merged
merged 25 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f50ab3b
chore: update dependabot configuration
nathanklick Oct 31, 2023
1a946b2
feat: add a new CI pipeline to handle publishing releases when tagging
nathanklick Oct 31, 2023
9bd32bc
chore: intentionally break the new CI pipeline
nathanklick Oct 31, 2023
d4055bc
chore: restore the new CI pipeline to a working state
nathanklick Oct 31, 2023
31deb27
fix: ensure Git history is retrieved when calculating the tag info
nathanklick Oct 31, 2023
3837927
fix: better tag name detection
nathanklick Oct 31, 2023
6095aca
fix: correct bash code typo
nathanklick Oct 31, 2023
1797522
chore: update deprecated set-output clause
nathanklick Oct 31, 2023
bd2f09c
fix: resolve issue with passing arguments via CLI_ARGS
nathanklick Oct 31, 2023
792541e
chore: fix issues preventing task publish from working
nathanklick Oct 31, 2023
8d66f72
chore: use non-deprecated eslint node plugin
nathanklick Nov 1, 2023
5f48078
chore: normalize and update the build workflow to run on self-hosted …
nathanklick Nov 1, 2023
f31442b
chore: enable verbose build
nathanklick Nov 1, 2023
4f19207
chore: temporarily remove stdout/stderr redirection
nathanklick Nov 1, 2023
0082f0b
fix: resolve breakage caused by .npmrc variable
nathanklick Nov 1, 2023
b99f245
chore: additional workflow enhancements
nathanklick Nov 1, 2023
c806617
chore: add continue on error temporarily to troubleshoot workflow
nathanklick Nov 1, 2023
d452b7b
chore: normalize common JS workflow
nathanklick Nov 1, 2023
eeee7ec
chore: fixes publish
nathanklick Nov 1, 2023
511d16b
chore: switch to using npx instead of relative paths
nathanklick Nov 1, 2023
9142092
chore: ensure playwright dependencies are installed
nathanklick Nov 1, 2023
6cbbd08
chore: resolve failures and improve naming
nathanklick Nov 1, 2023
dc569e1
chore: standardize remaining workflows
nathanklick Nov 1, 2023
fe9ab41
chore: enable cache support
nathanklick Nov 1, 2023
936871b
chore: add support for creating the Github release
nathanklick Nov 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
nathanklick marked this conversation as resolved.
Show resolved Hide resolved
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