Skip to content
This repository was archived by the owner on Oct 1, 2023. It is now read-only.

Commit c56e9d0

Browse files
committed
Action rework: reusing CI and coverage as summary
1 parent f3c0df8 commit c56e9d0

File tree

7 files changed

+122
-100
lines changed

7 files changed

+122
-100
lines changed

.github/workflows/check.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: check
2+
3+
on: [workflow_call]
4+
5+
jobs:
6+
prettier:
7+
continue-on-error: true
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-node@v3
12+
with:
13+
node-version: 16.x
14+
cache: 'yarn'
15+
- run: yarn install --immutable
16+
- run: yarn run format-check
17+
18+
eslint:
19+
continue-on-error: true
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
- uses: actions/setup-node@v3
24+
with:
25+
node-version: 16.x
26+
cache: 'yarn'
27+
- run: yarn install --immutable
28+
- run: yarn run lint-check
29+
30+
stylelint:
31+
continue-on-error: true
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v3
35+
- uses: actions/setup-node@v3
36+
with:
37+
node-version: 16.x
38+
cache: 'yarn'
39+
- run: yarn install --immutable
40+
- run: yarn run style-check

.github/workflows/ci.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: ci
2+
3+
on: [workflow_call]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- uses: actions/setup-node@v3
11+
with:
12+
node-version: 16.x
13+
cache: 'yarn'
14+
- run: yarn install --immutable
15+
- run: yarn run build
16+
17+
check:
18+
uses: ./.github/workflows/check.yml

.github/workflows/codeql.yml

-81
This file was deleted.

.github/workflows/main.yml

+7-16
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,10 @@ on:
1313
- '.github/**'
1414

1515
jobs:
16-
build:
17-
name: CI
18-
runs-on: ubuntu-latest
19-
steps:
20-
- uses: actions/checkout@v3
21-
- uses: actions/setup-node@v3
22-
with:
23-
node-version: 16.x
24-
- run: yarn install --frozen-lockfile
25-
- run: yarn run all
26-
- run: yarn run format-check
27-
if: always()
28-
- run: yarn run lint-check
29-
if: always()
30-
- run: yarn run style-check
31-
if: always()
16+
CI:
17+
uses: ./.github/workflows/ci.yml
18+
19+
test:
20+
uses: ./.github/workflows/test.yml
21+
with:
22+
coverage: true
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
33

4-
name: publish
4+
name: release
55

66
on:
77
release:
88
types: [created]
99

1010
jobs:
11-
publish-npm:
11+
test:
12+
uses: ./.github/workflows/test.yml
13+
14+
publish:
1215
runs-on: ubuntu-latest
16+
needs: test
1317
steps:
1418
- uses: actions/checkout@v3
1519
- uses: actions/setup-node@v3
@@ -20,4 +24,4 @@ jobs:
2024
- run: yarn run build
2125
- run: yarn publish
2226
env:
23-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
27+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: test
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
coverage:
7+
required: false
8+
type: boolean
9+
workflow_dispatch:
10+
inputs:
11+
coverage:
12+
required: false
13+
type: boolean
14+
15+
jobs:
16+
mocha:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: 16.x
23+
cache: 'yarn'
24+
- run: yarn install --immutable
25+
- run: yarn run test
26+
27+
c8:
28+
runs-on: ubuntu-latest
29+
if: ${{ inputs.coverage }}
30+
steps:
31+
- uses: actions/checkout@v3
32+
- uses: actions/setup-node@v3
33+
with:
34+
node-version: 16.x
35+
cache: 'yarn'
36+
- run: yarn install --immutable
37+
- run: yarn run coverage | tee coverage.md
38+
continue-on-error: true
39+
- name: Extract and process coverage data
40+
run: |
41+
cat coverage.md | grep -E '(.*\|)+' | sed '1d;$d' | perl -lpe 's/(-+)-\|(-+)-\|(-+)-\|(-+)-\|(-+)-\|(-+)-/:\1\|\2:\|\3:\|\4:\|\5:\|:\6/g' | perl -lpe 's/^\s/:bookmark: /g' | perl -lpe 's/(\w+\.tsx?)/**\1**/g' | perl -lpe 's/(\d+(-\d+)?,)/\1 /g' > coverage.md
42+
- name: Set coverage summary table
43+
run: |
44+
cat coverage.md >> $GITHUB_STEP_SUMMARY

.idea/markdown.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)