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 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 -w cli
49 - name: Post Lint
50 run: npm run postlint --ignore-scripts -w cli
51 - name: Check Format
52 run: npm run format:check --ignore-scripts --if-present -w cli
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 -w cli