-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ci-cd on push: test, lint, license-check
- Loading branch information
Eduard Lavuš
committed
Jun 22, 2020
1 parent
2de6652
commit d12332c
Showing
3 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: CI | ||
on: | ||
- push | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Setup environment and checkout the project master | ||
- name: Setup Node.js environment | ||
uses: actions/[email protected] | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
# Setup yarn cache | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- uses: actions/cache@v2 | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
# Install and run tests | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Test | ||
run: yarn test | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Setup environment and checkout the project master | ||
- name: Setup Node.js environment | ||
uses: actions/[email protected] | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
# Setup yarn cache | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- uses: actions/cache@v2 | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
# Install and run lint | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Lint | ||
run: yarn lint | ||
|
||
lincense-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Setup environment and checkout the project master | ||
- name: Setup Node.js environment | ||
uses: actions/[email protected] | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
# Setup yarn cache | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- uses: actions/cache@v2 | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
# Install and run license checker | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Install License checker | ||
run: | | ||
yarn global add license-checker | ||
echo "::add-path::$(yarn global bin)" | ||
- name: Check licenses | ||
run: "license-checker --onlyAllow '0BDS;MIT;Apache-2.0;ISC;BSD-3-Clause;BSD-2-Clause;CC-BY-4.0;CC-BY-3.0;BSD;CC0-1.0;Unlicense;UNLICENSED' --summary" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Publish | ||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout project master and setup environment | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Node.js environment | ||
uses: actions/[email protected] | ||
with: | ||
registry-url: "https://npm.pkg.github.com" | ||
# Defaults to the user or organization that owns the workflow file | ||
scope: "@superindustries" | ||
|
||
# Install dependencies and run test | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Test | ||
run: yarn test | ||
|
||
# Build the project | ||
- name: Build | ||
run: yarn build | ||
|
||
# Prepare and publish | ||
- name: Publish Git preparation | ||
run: | | ||
echo Publishing as version ${GITHUB_REF##*/v} | ||
# This is to appease the GIT gods. Yarn cannot publish without a version bump (that would invoke git with empty credentials) | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Foo Bar" | ||
git tag -d ${GITHUB_REF##*/} | ||
- name: Publish | ||
run: yarn publish --new-version ${GITHUB_REF##*/v} --verbose | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters