Skip to content

Commit

Permalink
Merge pull request #333 from andyrichardson/use-actions
Browse files Browse the repository at this point in the history
Move to Github Actions
  • Loading branch information
andyrichardson authored Sep 12, 2022
2 parents 72dd922 + b6f5c4a commit 9394acb
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 228 deletions.
227 changes: 0 additions & 227 deletions .circleci/config.yml

This file was deleted.

159 changes: 159 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
on:
push:
branches:
- master
tags:
- v*
pull_request:

name: CI

jobs:
install:
runs-on: ubuntu-latest
container: 'node:16'
steps:
- uses: actions/checkout@v2
- name: Cache node modules
id: cache
uses: actions/cache@v2
with:
path: ./node_modules
key: nodemodules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

build:
needs: install
runs-on: ubuntu-latest
container:
image: 'node:16'
options: --user 1001
steps:
- uses: actions/checkout@v2
- name: Restore node modules
uses: actions/cache@v2
with:
path: ./node_modules
key: nodemodules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- run: npm run build
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: build-output
path: dist

test:
needs: install
runs-on: ubuntu-latest
container: 'node:16'
steps:
- uses: actions/checkout@v2
- name: Restore node modules
uses: actions/cache@v2
with:
path: ./node_modules
key: nodemodules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- run: npm run test -- --coverage
- uses: codecov/codecov-action@v3

lint:
needs: install
runs-on: ubuntu-latest
container: 'node:16'
steps:
- uses: actions/checkout@v2
- name: Restore node modules
uses: actions/cache@v2
with:
path: ./node_modules
key: nodemodules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- run: npm run lint

typecheck:
needs: install
runs-on: ubuntu-latest
container: 'node:16'
steps:
- uses: actions/checkout@v2
- name: Restore node modules
uses: actions/cache@v2
with:
path: ./node_modules
key: nodemodules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- run: $(npm bin)/tsc --noEmit

check-formatting:
name: check formatting
needs: install
runs-on: ubuntu-latest
container: 'node:16'
steps:
- uses: actions/checkout@v2
- name: Restore node modules
uses: actions/cache@v2
with:
path: ./node_modules
key: nodemodules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- run: $(npm bin)/prettier --check .

e2e-example:
needs: build
strategy:
matrix:
example: ['1-basics', '2-multi-step', '3-branching']
name: e2e - example ${{ matrix.example }}
runs-on: ubuntu-latest
container: 'cypress/browsers:node16.5.0-chrome94-ff93'
steps:
- uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: build-output
path: dist
- run: npm pack
- name: remove registry pkg
run: npm remove fielder
working-directory: examples/${{ matrix.example }}
- name: install dependencies
run: npm install
working-directory: examples/${{ matrix.example }}
- name: install prebuilt package
run: npm install ../../fielder*.tgz
working-directory: examples/${{ matrix.example }}
- name: check types
run: $(npm bin)/tsc --noEmit
working-directory: examples/${{ matrix.example }}
- name: run tests
run: npm run serve & sleep 10 && npm run test
working-directory: examples/${{ matrix.example }}

publish:
if: startsWith(github.ref, 'refs/tags/v')
needs:
- install
- build
- test
- check-formatting
- lint
- typecheck
- e2e-example
runs-on: ubuntu-latest
container: 'node:16'
steps:
- uses: actions/checkout@v2
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: build-output
path: dist
- name: Version package.json
run: npm --no-git-tag-version version ${{steps.tag.outputs.tag}}
- name: Create .npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- name: Publish
run: npm publish
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
16
File renamed without changes.

0 comments on commit 9394acb

Please sign in to comment.