Skip to content

Commit c15b3a9

Browse files
authored
Ci blueprint (#83)
1 parent 9fe2155 commit c15b3a9

14 files changed

Lines changed: 803 additions & 106 deletions

‎.github/dependabot.yml‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@
33

44
version: 2
55
updates:
6-
- package-ecosystem: 'npm' # pnpm is detected automatically via pnpm-lock.yaml
6+
- package-ecosystem: 'npm'
77
directory: '/'
88
schedule:
99
interval: 'monthly'
1010
groups:
11-
npm-all:
12-
exclude-patterns:
13-
- '@projectwallace/*'
1411
projectwallace:
1512
patterns:
1613
- '@projectwallace/*'
14+
npm-all:
15+
patterns:
16+
- '*'
17+
exclude-patterns:
18+
- '@projectwallace/*'
19+
cooldown:
20+
default-days: 7
1721
- package-ecosystem: 'github-actions'
1822
directory: '/'
1923
schedule:
@@ -22,3 +26,5 @@ updates:
2226
github-actions:
2327
patterns:
2428
- '*'
29+
cooldown:
30+
default-days: 7
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Dependency Diff
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
build-base:
9+
name: Pack base branch
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
steps:
14+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
15+
with:
16+
ref: main
17+
persist-credentials: false
18+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
19+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
20+
with:
21+
node-version: 22
22+
cache: pnpm
23+
- run: pnpm install --frozen-lockfile --ignore-scripts
24+
- run: pnpm run build
25+
- run: pnpm pack --pack-destination ./base-packs
26+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
27+
with:
28+
name: base-packages
29+
path: ./base-packs/*.tgz
30+
31+
build-pr:
32+
name: Pack PR branch
33+
runs-on: ubuntu-latest
34+
permissions:
35+
contents: read
36+
steps:
37+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
38+
with:
39+
persist-credentials: false
40+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
41+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
42+
with:
43+
node-version: 22
44+
cache: pnpm
45+
- run: pnpm install --frozen-lockfile --ignore-scripts
46+
- run: pnpm run build
47+
- run: pnpm pack --pack-destination ./source-packs
48+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
49+
with:
50+
name: source-packages
51+
path: ./source-packs/*.tgz
52+
53+
diff-dependencies:
54+
name: Diff dependencies
55+
runs-on: ubuntu-latest
56+
needs: [build-base, build-pr]
57+
permissions:
58+
contents: read
59+
pull-requests: write
60+
steps:
61+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
62+
with:
63+
fetch-depth: 0
64+
persist-credentials: false
65+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
66+
with:
67+
name: base-packages
68+
path: ./base-packs
69+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
70+
with:
71+
name: source-packages
72+
path: ./source-packs
73+
- uses: e18e/action-dependency-diff@8e9b8c1957ab066d36235a43f4c1ff1522e1bdbc # v1.6.1
74+
with:
75+
base-packages: './base-packs/*.tgz'
76+
source-packages: './source-packs/*.tgz'
77+
pack-size-threshold: -1
78+
duplicate-threshold: 2

‎.github/workflows/release.yml‎

Lines changed: 71 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,92 @@ on:
44
release:
55
types: [created]
66

7-
permissions:
8-
id-token: write # Required for OIDC provenance attestations
9-
contents: write # Required for pushing version bump commit
7+
permissions: {}
108

119
jobs:
12-
publish-npm:
10+
test:
1311
runs-on: ubuntu-latest
12+
permissions: {}
1413
steps:
1514
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
16-
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
15+
with:
16+
persist-credentials: false
17+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
1718
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
1819
with:
1920
node-version: 24
20-
cache: pnpm
21-
registry-url: https://registry.npmjs.org
21+
package-manager-cache: false
2222
- run: pnpm install --frozen-lockfile
2323
- run: pnpm test
24+
25+
build:
26+
needs: test
27+
runs-on: ubuntu-latest
28+
permissions: {}
29+
steps:
30+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
31+
with:
32+
persist-credentials: false
33+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
34+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
35+
with:
36+
node-version: 24
37+
package-manager-cache: false
38+
- run: pnpm install --frozen-lockfile
2439
- run: pnpm run build
25-
- name: Bump version from release tag
26-
env:
27-
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
28-
run: |
40+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
41+
with:
42+
name: dist
43+
path: dist/
44+
45+
bump-version:
46+
needs: build
47+
runs-on: ubuntu-latest
48+
permissions:
49+
contents: write
50+
steps:
51+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
52+
with:
53+
persist-credentials: true
54+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
55+
- run: |
2956
VERSION=${GITHUB_REF_NAME#v}
3057
pnpm version $VERSION --no-git-tag-version
58+
- name: Commit and push version bump
59+
env:
60+
DEFAULT_BRANCH: main
61+
run: |
3162
git config user.name "github-actions[bot]"
3263
git config user.email "github-actions[bot]@users.noreply.github.com"
3364
git add package.json pnpm-lock.yaml
34-
git commit -m "chore: bump version to $VERSION"
65+
git commit -m "chore: bump version to ${GITHUB_REF_NAME#v}"
3566
git push origin HEAD:$DEFAULT_BRANCH
67+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
68+
with:
69+
name: package-json
70+
path: package.json
71+
72+
publish:
73+
needs: bump-version
74+
runs-on: ubuntu-latest
75+
permissions:
76+
id-token: write # Required for OIDC provenance
77+
steps:
78+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
79+
with:
80+
persist-credentials: false
81+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
82+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
83+
with:
84+
node-version: 24
85+
package-manager-cache: false
86+
registry-url: 'https://registry.npmjs.org'
87+
- run: pnpm install --frozen-lockfile
88+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
89+
with:
90+
name: dist
91+
path: dist/
92+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
93+
with:
94+
name: package-json
3695
- run: pnpm publish --no-git-checks
37-
env:
38-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

‎.github/workflows/test.yml‎

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,80 +14,82 @@ jobs:
1414
name: Unit tests
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
17+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1818
with:
1919
persist-credentials: false
20-
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
21-
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
20+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
21+
- name: Use Node.js
22+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
2223
with:
24+
cache: 'pnpm'
2325
node-version: 24
24-
cache: pnpm
2526
- run: pnpm install --frozen-lockfile
2627
- run: pnpm test
27-
- name: Upload coverage reports to Codecov
28-
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
29-
with:
30-
token: ${{ secrets.CODECOV_TOKEN }}
31-
slug: projectwallace/css-code-quality
3228

3329
check:
3430
name: Check types
3531
runs-on: ubuntu-latest
3632
steps:
37-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
33+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3834
with:
3935
persist-credentials: false
40-
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
41-
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
36+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
37+
- name: Use Node.js
38+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
4239
with:
40+
cache: 'pnpm'
4341
node-version: 24
44-
cache: pnpm
4542
- run: pnpm install --frozen-lockfile
4643
- run: pnpm run check
4744

4845
build:
4946
name: Build
5047
runs-on: ubuntu-latest
5148
steps:
52-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
49+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5350
with:
5451
persist-credentials: false
55-
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
56-
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
52+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
53+
- name: Use Node.js
54+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
5755
with:
56+
cache: 'pnpm'
5857
node-version: 24
59-
cache: pnpm
6058
- run: pnpm install --frozen-lockfile
6159
- run: pnpm run build
6260

6361
lint:
6462
name: Lint
6563
runs-on: ubuntu-latest
6664
steps:
67-
- name: Checkout code
68-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
65+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
6966
with:
7067
persist-credentials: false
71-
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
72-
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
68+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
69+
- name: Use Node.js
70+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
7371
with:
72+
cache: 'pnpm'
7473
node-version: 24
75-
cache: pnpm
7674
- run: pnpm install --frozen-lockfile
7775
- run: pnpm run lint
7876

7977
npm-audit:
8078
name: Audit packages
8179
runs-on: ubuntu-latest
8280
steps:
83-
- name: Checkout code
84-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
81+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
8582
with:
8683
persist-credentials: false
87-
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
88-
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
89-
with:
90-
node-version: 24
91-
cache: pnpm
92-
- run: pnpm install --frozen-lockfile
84+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
9385
- run: pnpm audit --audit-level=high
86+
87+
knip:
88+
name: Lint unused code
89+
runs-on: ubuntu-latest
90+
steps:
91+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
92+
with:
93+
persist-credentials: false
94+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
95+
- run: pnpm run knip

‎.npmrc‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎.oxlintrc.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["./node_modules/@projectwallace/preset-oxlint/index.json"]
3+
}

‎knip.config.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { KnipConfig } from 'knip'
2+
3+
const config: KnipConfig = {
4+
project: ['src/**/*.ts'],
5+
ignoreDependencies: ['@projectwallace/preset-oxlint'],
6+
}
7+
8+
export default config

‎package.json‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,16 @@
4646
"test": "vitest run --coverage",
4747
"build": "tsdown",
4848
"check": "tsc --noEmit",
49-
"lint": "oxlint; oxfmt --check"
49+
"lint": "oxlint; oxfmt --check",
50+
"knip": "knip"
5051
},
5152
"dependencies": {
52-
"@projectwallace/css-analyzer": "^9.8.2"
53+
"@projectwallace/css-analyzer": "^9.9.3"
5354
},
5455
"devDependencies": {
56+
"@projectwallace/preset-oxlint": "^0.0.11",
5557
"@vitest/coverage-v8": "^4.1.2",
58+
"knip": "^6.31.0",
5659
"oxfmt": "^0.61.0",
5760
"oxlint": "^1.58.0",
5861
"publint": "^0.3.18",
@@ -65,10 +68,5 @@
6568
"pnpm": ">=11.0.0"
6669
},
6770
"packageManager": "pnpm@11.1.1",
68-
"pnpm": {
69-
"onlyBuiltDependencies": [
70-
"esbuild"
71-
]
72-
},
7371
"issues": "https://github.com/projectwallace/css-code-quality/issues"
7472
}

0 commit comments

Comments
 (0)