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 17, 2024
1 parent 7fd7ec7 commit c538bd0
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint
name: Code Style

on:
- workflow_call
Expand Down Expand Up @@ -29,7 +29,8 @@ jobs:
if: needs.duplicate-check.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
id: setup_node
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Code Style

on:
- pull_request

jobs:
code-style:
name: Code Style
uses: ./.github/workflows/code-style-reusable.yml
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Commit Lint Feature Check
name: Commit Lint

on:
- pull_request

jobs:
commit-lint:
name: Main
name: Commit Lint
uses: ./.github/workflows/commit-lint-reusable.yml
secrets: inherit
9 changes: 0 additions & 9 deletions .github/workflows/lint.yml

This file was deleted.

55 changes: 30 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,62 @@ on:
- main

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

env:
HUSKY: 0

jobs:
commit-lint:
name: Main
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
needs: [commit-lint, lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
ref: main

- name: Fetch other branches for commitlint
run: git fetch --prune --unshallow
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
if: steps.changes.outputs.ts == 'true'
id: setup_node
uses: actions/setup-node@v4
with:
node-version: 18.0.0
cache: npm
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: Validate PR commits with commitlint
uses: wagoid/commitlint-github-action@v6

- name: Lint
run: npm run lint

- name: Test
run: npm run test:cov

- name: Release npm package
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Upload Test Coverage
uses: codecov/codecov-action@v4
- name: Cache node modules
if: steps.deps-cache.outputs.cache-hit != 'true'
uses: martijnhols/actions-cache/save@v3
with:
files: ./ts/coverage
token: ${{ secrets.CODECOV_TOKEN }}
path: node_modules
key: ${{ runner.os }}-build-ts-deps-cache-${{ hashFiles('ts/package-lock.json') }}
3 changes: 2 additions & 1 deletion .github/workflows/test-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
if: needs.duplicate-check.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
id: setup_node
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ on:

jobs:
test:
name: Test and report coverage
name: Test
uses: ./.github/workflows/test-reusable.yml
secrets: inherit

0 comments on commit c538bd0

Please sign in to comment.