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@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 --workspace cli
52 - name: Post Lint
53 run: npm run postlint --ignore-scripts --workspace cli
54 - name: Check Format
55 run: npm run format:check --ignore-scripts --if-present --workspace cli
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 --workspace cli