-
Notifications
You must be signed in to change notification settings - Fork 16
68 lines (63 loc) · 1.79 KB
/
Copy pathtest-lts-matrix.yaml
File metadata and controls
68 lines (63 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: 'test:lts-matrix'
on:
workflow_dispatch:
inputs:
testUnit:
description: 'Units'
type: choice
options:
- skip
- test
- test-with-coverage
default: test
testIntegration:
description: 'Integrations'
type: choice
options:
- skip
- test
default: test
workflow_call:
inputs:
testUnit:
type: string
default: test
testIntegration:
type: string
default: test
jobs:
ltsVersions:
name: 'LTS Versions'
runs-on: ubuntu-latest
outputs:
nodeVersions: ${{ steps.nodeVersions.outputs.result }}
steps:
- uses: actions/github-script@v9.0.0
id: nodeVersions
with:
script: |
const isNowWithin = (a, b) => {
const toDateNumber = date => Number(date.split('-').join(''));
const now = toDateNumber(new Date().toISOString().split('T')[0]);
return toDateNumber(a) <= now && now <= toDateNumber(b);
}
const allVersions = await fetch('https://endoflife.date/api/node.json').then(r => r.json());
const version = allVersions.filter(v => v.lts).filter(v => isNowWithin(v.lts, v.eol)).map(v => v.cycle)
return ['*', ...version]
test-full:
needs:
- ltsVersions
strategy:
matrix:
runsOn:
- ubuntu-latest
- macos-latest
- windows-latest
nodeVersion: ${{ fromJson(needs.ltsVersions.outputs.nodeVersions) }}
uses: ./.github/workflows/test-run.yaml
with:
nodeVersion: ${{ matrix.nodeVersion }}
runsOn: ${{ matrix.runsOn }}
testUnit: ${{ inputs.testUnit }}
testIntegration: ${{ inputs.testIntegration }}
secrets: inherit