-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #333 from andyrichardson/use-actions
Move to Github Actions
- Loading branch information
Showing
4 changed files
with
160 additions
and
228 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,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 |
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 |
---|---|---|
@@ -1 +1 @@ | ||
14 | ||
16 |
File renamed without changes.