Skip to content

Commit

Permalink
Merge pull request #76 from Contrast-Security-Inc/NODE-3519-retire-pr…
Browse files Browse the repository at this point in the history
…ebuildify-cross

Node 3519 retire prebuildify cross
  • Loading branch information
bmacnaughton authored Jul 22, 2024
2 parents 92cfaa4 + 3778a33 commit aab6912
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 119 deletions.
97 changes: 0 additions & 97 deletions .github/workflows/release-no-prebuildify-cross.yml

This file was deleted.

46 changes: 31 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Release

on:
push:
tags: ['v[0-9]+.[0-9]+.[0-9]+']
on: workflow_dispatch

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -15,12 +13,37 @@ permissions:
contents: read

jobs:
build:
build-linux:
name: Build linux versions
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm ci --ignore-scripts
# build each image inline so the matrix doesn't checkout, install, install each time.
- name: Build alpine
run: docker run --rm -v ${{ github.workspace }}:/repo -u $(id -u) ghcr.io/contrast-security-oss/alpine
- name: Build centos7
run: docker run --rm -v ${{ github.workspace }}:/repo -u $(id -u) ghcr.io/contrast-security-oss/centos7
- name: Build linux-arm64
run: docker run --rm -v ${{ github.workspace }}:/repo -u $(id -u) ghcr.io/contrast-security-oss/linux-arm64
# now upload what was built
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: prebuilds-linux
path: prebuilds/

build-macos-windows:
strategy:
matrix:
include:
- os: ubuntu-latest
build-group: linux
- os: macos-latest
build-group: darwin
- os: windows-latest
Expand All @@ -35,12 +58,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 22
- name: Update npm
run: npm install -g npm@10
# new versions of python don't include distutils. setuptools provides it.
- name: Install setuptools
run: pip install setuptools
- name: Install
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Build
run: npm run build:${{ matrix.build-group }}
Expand All @@ -51,7 +69,7 @@ jobs:
name: prebuilds-${{ matrix.build-group }}
path: prebuilds/
release:
needs: build
needs: [build-linux, build-macos-windows]
name: Release to npm
runs-on: ubuntu-latest
timeout-minutes: 5
Expand All @@ -63,8 +81,6 @@ jobs:
with:
node-version: 22
registry-url: https://registry.npmjs.org
- name: Update npm
run: npm install -g npm@10
- name: Install
run: npm ci --ignore-scripts
- name: Download artifacts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [16, 18, 20, 22.5.1]
node: [16, 18, 20, 22]
os: [ubuntu-latest, macos-latest, windows-latest]
name: Node v${{ matrix.node }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,17 @@ const results = funcInfo(testFn);

## Publishing

Simply run `npm version` and `git push && git push --tags`. The `release` workflow runs when
a tag of the form `v1.2.3` is pushed.
Simply run `npm version` and then invoke the `release` workflow. You can run
`release` using the github UI or, if you have the github CLI installed, you
can run `gh workflow run release.yml` (also available via `npm run release`).

## Temporary code
Note that `upload-artifacts@v4` no longer works when there are multiple
artifacts with the same name. That's why the `release` workflow has the
following section:

Node version 22.5.0 ships with a very broken `npm`. This hardcodes version 22.5.1 until
github actions stops defaulting to 22.5.0 when node version 22 is specified.
```
uses: actions/upload-artifact@v4
with:
name: prebuilds-${{ matrix.build-group }}
path: prebuilds/
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
"prepare": "husky install",
"prebuild": "npm run clean",
"build": "prebuildify -t 16.9.1 -t 18.7.0 -t 20.5.0 -t 22.2.0 --strip --napi false",
"build:linux": "prebuildify-cross -i centos7-devtoolset7 -i alpine -i linux-arm64 -t 16.9.1 -t 18.7.0 -t 20.5.0 -t 22.2.0 --strip --napi false",
"build:darwin": "npm run build -- --arch x64+arm64",
"build:win32": "npm run build",
"clean": "rimraf build/ coverage/ prebuilds/",
"download": "node scripts/download-artifacts.js",
"release": "gh workflow run release.yaml",
"test": "c8 --reporter lcov --reporter text mocha .",
"test:valgrind": "valgrind --xml=yes --xml-file=./valgrind.xml --trace-children=yes --leak-check=full --show-leak-kinds=all mocha . && node scripts/parse-valgrind.js"
},
Expand Down

0 comments on commit aab6912

Please sign in to comment.