Skip to content

Commit

Permalink
travis -> github actions
Browse files Browse the repository at this point in the history
mostly copied from executablebooks/thebe

includes npm-publish. Does not yet have a token in the secrets!
  • Loading branch information
minrk committed Nov 10, 2020
1 parent b66bbd2 commit 6057eb2
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 45 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/npm-publish.yml
@@ -0,0 +1,22 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: upload-npm

on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
98 changes: 98 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,98 @@
# Useful GitHub Actions docs:
#
# - https://help.github.com/en/actions
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
# - https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow
# - https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions

name: test

on:
- push
- pull_request

jobs:
# Job to run linter / autoformat

lint:
runs-on: ubuntu-20.04
steps:
# Action Repo: https://github.com/actions/checkout
- name: "Checkout repo"
uses: actions/checkout@v2

# Action Repo: https://github.com/actions/setup-node
- name: "Setup Node"
uses: actions/setup-node@v1
with:
node-version: "14"

# Action Repo: https://github.com/actions/cache
- name: "Cache node_modules"
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: "Install"
run: |
npm ci
- name: "`npm run fmt` and check for changes"
run: |
# If this fails, run `npm run fmt` and push the result
# amend if you feel so inclined.
npm run fmt
git diff --exit-code
- name: npm audit
run: |
# If this fails, run `npm audit fix`
npm audit --production --audit-level=moderate
test:
# no need to wait for lint
# needs: lint
runs-on: ubuntu-20.04
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategy
strategy:
fail-fast: false # Do not cancel all jobs if one fails
matrix:
node_version:
- "10"
- "12"
- "14"
- "15"

steps:
- name: "Checkout repo"
uses: actions/checkout@v2

# Action Repo: https://github.com/actions/setup-node
- name: "Setup Node"
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}

# Action Repo: https://github.com/actions/cache
- name: "Cache node_modules"
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: "Install dependencies"
run: |
npm ci
- name: "Run tests"
run: |
npm test
# Action Repo: https://github.com/codecov/codecov-action
- name: "Upload coverage to codecov"
uses: codecov/codecov-action@v1
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

0 comments on commit 6057eb2

Please sign in to comment.