Skip to content

Commit

Permalink
Restore changes in prebuild.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbvaughan committed Jul 10, 2024
1 parent 9f5568b commit 8d399c6
Showing 1 changed file with 75 additions and 31 deletions.
106 changes: 75 additions & 31 deletions .github/workflows/prebuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,49 +48,68 @@ on: workflow_dispatch
jobs:
Linux:
strategy:
fail-fast: false
matrix:
node: [18.12.0, 20.9.0]
canvas_tag: [] # e.g. "v2.6.1"
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, Linux
node: [21]
canvas_tag: ["v3.0.0-rc2"] # e.g. "v2.6.1"
name: ${{ matrix.canvas_tag }}, Node.js ${{ matrix.node }}, Linux
runs-on: ubuntu-latest
container:
image: chearon/canvas-prebuilt:7
image: ${{ matrix.node < 18 && 'chearon/canvas-prebuilt:9' || 'zbbjornson/canvas-prebuilt:11' }}
env:
CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
with:
ref: ${{ matrix.canvas_tag }}

- uses: actions/setup-node@v4
# Use the files in the prebuild/ directory from the commit that was used
# to trigger the prebuild workflow. The version of git that's installed on
# this Linux here doesn't support the method used on Mac and Win, so we
# checkout the prebuild branch and copy the files from the prebuild/
# directory in the Build step.
- uses: actions/checkout@v2
with:
ref: ${{ env.GITHUB_SHA }}
path: prebuild-branch

- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: Build
run: |
set -ex
mkdir -p prebuild
cp -rfv ./prebuild-branch/prebuild/* ./prebuild/
npm install -g node-gyp
npm install --ignore-scripts
. prebuild/Linux/preinstall.sh
cp prebuild/Linux/binding.gyp binding.gyp
node-gyp rebuild -j 2
. prebuild/Linux/bundle.sh
- name: Test binary
continue-on-error: true
run: |
set -ex
cd /root/harfbuzz-* && make uninstall
cd /root/cairo-* && make uninstall
cd /root/pango-* && make uninstall
cd /root/pango-* && cd _build && ninja uninstall
cd /root/libpng-* && make uninstall
cd /root/libjpeg-* && make uninstall
cd /root/libjpeg-* && cd b && make uninstall
cd /root/giflib-* && make uninstall
cd $GITHUB_WORKSPACE && npm test
cd $GITHUB_WORKSPACE
ls build/Release
ldd build/Release/canvas.node
npx mocha test/*.test.js
- name: Make bundle
id: make_bundle
run: . prebuild/tarball.sh

- name: Upload
uses: actions/github-script@0.9.0
uses: actions/github-script@v2
with:
script: |
const fs = require("fs");
Expand Down Expand Up @@ -124,11 +143,11 @@ jobs:
fail-fast: false
matrix:
node: [21]
canvas_tag: ["m1-testing"] # e.g. "v2.6.1"
canvas_tag: ["v3.0.0-rc2"] # e.g. "v2.6.1"
os:
- runner: macos-12
- runner: macos-latest
arch: x64
- runner: macos-14 # GitHub's Apple Silicon runner
- runner: macos-latest-xlarge # GitHub's Apple Silicon runner
arch: arm64
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, macOS ${{ matrix.os.arch }}
runs-on: ${{ matrix.os.runner }}
Expand All @@ -153,15 +172,14 @@ jobs:
git checkout $GITHUB_SHA -- prebuild/
npm install -g node-gyp
npm install --ignore-scripts
npm install nan
. prebuild/macOS/preinstall.sh
cp prebuild/macOS/binding.gyp binding.gyp
node-gyp rebuild -j 2 --arch=${{ matrix.os.arch }}
. prebuild/macOS/bundle.sh
- name: Test binary
run: |
brew uninstall --force --ignore-dependencies cairo pango jpeg libpng librsvg giflib pixman harfbuzz
brew uninstall --force --ignore-dependencies cairo pango jpeg libpng librsvg giflib harfbuzz pixman
npm test
- name: Make bundle
Expand Down Expand Up @@ -200,39 +218,65 @@ jobs:
Win:
strategy:
fail-fast: false
matrix:
node: [18.12.0, 20.9.0]
canvas_tag: [] # e.g. "v2.6.1"
node: [21]
canvas_tag: ["v3.0.0-rc2"] # e.g. "v2.6.1"
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, Windows
runs-on: windows-latest
runs-on: windows-2019
env:
CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
steps:
# TODO drop when https://github.com/actions/virtual-environments/pull/632 lands
- uses: numworks/setup-msys2@v1
# GitHub runners now have msys2 installed, but msys is not on the path and
# is apparently slow to start.
# https://github.com/msys2/setup-msys2#setup-msys2
# https://github.com/actions/virtual-environments/pull/632
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
path-type: inherit

- uses: actions/setup-node@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
ref: ${{ matrix.canvas_tag }}
# Fetch all commits/all branches so we can checkout the prebuild
# branch's files
fetch-depth: 0

- name: Build
run: |
git checkout ${{ matrix.canvas_tag }}
git checkout $env:GITHUB_SHA -- prebuild/
npm install -g node-gyp
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
npm install --ignore-scripts
msys2do . prebuild/Windows/preinstall.sh
msys2do cp prebuild/Windows/binding.gyp binding.gyp
msys2do node-gyp configure
msys2do node-gyp rebuild -j 2
msys2 -c ". prebuild/Windows/preinstall.sh"
msys2 -c "cp prebuild/Windows/binding.gyp binding.gyp"
npm install --build-from-source
- name: Bundle
run: msys2do . prebuild/Windows/bundle.sh
- name: Install Depends
run: |
Invoke-WebRequest "http://www.dependencywalker.com/depends22_x64.zip" -OutFile depends22_x64.zip
7z e depends22_x64.zip
- name: Bundle pt 2
shell: msys2 {0}
run: |
./depends.exe -c -oc depends.csv build\\Release\\canvas.node || true
[ -f depends.csv ] || { echo "error invoking depends.exe"; exit 1; }
copies=$(comm -12 \
<(cat depends.csv | cut -d ',' -f2 | sed 's/"//g' | tr '[:upper:]' '[:lower:]' | sort) \
<(find /ucrt64/bin -name '*.dll' -printf "%f\n" | tr '[:upper:]' '[:lower:]' | sort) \
)
for dll in $copies; do
cp /ucrt64/bin/$dll build/Release
done;
- name: Test binary
# By not running in msys2, this doesn't have access to the msys2 libs
Expand All @@ -241,10 +285,10 @@ jobs:
- name: Make asset
id: make_bundle
# I can't figure out why this isn't an env var already. It shows up with `env`.
run: msys2do UPLOAD_TO=${{ env.UPLOAD_TO }} CANVAS_VERSION_TO_BUILD=${{ env.CANVAS_VERSION_TO_BUILD}} . prebuild/tarball.sh
run: msys2 -c "UPLOAD_TO=${{ env.UPLOAD_TO }} CANVAS_VERSION_TO_BUILD=${{ env.CANVAS_VERSION_TO_BUILD}} . prebuild/tarball.sh"

- name: Upload
uses: actions/github-script@0.9.0
uses: actions/github-script@v2
with:
script: |
const fs = require("fs");
Expand Down

0 comments on commit 8d399c6

Please sign in to comment.