Skip to content

Commit

Permalink
ci: update to shared
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Apr 8, 2024
1 parent 8d5b0ad commit 54dbc14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 82 deletions.
84 changes: 7 additions & 77 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on: [push]
on: [push, pull_request]

env:
CI: true
Expand All @@ -13,80 +13,10 @@ jobs:
uses: haraka/.github/.github/workflows/coverage.yml@master
secrets: inherit

test:
needs: [lint, get-lts]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: ${{ fromJson(needs.get-lts.outputs.active) }}
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
name: Node ${{ matrix.node-version }} on ${{ matrix.os }}
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
ubuntu:
needs: [lint]
uses: haraka/.github/.github/workflows/ubuntu.yml@master

test-win-latest:
needs: [lint, get-lts]

# no docker/images support on Windows (currently), so run w/o Redis
# also, stack run commands so test doesn't begin before install completes
runs-on: windows-latest
strategy:
matrix:
node-version: ${{ fromJson(needs.get-lts.outputs.active) }}
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
with:
node-version: ${{ matrix.node-version }}

# Needed for Node 14 on Windows 2022 (which uses Visual Studio 2022)
# The default node-gyp installed with Node 14 doesn't recognize VS 2022
# Remove this when Node 14 support is dropped (2023-04-30)
- name: Update npm
if: matrix.node-version == 14
run: npm install -g npm

# To address a node-gyp install issues in Windows starting in Node 16
# This should be temporary and hopefully should be removed in the future
- name: Install node-gyp (temp workaround)
run: npx node-gyp@^9.0.0 install
- run: npm install
- run: npm run test

test-win-2019:
needs: [test-win-latest, get-lts]
runs-on: windows-2019
strategy:
matrix:
node-version: ${{ fromJson(needs.get-lts.outputs.active) }}
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
with:
node-version: ${{ matrix.node-version }}
- name: Update npm
if: matrix.node-version == 14
run: npm install -g npm
- name: Install node-gyp (temp workaround)
run: npx node-gyp@^9.0.0 install
- run: npm install
- run: npm run test

get-lts:
runs-on: ubuntu-latest
steps:
- id: get
uses: msimerson/node-lts-versions@v1
outputs:
active: ${{ steps.get.outputs.active }}
lts: ${{ steps.get.outputs.lts }}
windows:
needs: [lint]
uses: haraka/.github/.github/workflows/windows.yml@master
10 changes: 5 additions & 5 deletions test/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ describe('header', function () {
'🧡You can get a date with me if you seek a beautiful companion.💞',
);

console.log(process.version)
console.log(process.version.substring(1))
console.log((undefined ?? process.version.substring(1)).split('.'))
console.log(utils.node_min('20.11.0'))
console.log(utils.node_min('20.11.0', '18.20.0'))
console.log(process.version);
console.log(process.version.substring(1));
console.log((undefined ?? process.version.substring(1)).split('.'));
console.log(utils.node_min('20.11.0'));
console.log(utils.node_min('20.11.0', '18.20.0'));
/*
// RegExp 'v' flag requires ES2024 (node 20.11+)
if (utils.node_min('20.11.0')) {
Expand Down

0 comments on commit 54dbc14

Please sign in to comment.