Skip to content

Commit

Permalink
Adds more CI validations, introduces semantic release (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
ygrishajev committed Apr 16, 2024
1 parent e43fd60 commit 1be7e3b
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 47 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Commit Lint

on:
- pull_request

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
HUSKY: 0

jobs:
commit-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
ref: main

- name: Fetch other branches for commitlint
run: git fetch --prune --unshallow

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18.0.0
# cache: npm

# - 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

- name: Validate PR commits with commitlint
id: commitlint
continue-on-error: true
run: |
output=$(npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} 2>&1) || true
echo "::set-output name=results::$output"
- name: Create comment
if: steps.commitlint.outputs.results
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
${{ steps.commitlint.outputs.results }}
- 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') }}
46 changes: 46 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Lint

on:
- pull_request

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
HUSKY: 0

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
ref: main

- name: Setup Node.js
id: setup_node
uses: actions/setup-node@v4
with:
node-version: 18.0.0
cache: npm

- 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

- name: Test
run: npm run lint

- 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') }}
51 changes: 51 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Test

on:
- pull_request

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
HUSKY: 0

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
ref: main

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18.0.0
cache: npm

- 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

- 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') }}
46 changes: 0 additions & 46 deletions .github/workflows/validate.yml

This file was deleted.

1 change: 0 additions & 1 deletion .husky/commit-msg

This file was deleted.

17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@types/sinon": "^10.0.11",
"@types/tap": "^15.0.5",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"commitlint": "^19.2.2",
"conventional-changelog-conventionalcommits": "^7.0.2",
"husky": "^9.0.11",
"jest": "^29.7.0",
Expand Down

0 comments on commit 1be7e3b

Please sign in to comment.