This repository has been archived by the owner on Jan 24, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
75 lines (71 loc) · 2.19 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# This file configure a GitHub workflow responsible to perform
# various checks related to the codebase.
#
# For that reason it's runned on every pull request and push to main.
#
# It does the following:
# - Check lint passes (no eslint error on files)
# - Check tests passes (none is failing)
# - Upload code coverage from tests to codecov
#
# If all these steps are passing the workflow ends up
# publishing package on npm if needed. It will publish the npm package
# using the token found in secrets.NPM_TOKEN. Be sure to create this
# token in the GitHub repository.
#
# If you want to update this file it's recommended to use
# a YAML validator such as https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
# configured to validate this file with https://json.schemastore.org/github-workflow.json
name: main
on:
pull_request:
branches:
- "**"
push:
branches:
- master
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [14.17.0]
runs-on: ${{ matrix.os }}
name: test on ${{ matrix.os }} and node ${{ matrix.node }}
env:
CI: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: npm install
run: npm install
- name: check lint
run: npm run eslint-check
- name: check tests
run: npm run test-with-coverage
- name: upload coverage
run: node ./script/test/upload_coverage.mjs
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
release:
needs: [test]
if: success() && github.event_name == 'push'
runs-on: ubuntu-latest
name: release
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: npm install
run: npm install
- name: publish package
run: node ./.github/workflows/main/publish_package.mjs
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: ensure github release
run: node ./.github/workflows/main/github_release.mjs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}