1 # This file is automatically added by @npmcli/template-oss. Do not edit.
2
3 name: CI - cli
4
5 on:
6 workflow_dispatch:
7 pull_request:
8 paths:
9 - cli/**
10 push:
11 branches:
12 - main
13 paths:
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 --workspace cli
48 - name: Post Lint
49 run: npm run postlint --ignore-scripts --workspace cli
50 - name: Check Format
51 run: npm run format:check --ignore-scripts --if-present --workspace cli
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: Test (with coverage on Node >= 24)
86 if: ${{ startsWith(matrix.node-version, '24') }}
87 run: npm run test:cover --ignore-scripts --workspace cli
88 - name: Test (without coverage on Node < 24)
89 if: ${{ !startsWith(matrix.node-version, '24') }}
90 run: npm test --ignore-scripts --workspace cli