-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ts): implements testing and release
- Loading branch information
1 parent
d27ac62
commit b49d468
Showing
22 changed files
with
9,647 additions
and
2,652 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
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,65 @@ | ||
name: Release TypeScript NPM Package | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check for changes | ||
uses: dorny/paths-filter@v2 | ||
id: changes | ||
with: | ||
filters: | | ||
ts: | ||
- 'ts/**' | ||
- name: Setup Node.js | ||
if: steps.changes.outputs.ts == 'true' | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.8.1 | ||
cache: npm | ||
cache-dependency-path: ts/package-lock.json | ||
|
||
- name: Restore node_modules cache | ||
id: deps-cache | ||
if: steps.changes.outputs.ts == 'true' && steps.deps-cache.outputs.cache-hit != 'true' | ||
uses: martijnhols/actions-cache/restore@v3 | ||
with: | ||
path: ts/node_modules | ||
key: ${{ runner.os }}-build-ts-deps-cache-${{ hashFiles('ts/package-lock.json') }} | ||
|
||
- name: Setup env | ||
if: steps.changes.outputs.ts == 'true' | ||
uses: HatsuneMiku3939/direnv-action@v1 | ||
|
||
- name: Run tests | ||
if: steps.changes.outputs.ts == 'true' | ||
run: SUB_TESTS=ts make test | ||
|
||
- name: Publish npm package | ||
if: steps.changes.outputs.ts == 'true' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.AUTH_GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: make release-ts | ||
|
||
- 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' && steps.changes.outputs.ts == 'true' | ||
uses: martijnhols/actions-cache/save@v3 | ||
with: | ||
path: ts/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
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,24 @@ | ||
ignore: | ||
- "**/*.pb.go" | ||
- "**/*.pb.gw.go" | ||
- "**/mocks/.*" | ||
- "pkg" | ||
comment: false | ||
codecov: | ||
require_ci_to_pass: true | ||
parsers: | ||
gcov: | ||
branch_detection: | ||
loop: yes | ||
macro: no | ||
method: no | ||
conditional: yes | ||
coverage: | ||
range: 40..100 | ||
round: down | ||
precision: 2 | ||
status: | ||
project: | ||
default: | ||
if_not_found: success | ||
if_ci_failed: error |
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
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,11 @@ | ||
.PHONY: release-ts | ||
|
||
release-ts: $(AKASH_TS_NODE_MODULES) $(AKASH_TS_ROOT)/dist | ||
if [ -z "$$CI" ]; then \ | ||
cd $(AKASH_TS_ROOT) && npx semantic-release --no-ci; \ | ||
else \ | ||
cd $(AKASH_TS_ROOT) && npx semantic-release; \ | ||
fi | ||
|
||
$(AKASH_TS_ROOT)/dist: $(shell find $(AKASH_TS_ROOT)/src -type f) | ||
cd $(AKASH_TS_ROOT) && npm run build |
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
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 |
---|---|---|
|
@@ -35,5 +35,13 @@ | |
] | ||
} | ||
] | ||
} | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.js"], | ||
"rules": { | ||
"@typescript-eslint/no-var-requires": "off" | ||
} | ||
} | ||
] | ||
} |
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,16 @@ | ||
# Configuration files | ||
.npmrc | ||
.prettierrc | ||
.releaserc | ||
jest.config.js | ||
tsconfig.build.json | ||
tsconfig.json | ||
|
||
# Source and test files | ||
src | ||
test | ||
|
||
# Miscellaneous directories | ||
.husky | ||
.idea | ||
script |
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 @@ | ||
//registry.npmjs.org/:_authToken=${NPM_TOKEN} |
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,32 @@ | ||
{ | ||
"extends": [ | ||
"semantic-release-commit-filter" | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
[ | ||
"@semantic-release/npm", | ||
{ | ||
"tarballDir": "package", | ||
"publish": { | ||
"access": "public" | ||
} | ||
} | ||
], | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
"assets": "package/*.tgz" | ||
} | ||
] | ||
], | ||
"preset": "angular", | ||
"working_directory": "ts", | ||
"branches": [ | ||
{ | ||
"name": "main" | ||
} | ||
], | ||
"tagFormat": "ts/v${version}" | ||
} |
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
Oops, something went wrong.