Skip to content

Commit

Permalink
fix: Merge pull request tancredi#110 from tancredi/patch-2
Browse files Browse the repository at this point in the history
CI improvements
  • Loading branch information
tancredi committed Feb 7, 2021
2 parents a4fbc04 + 5a3d8a7 commit 4a80a54
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 12 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ on:
push:
branches: [master]

env:
FORCE_COLOR: 2
NODE: 14.x

jobs:
release:
if: "!contains(github.event.head_commit.message, 'skip ci')"
if: "!contains(github.event.head_commit.message, 'skip ci') && github.repository == 'tancredi/fantasticon'"
name: Release

runs-on: ubuntu-18.04
Expand All @@ -15,9 +19,17 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: '${{ env.NODE }}'
- name: Set up npm cache
uses: actions/cache@v2
with:
node-version: 14
path: ~/.npm
key: ${{ runner.os }}-node-v${{ env.NODE }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-v${{ env.NODE }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
${{ runner.os }}-node-v${{ env.NODE }}-
- name: Install dependencies
run: npm ci
- name: Build
Expand Down
42 changes: 33 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
name: Test

on: [push, pull_request_target]
on: [push, pull_request]

env:
FORCE_COLOR: 2

jobs:
lint:
name: Lint
env:
NODE: 14.x

runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: '${{ env.NODE }}'
- uses: actions/cache@v2
with:
node-version: 14
- run: npm install
path: ~/.npm
key: ${{ matrix.os }}-node-v${{ env.NODE }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ matrix.os }}-node-v${{ env.NODE }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
${{ matrix.os }}-node-v${{ env.NODE }}-
- run: npm ci
- run: npm run lint

test:
Expand All @@ -23,16 +35,28 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [macOS-10.15, ubuntu-18.04, windows-2019]
node-version: [10.x, 12.x, 15.x]
node: [10.x, 12.x, 15.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ matrix.os }}-node-v${{ matrix.node }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ matrix.os }}-node-v${{ matrix.node }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
${{ matrix.os }}-node-v${{ matrix.node }}-
- run: npm ci
- run: npm run build
- run: npm test

0 comments on commit 4a80a54

Please sign in to comment.