Skip to content

Commit

Permalink
feat(CI.yml): add CI workflow for running tests, collecting coverage,…
Browse files Browse the repository at this point in the history
… and uploading to Codecov

feat(CI.yml): add workflow for publishing releases using semantic-release
feat(release.config.js): add semantic-release configuration for npm and GitHub plugins
  • Loading branch information
multipliedtwice committed Jul 27, 2024
1 parent bf138ff commit 6b762f5
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- "*"
jobs:
Test_and_Coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: 20.x
registry-url: https://registry.npmjs.org

- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run tests and collect coverage
run: yarn coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: coverage/lcov.info
flags: unittests
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Publish:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: 20.x
registry-url: https://registry.npmjs.org
- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Publish 🚀
working-directory: ./
run: npx semantic-release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
permissions:
contents: write
9 changes: 9 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
'@semantic-release/npm',
'@semantic-release/github',
],
branches: ['master'],
};

0 comments on commit 6b762f5

Please sign in to comment.