Skip to content

Commit

Permalink
feat(ts): implements testing and release (#184) (#143)
Browse files Browse the repository at this point in the history
-  adds missing exports
- patches DecCoin.encode to input a float
  • Loading branch information
ygrishajev authored Apr 12, 2024
1 parent 3563110 commit 279f807
Show file tree
Hide file tree
Showing 30 changed files with 14,007 additions and 6,803 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ AKASH_DEVCACHE_NODE_MODULES=${AKASH_DEVCACHE}
AKASH_DEVCACHE_NODE_BIN=${AKASH_DEVCACHE_NODE_MODULES}/node_modules/.bin
AKASH_TS_ROOT=${AKASH_ROOT}/ts
AKASH_TS_PACKAGE_FILE=${AKASH_TS_ROOT}/package.json
AKASH_TS_NODE_BIN=${AKASH_TS_ROOT}/node_modules/.bin
AKASH_TS_NODE_MODULES=${AKASH_TS_ROOT}/node_modules
AKASH_TS_NODE_BIN=${AKASH_TS_NODE_MODULES}/.bin
13 changes: 11 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: go mod vendor
run: make modvendor
- name: lint
run: make lint-proto
run: make lint-go
proto:
runs-on: ubuntu-latest
timeout-minutes: 5
Expand All @@ -42,4 +42,13 @@ jobs:
- name: go mod vendor
run: make modvendor
- name: lint-go
run: make lint-go
run: make lint-proto
ts:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Setup env
uses: HatsuneMiku3939/direnv-action@v1
- name: lint-ts
run: make lint-ts
65 changes: 65 additions & 0 deletions .github/workflows/release-ts.yaml
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') }}

15 changes: 12 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: golang
name: tests
on:
pull_request:
push:
Expand All @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: "${{ env.GOVERSION }}"
- run: TEST_RACE=1 make test
- run: SUB_TESTS=go TEST_RACE=1 make test
coverage:
runs-on: ubuntu-latest
steps:
Expand All @@ -34,4 +34,13 @@ jobs:
with:
go-version: "${{ env.GOVERSION }}"
- run: make test-coverage
- uses: codecov/codecov-action@v3
- name: Upload GO Test Coverage
uses: codecov/codecov-action@v4
with:
files: ./coverage.txt
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload TS Test Coverage
uses: codecov/codecov-action@v4
with:
files: ./ts/coverage
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ include $(AKASH_ROOT)/make/mod.mk
include $(AKASH_ROOT)/make/test.mk
include $(AKASH_ROOT)/make/codegen.mk
include $(AKASH_ROOT)/make/lint.mk
include $(AKASH_ROOT)/make/release-ts.mk

.PHONY: clean
clean:
Expand Down
24 changes: 24 additions & 0 deletions codecov.yml
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
Loading

0 comments on commit 279f807

Please sign in to comment.