Skip to content

Commit

Permalink
chore: Configured .github/workflows for automated CI/CD testing and p…
Browse files Browse the repository at this point in the history
…ublish.
  • Loading branch information
michealroberts committed Jan 10, 2022
1 parent 8a21f98 commit d04dbd0
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Always validate the PR title AND all the commits
titleAndCommits: true
# Allows use of Merge commits (eg on github: "Merge branch 'master' into feature/ride-unicorns")
# this is only relevant when using commitsOnly: true (or titleAndCommits: true)
allowMergeCommits: true
52 changes: 52 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: fits/publish

on:
push:
branches:
- main

jobs:
ci:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node: [17]

steps:
- name: Checkout 🛎
uses: actions/checkout@master

# Setup .npmrc file to publish to GitHub Packages
- name: Setup node env 🏗 and .npmrc file to publish to GitHub Packages
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file:
scope: '@observerly'

- name: Cache node_modules 📦
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install project dependencies 👨🏻‍💻
run: npm ci

- name: Build the package ready for publishing
run: npm run build

- uses: JS-DevTools/npm-publish@v1
with:
registry: 'https://npm.pkg.github.com'
token: ${{ secrets.GITHUB_TOKEN }}
check-version: true

- if: steps.publish.outputs.type != 'none'
run: |
echo "@observerly/polaris package version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: fits/vitest

on:
pull_request:
branches:
- main

jobs:
unit:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node: [16, 17]

env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout 🛎
uses: actions/checkout@master

# Setup .npmrc file to publish to GitHub Packages
- name: Setup node env 🏗 and .npmrc file to publish to GitHub Packages
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file:
scope: '@observerly'

- name: Cache node_modules 📦
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install project dependencies 👨🏻‍💻
run: npm ci

- name: Run vitest tests 🧪
run: npm run test

0 comments on commit d04dbd0

Please sign in to comment.