Skip to content

Commit

Permalink
here i go with win
Browse files Browse the repository at this point in the history
  • Loading branch information
chearon committed Mar 21, 2023
1 parent fad7d1d commit 5e1b7b7
Showing 1 changed file with 70 additions and 68 deletions.
138 changes: 70 additions & 68 deletions .github/workflows/prebuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,84 +138,84 @@ jobs:
# data: fs.readFileSync(assetName)
# });

macOS:
strategy:
fail-fast: false
matrix:
node: [13, 14, 15, 16, 17, 18, 19]
canvas_tag: ["v2.11.1"] # e.g. "v2.6.1"
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, macOS
runs-on: macos-latest
env:
CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ matrix.canvas_tag }}
# Fetch all commits/all branches so we can checkout the prebuild
# branch's files
fetch-depth: 0
#macOS:
# strategy:
# fail-fast: false
# matrix:
# node: [13, 14, 15, 16, 17, 18, 19]
# canvas_tag: ["v2.11.1"] # e.g. "v2.6.1"
# name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, macOS
# runs-on: macos-latest
# env:
# CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
# steps:
# - uses: actions/checkout@v2
# with:
# ref: ${{ matrix.canvas_tag }}
# # Fetch all commits/all branches so we can checkout the prebuild
# # branch's files
# fetch-depth: 0

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

- name: Build
run: |
set -Eeuxo pipefail
git checkout ${{ matrix.canvas_tag }}
git checkout $GITHUB_SHA -- prebuild/
npm install -g node-gyp
npm install --ignore-scripts
. prebuild/macOS/preinstall.sh
cp prebuild/macOS/binding.gyp binding.gyp
node-gyp rebuild -j 2
. prebuild/macOS/bundle.sh
# - name: Build
# run: |
# set -Eeuxo pipefail
# git checkout ${{ matrix.canvas_tag }}
# git checkout $GITHUB_SHA -- prebuild/
# npm install -g node-gyp
# npm install --ignore-scripts
# . prebuild/macOS/preinstall.sh
# cp prebuild/macOS/binding.gyp binding.gyp
# node-gyp rebuild -j 2
# . prebuild/macOS/bundle.sh

- name: Test binary
run: |
brew uninstall --force --ignore-dependencies cairo pango librsvg giflib harfbuzz
npm test
# - name: Test binary
# run: |
# brew uninstall --force --ignore-dependencies cairo pango librsvg giflib harfbuzz
# npm test

- name: Make bundle
id: make_bundle
run: . prebuild/tarball.sh
# - name: Make bundle
# id: make_bundle
# run: . prebuild/tarball.sh

- name: Upload
uses: actions/github-script@v2
with:
script: |
const fs = require("fs");
const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");
# - name: Upload
# uses: actions/github-script@v2
# with:
# script: |
# const fs = require("fs");
# const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
# const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
# const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");

const releases = await github.repos.listReleases({owner, repo});
const release = releases.data.find(r => r.tag_name === tagName);
if (!release)
throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);
# const releases = await github.repos.listReleases({owner, repo});
# const release = releases.data.find(r => r.tag_name === tagName);
# if (!release)
# throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);

const oldAsset = release.assets.find(a => a.name === assetName);
if (oldAsset)
await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});
# const oldAsset = release.assets.find(a => a.name === assetName);
# if (oldAsset)
# await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});

// (This is equivalent to actions/upload-release-asset. We're
// already in a script, so might as well do it here.)
const r = await github.repos.uploadReleaseAsset({
url: release.upload_url,
headers: {
"content-type": "application/x-gzip",
"content-length": `${fs.statSync(assetName).size}`
},
name: assetName,
data: fs.readFileSync(assetName)
});
# // (This is equivalent to actions/upload-release-asset. We're
# // already in a script, so might as well do it here.)
# const r = await github.repos.uploadReleaseAsset({
# url: release.upload_url,
# headers: {
# "content-type": "application/x-gzip",
# "content-length": `${fs.statSync(assetName).size}`
# },
# name: assetName,
# data: fs.readFileSync(assetName)
# });

Win:
strategy:
fail-fast: false
matrix:
node: [8]
node: [12]
canvas_tag: ["v2.11.1"] # e.g. "v2.6.1"
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, Windows
runs-on: windows-2019
Expand All @@ -242,15 +242,17 @@ jobs:
# branch's files
fetch-depth: 0

- name: Build
- name: Preinstall
run: |
git checkout ${{ matrix.canvas_tag }}
git checkout $env:GITHUB_SHA -- prebuild/
npm install -g node-gyp@6
npm install -g node-gyp
npm install --ignore-scripts
msys2 -c ". prebuild/Windows/preinstall.sh"
msys2 -c "cp prebuild/Windows/binding.gyp binding.gyp"
msys2 -c "node-gyp rebuild -j 2"
- name: Build
run: |
npm install --build-from-source
- name: Install Depends
run: |
Expand Down

0 comments on commit 5e1b7b7

Please sign in to comment.