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