Repository navigation
121 lines (99 loc) · 4.32 KB
/
Copy pathci.yml
File metadata and controls
121 lines (99 loc) · 4.32 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# CI - Validates formatting, linting, type-checking, unit tests, and the packed package, and runs
# CodeQL analysis, on PRs and pushes to develop.
#
# This workflow does not publish artifacts. For snapshot and release publishing, see Deploy
# Snapshot and Deploy Release.
name: CI
on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
schedule:
- cron: '23 10 * * 4'
# Only the latest commit's result matters - cancel superseded runs for the same PR or branch.
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
# No need / benefit to run lint on a schedule.
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
# Installs the pnpm version pinned via the packageManager field in package.json.
- name: Setup pnpm
uses: pnpm/setup@v3
with:
# `install: false` - this workflow runs its own install step below, after
# Font Awesome registry auth, and with --frozen-lockfile.
install: false
# `node-version-file: false` - actions/setup-node below owns Node.
node-version-file: false
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
# Required because @xh/hoist (a devDependency, for type-checking and tests) depends on the
# private Font Awesome Pro registry.
- name: Configure Font Awesome registry auth
env:
FONTAWESOME_PACKAGE_TOKEN: ${{ secrets.FONTAWESOME_PACKAGE_TOKEN }}
run: echo "//npm.fontawesome.com/:_authToken=$FONTAWESOME_PACKAGE_TOKEN" >> .npmrc
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Runs eslint, stylelint, and prettier --check (see package.json `lint:all`).
- name: Lint
run: pnpm lint
# A separate concern from linting: ESLint never reports compiler diagnostics, so a genuine
# type error passes `pnpm lint`.
- name: Type check
run: pnpm typecheck
- name: Unit tests
run: pnpm test
# The package ships as source, so its build is the packed tarball. This packs it and
# checks that every source package ships and that no specs or planning files do.
- name: Build package
run: pnpm build
# Gates merges on a clean production-dependency audit for high and critical advisories.
# The first, un-gated run prints lower-severity findings in the step log for visibility
# without failing the build.
#
# Advisories the kit accepts for now are listed under `auditConfig` in
# pnpm-workspace.yaml, each with a note on when to drop it.
- name: Audit production dependencies
run: |
pnpm audit --prod || true
pnpm audit --prod --audit-level high
codeql:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
# Code scanning needs GitHub Code Security, which private repos do not have by default.
# Skip the analysis while the repo is private, so it runs once the repo goes public. The
# check reads visibility from the API because scheduled runs carry no repository payload.
- name: Check repository visibility
id: visibility
env:
GH_TOKEN: ${{ github.token }}
run: echo "public=$(gh api repos/${{ github.repository }} --jq '.visibility == "public"')" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v7
if: steps.visibility.outputs.public == 'true'
- name: Initialize CodeQL
if: steps.visibility.outputs.public == 'true'
uses: github/codeql-action/init@v4.39.4
with:
languages: javascript
- name: Autobuild
if: steps.visibility.outputs.public == 'true'
uses: github/codeql-action/autobuild@v4.39.4
- name: Perform CodeQL Analysis
if: steps.visibility.outputs.public == 'true'
uses: github/codeql-action/analyze@v4.39.4