Skip to content

Commit

Permalink
[actions] use reusable workflows, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Feb 24, 2024
1 parent fd31ec2 commit c0d8d13
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 94 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/conditions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ jobs:
fail-fast: false
matrix:
node-version:
- '21'
- '20'
- '19'
- '18'

- '17' # ↥ pattern-trailers-no-dir-slash
- '16'

Expand Down Expand Up @@ -75,4 +80,4 @@ jobs:
needs: [conditions]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
- run: true
2 changes: 1 addition & 1 deletion .github/workflows/ls-engines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
needs: [engines-job]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
- run: true
26 changes: 2 additions & 24 deletions .github/workflows/node-pretest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,5 @@ name: 'Tests: pretest/posttest'
on: [pull_request, push]

jobs:
pretest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: 'lts/*'
skip-ls-check: true
- run: npm run pretest

posttest:
if: false
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: 'lts/*'
skip-ls-check: true
- run: npm run posttest
tests:
uses: ljharb/actions/.github/workflows/pretest.yml@main
64 changes: 6 additions & 58 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,9 @@ name: 'Tests: node.js'
on: [pull_request, push]

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
latest: ${{ steps.set-matrix.outputs.requireds }}
minors: ${{ steps.set-matrix.outputs.optionals }}
steps:
- uses: ljharb/actions/node/matrix@main
id: set-matrix
with:
preset: '^18.17.0 || >=20.5.0'
type: 'minors'

latest:
needs: [matrix]
name: 'latest minors'
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.latest) }}

steps:
- uses: actions/checkout@v4
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: ${{ matrix.node-version }}
skip-ls-check: true
- run: npm run tests-only
- uses: codecov/codecov-action@v2

minors:
needs: [matrix, latest]
name: 'non-latest minors'
continue-on-error: true
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.minors) }}

steps:
- uses: actions/checkout@v4
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: ${{ matrix.node-version }}
skip-ls-check: true
- run: npm run tests-only
- uses: codecov/codecov-action@v2

node:
name: 'node 18+'
needs: [latest, minors]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '^18.17.0 || >=20.5.0'
type: minors
command: npm run tests-only
12 changes: 3 additions & 9 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ on: [pull_request_target]

jobs:
_:
name: "Automatic Rebase"

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ljharb/rebase@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ljharb/actions/.github/workflows/rebase.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/require-allow-edits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: ljharb/require-allow-edits@main
- uses: ljharb/require-allow-edits@main

0 comments on commit c0d8d13

Please sign in to comment.