Skip to content

Commit 6057eb2

Browse files
committed
travis -> github actions
mostly copied from executablebooks/thebe includes npm-publish. Does not yet have a token in the secrets!
1 parent b66bbd2 commit 6057eb2

File tree

3 files changed

+120
-45
lines changed

3 files changed

+120
-45
lines changed

.github/workflows/npm-publish.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3+
4+
name: upload-npm
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
publish-npm:
12+
runs-on: ubuntu-20.04
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: 14
18+
registry-url: https://registry.npmjs.org/
19+
- run: npm ci
20+
- run: npm publish
21+
env:
22+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.github/workflows/test.yml

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Useful GitHub Actions docs:
2+
#
3+
# - https://help.github.com/en/actions
4+
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
5+
# - https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow
6+
# - https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
7+
8+
name: test
9+
10+
on:
11+
- push
12+
- pull_request
13+
14+
jobs:
15+
# Job to run linter / autoformat
16+
17+
lint:
18+
runs-on: ubuntu-20.04
19+
steps:
20+
# Action Repo: https://github.com/actions/checkout
21+
- name: "Checkout repo"
22+
uses: actions/checkout@v2
23+
24+
# Action Repo: https://github.com/actions/setup-node
25+
- name: "Setup Node"
26+
uses: actions/setup-node@v1
27+
with:
28+
node-version: "14"
29+
30+
# Action Repo: https://github.com/actions/cache
31+
- name: "Cache node_modules"
32+
uses: actions/cache@v2
33+
with:
34+
path: node_modules
35+
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
36+
restore-keys: |
37+
${{ runner.os }}-npm-
38+
39+
- name: "Install"
40+
run: |
41+
npm ci
42+
43+
- name: "`npm run fmt` and check for changes"
44+
run: |
45+
# If this fails, run `npm run fmt` and push the result
46+
# amend if you feel so inclined.
47+
npm run fmt
48+
git diff --exit-code
49+
50+
- name: npm audit
51+
run: |
52+
# If this fails, run `npm audit fix`
53+
npm audit --production --audit-level=moderate
54+
55+
test:
56+
# no need to wait for lint
57+
# needs: lint
58+
runs-on: ubuntu-20.04
59+
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategy
60+
strategy:
61+
fail-fast: false # Do not cancel all jobs if one fails
62+
matrix:
63+
node_version:
64+
- "10"
65+
- "12"
66+
- "14"
67+
- "15"
68+
69+
steps:
70+
- name: "Checkout repo"
71+
uses: actions/checkout@v2
72+
73+
# Action Repo: https://github.com/actions/setup-node
74+
- name: "Setup Node"
75+
uses: actions/setup-node@v1
76+
with:
77+
node-version: ${{ matrix.node_version }}
78+
79+
# Action Repo: https://github.com/actions/cache
80+
- name: "Cache node_modules"
81+
uses: actions/cache@v2
82+
with:
83+
path: node_modules
84+
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
85+
restore-keys: |
86+
${{ runner.os }}-npm-
87+
88+
- name: "Install dependencies"
89+
run: |
90+
npm ci
91+
92+
- name: "Run tests"
93+
run: |
94+
npm test
95+
96+
# Action Repo: https://github.com/codecov/codecov-action
97+
- name: "Upload coverage to codecov"
98+
uses: codecov/codecov-action@v1

.travis.yml

-45
This file was deleted.

0 commit comments

Comments
 (0)