Skip to content

Commit

Permalink
feat: use macos-(latest|13) based on node version (#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys authored May 2, 2024
1 parent 732dddc commit 21c9262
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ jobs:
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
Expand All @@ -89,6 +92,17 @@ jobs:
- 20.5.0
- 20.x
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 18.17.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 18.x
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.5.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.x
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: ${{ matrix.platform.os }}
defaults:
run:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/ci-test-workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ jobs:
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
Expand All @@ -70,6 +73,17 @@ jobs:
- 20.5.0
- 20.x
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 18.17.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 18.x
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.5.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.x
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: ${{ matrix.platform.os }}
defaults:
run:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ jobs:
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
Expand All @@ -70,6 +73,17 @@ jobs:
- 20.5.0
- 20.x
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 18.17.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 18.x
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.5.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.x
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: ${{ matrix.platform.os }}
defaults:
run:
Expand Down
10 changes: 10 additions & 0 deletions lib/content/_job-matrix-yml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ strategy:
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
{{/if}}
{{#if windowsCI}}
- name: Windows
Expand All @@ -21,6 +24,13 @@ strategy:
{{#each ciVersions}}
- {{ . }}
{{/each}}
{{#if macCI}}
exclude:
{{#each ciVersions}}
- platform: {name: macOS, os: macos-{{#if (lte (semverRangeMajor .) 14)}}latest{{else}}13{{/if}}, shell: bash}
node-version: {{ . }}
{{/each}}
{{/if}}
runs-on: $\{{ matrix.platform.os }}
defaults:
run:
Expand Down
3 changes: 3 additions & 0 deletions lib/util/template.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const Handlebars = require('handlebars')
const { basename, extname, join } = require('path')
const { Range } = require('semver')
const fs = require('fs')
const DELETE = '__DELETE__'

Expand Down Expand Up @@ -39,6 +40,8 @@ const setupHandlebars = (dirs) => {
Handlebars.registerHelper('last', (arr) => arr[arr.length - 1])
Handlebars.registerHelper('json', (c) => JSON.stringify(c))
Handlebars.registerHelper('del', () => JSON.stringify(DELETE))
Handlebars.registerHelper('semverRangeMajor', (v) => new Range(v).set[0][0].semver.major)
Handlebars.registerHelper('lte', (a, b) => a <= b)

if (Array.isArray(dirs)) {
const [baseDir, ...otherDirs] = dirs
Expand Down
54 changes: 54 additions & 0 deletions tap-snapshots/test/apply/source-snapshots.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -471,11 +471,17 @@ jobs:
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
node-version:
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: \${{ matrix.platform.os }}
defaults:
run:
Expand Down Expand Up @@ -584,11 +590,17 @@ jobs:
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
node-version:
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: \${{ matrix.platform.os }}
defaults:
run:
Expand Down Expand Up @@ -1878,11 +1890,17 @@ jobs:
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
node-version:
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: \${{ matrix.platform.os }}
defaults:
run:
Expand Down Expand Up @@ -1978,11 +1996,17 @@ jobs:
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
node-version:
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: \${{ matrix.platform.os }}
defaults:
run:
Expand Down Expand Up @@ -2095,11 +2119,17 @@ jobs:
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
node-version:
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: \${{ matrix.platform.os }}
defaults:
run:
Expand Down Expand Up @@ -2214,11 +2244,17 @@ jobs:
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
node-version:
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: \${{ matrix.platform.os }}
defaults:
run:
Expand Down Expand Up @@ -3525,11 +3561,17 @@ jobs:
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
node-version:
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: \${{ matrix.platform.os }}
defaults:
run:
Expand Down Expand Up @@ -3625,11 +3667,17 @@ jobs:
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
node-version:
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: \${{ matrix.platform.os }}
defaults:
run:
Expand Down Expand Up @@ -3742,11 +3790,17 @@ jobs:
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
- name: Windows
os: windows-latest
shell: cmd
node-version:
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: \${{ matrix.platform.os }}
defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion tap-snapshots/test/check/diff-snapshots.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ The repo file ci.yml needs to be updated:
.github/workflows/ci.yml
========================================
@@ -77,4 +77,24 @@
@@ -97,4 +97,24 @@
shell: \${{ matrix.platform.shell }}
steps:
- name: Checkout
Expand Down

0 comments on commit 21c9262

Please sign in to comment.