1 # This file is automatically added by @npmcli/template-oss. Do not edit.
2
3 name: CI
4
5 on:
6 workflow_dispatch:
7 pull_request:
8 paths-ignore:
9 - cli/**
10 push:
11 branches:
12 - main
13 paths-ignore:
14 - cli/**
15 schedule:
16 # "At 09:00 UTC (02:00 PT) on Monday" https://crontab.guru/#0_9_*_*_1
17 - cron: "0 9 * * 1"
18
19 permissions:
20 contents: read
21
22 jobs:
23 lint:
24 name: Lint
25 if: github.repository_owner == 'npm'
26 runs-on: ubuntu-latest
27 defaults:
28 run:
29 shell: bash
30 steps:
31 - name: Checkout
32 uses: actions/checkout@v6
33 - name: Setup Git User
34 run: |
35 git config --global user.email "npm-cli+bot@github.com"
36 git config --global user.name "npm CLI robot"
37 - name: Setup Node
38 uses: actions/setup-node@v6
39 id: node
40 with:
41 node-version: 22.x
42 check-latest: contains('22.x', '.x')
43 cache: npm
44 - name: Install Dependencies
45 run: npm i --no-audit --no-fund
46 - name: Lint
47 run: npm run lint --ignore-scripts
48 - name: Post Lint
49 run: npm run postlint --ignore-scripts
50 - name: Check Format
51 run: npm run format:check --ignore-scripts --if-present
52
53 test:
54 name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
55 if: github.repository_owner == 'npm'
56 strategy:
57 fail-fast: false
58 matrix:
59 platform:
60 - name: Linux
61 os: ubuntu-latest
62 shell: bash
63 node-version:
64 - 22.x
65 runs-on: ${{ matrix.platform.os }}
66 defaults:
67 run:
68 shell: ${{ matrix.platform.shell }}
69 steps:
70 - name: Checkout
71 uses: actions/checkout@v6
72 - name: Setup Git User
73 run: |
74 git config --global user.email "npm-cli+bot@github.com"
75 git config --global user.name "npm CLI robot"
76 - name: Setup Node
77 uses: actions/setup-node@v6
78 id: node
79 with:
80 node-version: ${{ matrix.node-version }}
81 check-latest: contains(matrix.node-version, '.x')
82 cache: npm
83 - name: Install Dependencies
84 run: npm i --no-audit --no-fund
85 - name: Add Problem Matcher
86 run: echo "::add-matcher::.github/matchers/tap.json"
87 - name: Test
88 run: npm test --ignore-scripts
89
90 test-cli-content:
91 name: Test CLI Content - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
92 if: github.repository_owner == 'npm'
93 strategy:
94 fail-fast: false
95 matrix:
96 platform:
97 - name: Linux
98 os: ubuntu-latest
99 shell: bash
100 node-version:
101 - 22.x
102 runs-on: ${{ matrix.platform.os }}
103 defaults:
104 run:
105 shell: ${{ matrix.platform.shell }}
106 steps:
107 - name: Checkout
108 uses: actions/checkout@v6
109 - name: Setup Git User
110 run: |
111 git config --global user.email "npm-cli+bot@github.com"
112 git config --global user.name "npm CLI robot"
113 - name: Setup Node
114 uses: actions/setup-node@v6
115 id: node
116 with:
117 node-version: ${{ matrix.node-version }}
118 check-latest: contains(matrix.node-version, '.x')
119 cache: npm
120 - name: Install Dependencies
121 run: npm i --no-audit --no-fund
122 - name: Check CLI Documentation
123 run: npm run build -w cli -- --check-only
124 env:
125 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126
127 licenses:
128 name: REUSE Compliance Check
129 runs-on: ubuntu-latest
130 steps:
131 - uses: actions/checkout@v4
132 - name: REUSE Compliance Check
133 uses: fsfe/reuse-action@v1