Skip to content

Commit 4763c36

Browse files
committed
[actions] add reusable workflows
- remove ubuntu tests from existing workflow, since they're covered by the new ones.
1 parent 8641572 commit 4763c36

File tree

6 files changed

+180
-15
lines changed

6 files changed

+180
-15
lines changed

.github/workflows/node-aught.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 'Tests: node.js < 10'
2+
3+
on: [pull_request, push]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
tests:
10+
uses: ljharb/actions/.github/workflows/node.yml@main
11+
with:
12+
range: '< 10'
13+
type: minors
14+
command: npm run tests-only
15+
16+
node:
17+
name: 'node < 10'
18+
needs: [tests]
19+
runs-on: ubuntu-latest
20+
steps:
21+
- run: 'echo tests completed'

.github/workflows/node-pretest.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: 'Tests: pretest/posttest'
2+
3+
on: [pull_request, push]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
tests:
10+
uses: ljharb/actions/.github/workflows/pretest.yml@main

.github/workflows/node-tens.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 'Tests: node.js >= 10'
2+
3+
on: [pull_request, push]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
tests:
10+
uses: ljharb/actions/.github/workflows/node.yml@main
11+
with:
12+
range: '>= 10'
13+
type: minors
14+
command: npm run tests-only
15+
16+
node:
17+
name: 'node >= 10'
18+
needs: [tests]
19+
runs-on: ubuntu-latest
20+
steps:
21+
- run: 'echo tests completed'

.github/workflows/nodejs.yml

Lines changed: 88 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,106 @@ name: Node CI
33
on: [push, pull_request]
44

55
jobs:
6-
test:
6+
matrix:
7+
runs-on: ubuntu-latest
8+
outputs:
9+
latest: ${{ steps.set-matrix.outputs.requireds }}
10+
nonlatest: ${{ steps.set-matrix.outputs.optionals }}
11+
steps:
12+
- uses: ljharb/actions/node/matrix@main
13+
id: set-matrix
14+
with:
15+
versionsAsRoot: true
16+
type: majors
17+
preset: ">= 0.8"
18+
19+
latest:
20+
needs: [matrix]
21+
name: 'latest majors'
722
strategy:
23+
fail-fast: false
824
matrix:
9-
os: [ubuntu-latest, windows-latest, macos-latest]
10-
node-version: ['0.8', '0.10', '0.12', '4.x', '6.x', '8.x', '10.x', '12.x']
25+
os: [windows-latest, macos-latest]
26+
node-version: ${{ fromJson(needs.matrix.outputs.latest) }}
1127
exclude:
28+
- os: windows-latest
29+
node-version: '3'
30+
- os: windows-latest
31+
node-version: '2'
32+
- os: windows-latest
33+
node-version: '1'
1234
- os: windows-latest
1335
node-version: '0.8'
1436

1537
runs-on: ${{matrix.os}}
1638

1739
steps:
18-
- uses: actions/checkout@v1
40+
- uses: actions/checkout@v3
41+
42+
- uses: ljharb/actions/node/install@main
43+
name: 'nvm install ${{ matrix.node-version }} && npm install'
44+
with:
45+
node-version: ${{ matrix.node-version }}
46+
skip-ls-check: true
47+
if: matrix.os != 'windows-latest'
48+
1949
- name: Use Node.js ${{ matrix.node-version }}
20-
uses: actions/setup-node@v1
50+
uses: actions/setup-node@v3
2151
with:
2252
node-version: ${{ matrix.node-version }}
23-
- name: Disable strict SSL checks
24-
uses: allenevans/set-env@v1.0.0
53+
if: matrix.os == 'windows-latest'
54+
55+
- run: npm install
56+
env:
57+
NPM_CONFIG_STRICT_SSL: false
58+
if: matrix.os == 'windows-latest'
59+
60+
- run: npm run tests-only
61+
- uses: codecov/codecov-action@v3
62+
63+
nonlatest:
64+
needs: [matrix, latest]
65+
name: 'non-latest majors'
66+
continue-on-error: true
67+
if: ${{ needs.matrix.outputs.nonlatest != '[]' && (!github.head_ref || !startsWith(github.head_ref, 'renovate')) }}
68+
strategy:
69+
fail-fast: false
70+
matrix:
71+
os: [windows-latest, macos-latest]
72+
node-version: ${{ fromJson(needs.matrix.outputs.nonlatest) }}
73+
exclude:
74+
- os: windows-latest
75+
node-version: '0.8'
76+
77+
runs-on: ${{matrix.os}}
78+
79+
steps:
80+
- uses: actions/checkout@v3
81+
82+
- uses: ljharb/actions/node/install@main
83+
name: 'nvm install ${{ matrix.node-version }} && npm install'
2584
with:
26-
NPM_CONFIG_STRICT_SSL: 'false'
27-
if: matrix.node-version == '0.8'
28-
- name: Upgrade npm to latest available version
29-
run: |
30-
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
31-
source $HOME/.nvm/nvm.sh
32-
nvm install-latest-npm
85+
node-version: ${{ matrix.node-version }}
86+
skip-ls-check: true
3387
if: matrix.os != 'windows-latest'
88+
89+
- name: Use Node.js ${{ matrix.node-version }}
90+
uses: actions/setup-node@v3
91+
with:
92+
node-version: ${{ matrix.node-version }}
93+
if: matrix.os == 'windows-latest'
94+
3495
- run: npm install
35-
- run: npm test
96+
env:
97+
NPM_CONFIG_STRICT_SSL: false
98+
if: matrix.os == 'windows-latest'
99+
100+
- run: npm run tests-only
101+
- uses: codecov/codecov-action@v3
102+
103+
node:
104+
name: 'node majors, windows/mac'
105+
needs: [latest, nonlatest]
106+
runs-on: ubuntu-latest
107+
steps:
108+
- run: 'echo tests completed'

.github/workflows/rebase.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Automatic Rebase
2+
3+
on: [pull_request_target]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
_:
10+
permissions:
11+
contents: write # for ljharb/rebase to push code to rebase
12+
pull-requests: read # for ljharb/rebase to get info about PR
13+
14+
name: "Automatic Rebase"
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: ljharb/rebase@master
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Require “Allow Edits”
2+
3+
on: [pull_request_target]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
_:
10+
permissions:
11+
pull-requests: read # for ljharb/require-allow-edits to check 'allow edits' on PR
12+
13+
name: "Require “Allow Edits”"
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: ljharb/require-allow-edits@main

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy