Skip to content

Commit 3d69120

Browse files
authored
chore: fix and enhance/align workflows (#795)
* chore: fix and enhance/align workflows * fix: action needs to be named action.yaml * fix: default value and nodejs versions
1 parent 47c2aee commit 3d69120

File tree

9 files changed

+163
-124
lines changed

9 files changed

+163
-124
lines changed

.github/actions/setup/action.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Setup
2+
description: Setup the environment for the project
3+
4+
inputs:
5+
node-version:
6+
description: Node.js version
7+
required: false
8+
9+
install-deps:
10+
description: Whether to install dependencies
11+
default: 'true'
12+
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Install Node.js
17+
uses: actions/setup-node@v6
18+
with:
19+
node-version-file: ${{ !inputs.node-version && '.node-version' || '' }}
20+
node-version: ${{ inputs.node-version }}
21+
registry-url: https://registry.npmjs.org/
22+
23+
- name: Install pnpm
24+
uses: pnpm/action-setup@v4
25+
26+
- name: Get pnpm store directory
27+
id: pnpm-cache-dir
28+
shell: bash
29+
run: echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT
30+
31+
- name: Setup pnpm cache
32+
uses: actions/cache@v4
33+
with:
34+
path: ${{ steps.pnpm-cache-dir.outputs.dir }}
35+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
36+
restore-keys: |
37+
${{ runner.os }}-pnpm-store-
38+
39+
- name: Install dependencies
40+
if: ${{ inputs.install-deps }}
41+
shell: bash
42+
run: pnpm install

.github/workflows/ci.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
lint:
17+
name: Lint
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v5
22+
23+
- name: Setup
24+
uses: ./.github/actions/setup
25+
26+
- name: Format
27+
run: pnpm format
28+
29+
- name: Typecheck
30+
run: pnpm typecheck
31+
32+
- name: Lint code
33+
run: pnpm lint:js
34+
35+
### Temporarily disabled, see https://github.com/vitest-dev/eslint-plugin-vitest/issues/754
36+
#- name: Lint docs
37+
# run: pnpm lint:eslint-docs
38+
39+
test:
40+
name: Test (Node.js ${{ matrix.node-version }}, ${{ matrix.os.name }})
41+
runs-on: ${{ matrix.os.version }}
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
node-version:
46+
- 22
47+
- 24
48+
os:
49+
- name: Ubuntu
50+
version: ubuntu-latest
51+
- name: Windows
52+
version: windows-latest
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v5
56+
57+
- name: Setup
58+
uses: ./.github/actions/setup
59+
with:
60+
node-version: ${{ matrix.node-version }}
61+
62+
- name: Test
63+
run: pnpm test

.github/workflows/ci.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
gh-release:
10+
name: Create GitHub Release
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v5
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Setup
21+
uses: ./.github/actions/setup
22+
with:
23+
install-deps: false
24+
25+
- run: pnpx conventional-github-releaser -p angular
26+
env:
27+
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/release.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/smoke-test.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Smoke Test
2+
3+
on:
4+
workflow_dispatch: # Manual trigger
5+
schedule: # Every sunday at 00:00
6+
- cron: '0 00 * * SUN'
7+
8+
jobs:
9+
test:
10+
name: Smoke Test
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v5
15+
16+
- name: Setup
17+
uses: ./.github/actions/setup
18+
with:
19+
node-version: 18
20+
21+
- name: Build
22+
run: pnpm build
23+
24+
- name: Smoke test
25+
uses: AriPerkkio/eslint-remote-tester-run-action@v5
26+
with:
27+
issue-title: 'Results of weekly scheduled smoke test'
28+
eslint-remote-tester-config: eslint-remote-tester.config.ts

.github/workflows/smoke-test.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@
3131
"build": "tsdown --format esm --format cjs",
3232
"typecheck": "tsc --noEmit",
3333
"lint:eslint-docs": "pnpm build && eslint-doc-generator --check",
34-
"lint:js": "eslint .",
34+
"lint:js": "eslint",
3535
"lint": "concurrently --prefixColors auto \"pnpm:lint:*\"",
3636
"release": "bumpp package.json --commit --push --tag && pnpm build && pnpm publish",
3737
"stub": "unbuild --stub",
38-
"test:ci": "npm run format:check && vitest run",
39-
"format:check": "npx prettier 'src/**/*.ts' --check",
40-
"format:fix": "npx prettier '**/*.{ts,js}' --write",
38+
"format": "prettier 'src/**/*.{ts,js}' --check",
4139
"test": "vitest",
4240
"update:eslint-docs": "pnpm build && eslint-doc-generator"
4341
},

0 commit comments

Comments
 (0)