mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-30 13:02:03 -04:00
This patch is intended to lower the maintenance burden of having to manually go through each matrix subjob name in the branch protection repository settings. It allows to only include the check job in the branch protection and it will robustly determine if the dependencies have succeeded or not. It is currently mostly serves the Python ecosystem in projects like aiohttp, cryptography, open edX, pip etc. But I've also seen other communities picking it up lately, like the AWS Rust SDK and even the engine powering https://dev.to, to my surprise. Strictly speaking, it is agnostic. Ref: https://github.com/marketplace/actions/alls-green#why
81 lines
2.0 KiB
YAML
81 lines
2.0 KiB
YAML
name: CI
|
|
|
|
on: [push, pull_request]
|
|
|
|
permissions:
|
|
contents: read # to fetch code (actions/checkout)
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node:
|
|
- '14.6'
|
|
- '16'
|
|
- '18'
|
|
- '19'
|
|
platform:
|
|
- ubuntu-latest
|
|
- windows-latest
|
|
|
|
name: '${{matrix.platform}} / Node.js ${{ matrix.node }}'
|
|
runs-on: ${{matrix.platform}}
|
|
|
|
steps:
|
|
- name: Configure Git
|
|
run: |
|
|
git config --global core.autocrlf false
|
|
git config --global user.name "xyz"
|
|
git config --global user.email "x@y.z"
|
|
- name: Checkout Commit
|
|
uses: actions/checkout@v3
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2.2.4
|
|
with:
|
|
version: next-7
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
cache: 'pnpm'
|
|
- name: Install npm@7
|
|
run: npm add --global npm@7
|
|
- name: pnpm install
|
|
run: pnpm install
|
|
- name: Audit
|
|
run: pnpm audit
|
|
- name: Cache TypeScript and Jest
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
packages/*/lib
|
|
packages/*/tsconfig.tsbuildinfo
|
|
privatePackages/*/lib
|
|
privatePackages/*/tsconfig.tsbuildinfo
|
|
.jest-cache
|
|
.verdaccio-cache
|
|
key: ts-jest-${{ matrix.platform }}-${{ matrix.node }}-${{ github.run_id }}
|
|
restore-keys: ts-jest-${{ matrix.platform }}-${{ matrix.node }}-
|
|
- name: run tests (main)
|
|
if: github.ref == 'refs/heads/main'
|
|
run: pnpm run test-main
|
|
- name: run tests (branch)
|
|
if: github.ref != 'refs/heads/main'
|
|
run: pnpm run test-branch
|
|
|
|
# https://github.com/marketplace/actions/alls-green#why
|
|
check: # This job does nothing and is only used for the branch protection
|
|
if: always()
|
|
|
|
needs:
|
|
- build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Decide whether the needed jobs succeeded or failed
|
|
uses: re-actors/alls-green@release/v1
|
|
with:
|
|
jobs: ${{ toJSON(needs) }}
|