-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: adds more CI validations, introduces semantic release (#74)
Also: - Uses semantic release - Adds checks on before commit and in CI: eslint and commit lint
- Loading branch information
1 parent
7f11ac8
commit e20e648
Showing
28 changed files
with
12,126 additions
and
4,792 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
], | ||
"rules": { | ||
"scope-enum": [ | ||
2, | ||
"always", | ||
[ | ||
"certificates", | ||
"network", | ||
"wallet", | ||
"api", | ||
"stargate" | ||
] | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: 'Setup Node.js and Cache Dependencies' | ||
description: 'Checks out code, sets up Node.js, installs dependencies, and handles caching' | ||
|
||
inputs: | ||
node-version: | ||
description: 'Node.js version to setup' | ||
required: true | ||
default: '18.0.0' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
|
||
- name: Restore node_modules cache | ||
id: deps-cache | ||
uses: martijnhols/actions-cache/restore@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-build-ts-deps-cache-${{ hashFiles('ts/package-lock.json') }} | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
if: steps.deps-cache.outputs.cache-hit != 'true' | ||
|
||
- name: Cache node modules | ||
if: steps.deps-cache.outputs.cache-hit != 'true' | ||
uses: martijnhols/actions-cache/save@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-build-ts-deps-cache-${{ hashFiles('ts/package-lock.json') }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Code Style | ||
|
||
on: | ||
- workflow_call | ||
|
||
env: | ||
HUSKY: 0 | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js and Cache Dependencies | ||
uses: ./.github/actions/setup-node | ||
|
||
- name: Lint | ||
run: npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Code Style | ||
|
||
on: | ||
- pull_request | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
code-style: | ||
name: Code Style | ||
uses: ./.github/workflows/code-style-reusable.yml | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Commit Lint | ||
|
||
on: | ||
- workflow_call | ||
|
||
env: | ||
HUSKY: 0 | ||
|
||
jobs: | ||
commit-lint: | ||
name: Validate PR commits with commitlint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Validate PR commits with commitlint | ||
uses: wagoid/commitlint-github-action@v6 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Commit Lint | ||
|
||
on: | ||
- pull_request | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
commit-lint: | ||
name: Commit Lint | ||
uses: ./.github/workflows/commit-lint-reusable.yml | ||
secrets: inherit |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Release from Master on Push | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
HUSKY: 0 | ||
|
||
jobs: | ||
commit-lint: | ||
name: Commit Lint | ||
uses: ./.github/workflows/commit-lint-reusable.yml | ||
secrets: inherit | ||
|
||
lint: | ||
name: Lint and report coverage | ||
uses: ./.github/workflows/code-style-reusable.yml | ||
secrets: inherit | ||
|
||
test: | ||
name: Run tests | ||
uses: ./.github/workflows/test-reusable.yml | ||
secrets: inherit | ||
|
||
release: | ||
name: Build and release npm package | ||
needs: [commit-lint, lint, test] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
id: setup_node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.0.0 | ||
|
||
- name: Restore node_modules cache | ||
id: deps-cache | ||
uses: martijnhols/actions-cache/restore@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-build-ts-deps-cache-${{ hashFiles('ts/package-lock.json') }} | ||
|
||
- name: Install dependencies | ||
if: steps.deps-cache.outputs.cache-hit != 'true' | ||
run: npm install | ||
|
||
- name: Release npm package | ||
uses: cycjimmy/semantic-release-action@v4 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Cache node modules | ||
if: steps.deps-cache.outputs.cache-hit != 'true' | ||
uses: martijnhols/actions-cache/save@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-build-ts-deps-cache-${{ hashFiles('ts/package-lock.json') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Test | ||
|
||
on: | ||
- workflow_call | ||
|
||
env: | ||
HUSKY: 0 | ||
|
||
jobs: | ||
test: | ||
name: Test and report coverage | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
id: setup_node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.0.0 | ||
|
||
- name: Restore node_modules cache | ||
id: deps-cache | ||
uses: martijnhols/actions-cache/restore@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-build-ts-deps-cache-${{ hashFiles('ts/package-lock.json') }} | ||
|
||
- name: Install dependencies | ||
if: steps.deps-cache.outputs.cache-hit != 'true' | ||
run: npm install | ||
|
||
- name: Test | ||
run: npm run test:cov | ||
|
||
- name: Upload Test Coverage | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
files: ./ts/coverage | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
- name: Cache node modules | ||
if: steps.deps-cache.outputs.cache-hit != 'true' | ||
uses: martijnhols/actions-cache/save@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-build-ts-deps-cache-${{ hashFiles('ts/package-lock.json') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Test | ||
|
||
on: | ||
- pull_request | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
uses: ./.github/workflows/test-reusable.yml | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ umd/ | |
|
||
# Coverage directory | ||
.nyc_output/ | ||
coverage | ||
|
||
# Log files | ||
yarn-error.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
npx --no -- commitlint --edit $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
[ | ||
"@semantic-release/changelog", | ||
{ | ||
"changelogFile": "CHANGELOG.md" | ||
} | ||
], | ||
[ | ||
"@semantic-release/npm", | ||
{ | ||
"tarballDir": "package" | ||
} | ||
], | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
"assets": "package/*.tgz" | ||
} | ||
], | ||
"@semantic-release/git" | ||
], | ||
"branches": [ | ||
{ | ||
"name": "main" | ||
} | ||
], | ||
"preset": "conventionalcommits" | ||
} |
Oops, something went wrong.