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@v4
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@v4
39 id: node
40 with:
41 node-version: 22.x
42 check-latest: contains('22.x', '.x')
43 cache: npm
44 - name: Install Latest npm
45 uses: ./.github/actions/install-latest-npm
46 with:
47 node: ${{ steps.node.outputs.node-version }}
48 - name: Install Dependencies
49 run: npm i --no-audit --no-fund
50 - name: Lint
51 run: npm run lint --ignore-scripts
52 - name: Post Lint
53 run: npm run postlint --ignore-scripts
54 - name: Check Format
55 run: npm run format:check --ignore-scripts --if-present
56
57 test:
58 name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
59 if: github.repository_owner == 'npm'
60 strategy:
61 fail-fast: false
62 matrix:
63 platform:
64 - name: Linux
65 os: ubuntu-latest
66 shell: bash
67 node-version:
68 - 22.x
69 runs-on: ${{ matrix.platform.os }}
70 defaults:
71 run:
72 shell: ${{ matrix.platform.shell }}
73 steps:
74 - name: Checkout
75 uses: actions/checkout@v4
76 - name: Setup Git User
77 run: |
78 git config --global user.email "npm-cli+bot@github.com"
79 git config --global user.name "npm CLI robot"
80 - name: Setup Node
81 uses: actions/setup-node@v4
82 id: node
83 with:
84 node-version: ${{ matrix.node-version }}
85 check-latest: contains(matrix.node-version, '.x')
86 cache: npm
87 - name: Install Latest npm
88 uses: ./.github/actions/install-latest-npm
89 with:
90 node: ${{ steps.node.outputs.node-version }}
91 - name: Install Dependencies
92 run: npm i --no-audit --no-fund
93 - name: Add Problem Matcher
94 run: echo "::add-matcher::.github/matchers/tap.json"
95 - name: Test
96 run: npm test --ignore-scripts
97
98 test-cli-content:
99 name: Test CLI Content - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
100 if: github.repository_owner == 'npm'
101 strategy:
102 fail-fast: false
103 matrix:
104 platform:
105 - name: Linux
106 os: ubuntu-latest
107 shell: bash
108 node-version:
109 - 22.x
110 runs-on: ${{ matrix.platform.os }}
111 defaults:
112 run:
113 shell: ${{ matrix.platform.shell }}
114 steps:
115 - name: Checkout
116 uses: actions/checkout@v4
117 - name: Setup Git User
118 run: |
119 git config --global user.email "npm-cli+bot@github.com"
120 git config --global user.name "npm CLI robot"
121 - name: Setup Node
122 uses: actions/setup-node@v4
123 id: node
124 with:
125 node-version: ${{ matrix.node-version }}
126 check-latest: contains(matrix.node-version, '.x')
127 cache: npm
128 - name: Install Latest npm
129 uses: ./.github/actions/install-latest-npm
130 with:
131 node: ${{ steps.node.outputs.node-version }}
132 - name: Install Dependencies
133 run: npm i --no-audit --no-fund
134 - name: Check CLI Documentation
135 run: npm run build -w cli -- --check-only
136 env:
137 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138
139 licenses:
140 name: REUSE Compliance Check
141 runs-on: ubuntu-latest
142 steps:
143 - uses: actions/checkout@v4
144 - name: REUSE Compliance Check
145 uses: fsfe/reuse-action@v1