Skip to content

Commit

Permalink
chore(build,docs): GitHub workflows, badge (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcabrera committed Feb 12, 2021
1 parent 6705bc3 commit f577e33
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 16 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/commit_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
node-version: [14.x]
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -18,8 +18,9 @@ jobs:
run: |
git remote add ssh-origin "https://github.com/$GITHUB_REPOSITORY"
git fetch ssh-origin
COMMITS=$(git cherry -v ssh-origin/${{ env.BRANCH }} | grep "+")
echo ::set-env name=GIT_COMMITS::$COMMITS
echo 'GIT_COMMITS<<EOF' >> $GITHUB_ENV
git cherry -v ssh-origin/${{ env.BRANCH }} | grep "+" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main, build, development ]
env:
COV_NODE_VERSION: 14

jobs:
Integration-checks:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Set Node.js packages yarn cache directory
id: yarn-cache-dir
run: echo ::set-output name=CACHE_DIR::$(yarn cache dir)
- name: Node.js yarn cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir.outputs.CACHE_DIR }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn
- name: Node.js modules cache
uses: actions/cache@v2
id: modules-cache
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-modules
- name: Install Node.js packages
if: ${{ steps.modules-cache.outputs.cache-hit != 'true' }}
run: yarn install
- name: Lint and test
uses: actions/github-script@v2
with:
script: |
const { execSync } = require('child_process');
try {
console.log(`${execSync('yarn test', { stdio: 'pipe' })}`);
} catch ({ stdout, stderr }) {
core.setFailed(`${stdout}\n${stderr}`);
}
- name: Code coverage
if: ${{ success() && contains(matrix.node-version, env.COV_NODE_VERSION) }}
uses: codecov/codecov-action@v1
- name: Confirm integration
if: ${{ success() }}
uses: actions/github-script@v2
with:
script: |
const { execSync } = require('child_process');
try {
console.log(`${execSync('yarn test:integration', { stdio: 'pipe' })}`);
} catch ({ stdout, stderr }) {
core.setFailed(`${stdout}\n${stderr}`);
}
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Apidoc Mock
[![Build Status](https://travis-ci.org/cdcabrera/apidoc-mock.svg?branch=master)](https://travis-ci.org/cdcabrera/apidoc-mock)
[![Build Status](https://github.com/cdcabrera/apidoc-mock/workflows/Build/badge.svg?branch=master)](https://github.com/cdcabrera/apidoc-mock/actions?query=workflow%3ABuild)
[![codecov](https://codecov.io/gh/cdcabrera/apidoc-mock/branch/master/graph/badge.svg)](https://codecov.io/gh/cdcabrera/apidoc-mock)
[![License](https://img.shields.io/github/license/cdcabrera/apidoc-mock.svg)](https://github.com/cdcabrera/apidoc-mock/blob/master/LICENSE)

Expand Down

0 comments on commit f577e33

Please sign in to comment.