Skip to content

Commit f394d41

Browse files
committed
ci: add workflow for type checking
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent e209b21 commit f394d41

2 files changed

Lines changed: 101 additions & 1 deletion

File tree

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Type checking
10+
11+
on:
12+
pull_request:
13+
push:
14+
branches:
15+
- main
16+
- master
17+
- stable*
18+
19+
permissions:
20+
contents: read
21+
22+
concurrency:
23+
group: lint-typescript-${{ github.head_ref || github.run_id }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
changes:
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: read
31+
pull-requests: read
32+
33+
outputs:
34+
src: ${{ steps.changes.outputs.src}}
35+
36+
steps:
37+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
38+
id: changes
39+
continue-on-error: true
40+
with:
41+
filters: |
42+
src:
43+
- '.github/workflows/lint-typescript.yml'
44+
- 'package.json'
45+
- 'package-lock.json'
46+
- 'tsconfig.json'
47+
- '**.ts'
48+
- '**.vue'
49+
50+
test:
51+
runs-on: ubuntu-latest
52+
53+
needs: changes
54+
if: needs.changes.outputs.src != 'false'
55+
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
59+
with:
60+
persist-credentials: false
61+
62+
- name: Read package.json node and npm engines version
63+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
64+
id: versions
65+
with:
66+
fallbackNode: '^20'
67+
fallbackNpm: '^10'
68+
69+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
70+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
71+
with:
72+
node-version: ${{ steps.versions.outputs.nodeVersion }}
73+
74+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
75+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
76+
77+
- name: Install dependencies
78+
env:
79+
CYPRESS_INSTALL_BINARY: 0
80+
run: |
81+
npm ci
82+
83+
- name: Check types
84+
run: |
85+
npm run --if-present check-types
86+
npm run --if-present ts:check
87+
88+
summary:
89+
permissions:
90+
contents: none
91+
runs-on: ubuntu-latest
92+
needs: [changes, test]
93+
94+
if: always()
95+
96+
name: typescript-summary
97+
98+
steps:
99+
- name: Summary status
100+
run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"scripts": {
3232
"build": "vite --mode production build",
3333
"build:doc": "typedoc --out dist/doc lib/index.ts && touch dist/doc/.nojekyll",
34-
"check-types": "tsc --noEmit",
34+
"ts:check": "tsc --noEmit",
3535
"dev": "vite --mode development build",
3636
"l10n:extract": "node build/extract-l10n.js",
3737
"lint": "eslint lib",

0 commit comments

Comments
 (0)