Skip to content

Commit

Permalink
fix: add Github Actions workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
shazron committed Sep 21, 2021
1 parent 2dec0a8 commit 3f926a6
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Daily - Do npm install and run all unit tests

on:
schedule:
# run daily at midnight
- cron: '0 0 * * *'

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [14]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm i --package-lock --package-lock-only
- run: npm ci
- name: run unit tests
run: npm run test
- name: Slack Notification
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: 'Node version'
SLACK_MESSAGE: ${{ matrix.node }}
SLACK_COLOR: ${{ job.status == 'success' && 'good' || job.status == 'cancelled' && '#808080' || 'danger' }}

40 changes: 40 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [12.x, 14.x]
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm i --package-lock --package-lock-only
- run: npm ci
- run: npm run build --if-present
- run: npm test
- name: upload coverage
if: success()
run: curl -s https://codecov.io/bash | bash
env:
CODECOV_NAME: ${{ runner.os }} node.js ${{ matrix.node-version }}
shell: bash
20 changes: 20 additions & 0 deletions .github/workflows/on-push-publish-to-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: on-push-publish-to-npm
on:
push:
branches:
- main
paths:
- "package.json"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
- run: npm install
- run: npm test
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/version-bump-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: version-bump-publish
on:
workflow_dispatch:
inputs:
level:
description: "<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease"
required: true
default: "patch"
tag:
description: "The tag to publish to."
required: false
default: "latest"
jobs:
checkout:
name: checkout
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git config user.name github-actions
git config user.email github-actions@github.com
- uses: actions/setup-node@v1
with:
node-version: 14
- run: |
npm install
npm test
- name: bump and pub
if: ${{ github.event.inputs.level != '' }}
run: |
npm version ${{ github.event.inputs.level }}
git push
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
tag: ${{ github.event.inputs.tag }}
access: "public"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Modify 'docs/readme_template.md', then run `npm run generate-docs`.
[![Downloads/week](https://img.shields.io/npm/dw/@adobe/aio-lib-test-proxy.svg)](https://npmjs.org/package/@adobe/aio-lib-test-proxy)
[![Node.js CI](https://github.com/adobe/aio-lib-test-proxy/actions/workflows/node.js.yml/badge.svg)](https://github.com/adobe/aio-lib-test-proxy/actions/workflows/node.js.yml)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Codecov Coverage](https://img.shields.io/codecov/c/github/adobe/aio-lib-test-proxy/master.svg?style=flat-square)](https://codecov.io/gh/adobe/aio-lib-test-proxy/)
[![Codecov Coverage](https://img.shields.io/codecov/c/github/adobe/aio-lib-test-proxy/main.svg?style=flat-square)](https://codecov.io/gh/adobe/aio-lib-test-proxy/)


# Adobe I/O Lib for Test Proxies and Api Servers
Expand Down
2 changes: 1 addition & 1 deletion docs/readme_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Modify 'docs/readme_template.md', then run `npm run generate-docs`.
[![Downloads/week](https://img.shields.io/npm/dw/@adobe/aio-lib-test-proxy.svg)](https://npmjs.org/package/@adobe/aio-lib-test-proxy)
[![Node.js CI](https://github.com/adobe/aio-lib-test-proxy/actions/workflows/node.js.yml/badge.svg)](https://github.com/adobe/aio-lib-test-proxy/actions/workflows/node.js.yml)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Codecov Coverage](https://img.shields.io/codecov/c/github/adobe/aio-lib-test-proxy/master.svg?style=flat-square)](https://codecov.io/gh/adobe/aio-lib-test-proxy/)
[![Codecov Coverage](https://img.shields.io/codecov/c/github/adobe/aio-lib-test-proxy/main.svg?style=flat-square)](https://codecov.io/gh/adobe/aio-lib-test-proxy/)


# Adobe I/O Lib for Test Proxies and Api Servers
Expand Down

0 comments on commit 3f926a6

Please sign in to comment.