Skip to content

Commit 6fb4bb4

Browse files
committed
Merge remote-tracking branch 'Automattic/master' into FbDev
# Conflicts: # .travis.yml # package.json # test/canvas.test.js # test/image.test.js
2 parents fdf14bc + 41d1c99 commit 6fb4bb4

32 files changed

+982
-116
lines changed

.github/workflows/ci.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Test
2+
on:
3+
push:
4+
paths-ignore:
5+
- ".github/workflows/prebuild.yaml"
6+
pull_request:
7+
paths-ignore:
8+
- ".github/workflows/prebuild.yaml"
9+
10+
11+
jobs:
12+
Linux:
13+
name: Test on Linux
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
node: [10, 12, 14]
18+
steps:
19+
- uses: actions/setup-node@v1
20+
with:
21+
node-version: ${{ matrix.node }}
22+
- uses: actions/checkout@v2
23+
- name: Install Dependencies
24+
run: |
25+
sudo apt update
26+
sudo apt install -y libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev librsvg2-dev
27+
- name: Install
28+
run: npm install --build-from-source
29+
- name: Test
30+
run: npm test
31+
32+
Windows:
33+
name: Test on Windows
34+
runs-on: windows-latest
35+
strategy:
36+
matrix:
37+
node: [10, 12, 14]
38+
steps:
39+
- uses: actions/setup-node@v1
40+
with:
41+
node-version: ${{ matrix.node }}
42+
- uses: actions/checkout@v2
43+
- name: Install Dependencies
44+
run: |
45+
Invoke-WebRequest "http://ftp.gnome.org/pub/GNOME/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip" -OutFile "gtk.zip"
46+
Expand-Archive gtk.zip -DestinationPath "C:\GTK"
47+
Invoke-WebRequest "https://downloads.sourceforge.net/project/libjpeg-turbo/2.0.4/libjpeg-turbo-2.0.4-vc64.exe" -OutFile "libjpeg.exe" -UserAgent NativeHost
48+
.\libjpeg.exe /S
49+
- name: Install
50+
run: npm install --build-from-source
51+
- name: Test
52+
run: npm test
53+
54+
macOS:
55+
name: Test on macOS
56+
runs-on: macos-latest
57+
strategy:
58+
matrix:
59+
node: [10, 12, 14]
60+
steps:
61+
- uses: actions/setup-node@v1
62+
with:
63+
node-version: ${{ matrix.node }}
64+
- uses: actions/checkout@v2
65+
- name: Install Dependencies
66+
run: |
67+
brew update
68+
brew install pkg-config cairo pango libpng jpeg giflib librsvg
69+
- name: Install
70+
run: npm install --build-from-source
71+
- name: Test
72+
run: npm test
73+
74+
Lint:
75+
name: Lint
76+
runs-on: ubuntu-latest
77+
steps:
78+
- uses: actions/setup-node@v1
79+
with:
80+
node-version: 12
81+
- uses: actions/checkout@v2
82+
- name: Install
83+
run: npm install --ignore-scripts
84+
- name: Lint
85+
run: npm run lint
86+
- name: Lint Types
87+
run: npm run dtslint

.github/workflows/prebuild.yaml

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
# Triggering prebuilds:
2+
# 1. Create a draft release manually using the GitHub UI.
3+
# 2. Set the `jobs.*.strategy.matrix.node` arrays to the set of Node.js versions
4+
# to build for.
5+
# 3. Set the `jobs.*.strategy.matrix.canvas_tag` arrays to the set of Canvas
6+
# tags to build. (Usually this is a single tag, but can be an array when a
7+
# new version of Node.js is released and older versions of Canvas need to be
8+
# built.)
9+
# 4. Commit and push this file to master.
10+
# 5. In the Actions tab, navigate to the "Make Prebuilds" workflow and click
11+
# "Run workflow".
12+
# 6. Once the builds succeed, promote the draft release to a full release.
13+
14+
name: Make Prebuilds
15+
on: workflow_dispatch
16+
17+
# UPLOAD_TO can be specified to upload the release assets under a different tag
18+
# name (e.g. for testing). If omitted, the assets are published under the same
19+
# release tag as the canvas version being built.
20+
# env:
21+
# UPLOAD_TO: "v0.0.1"
22+
23+
jobs:
24+
Linux:
25+
strategy:
26+
matrix:
27+
node: [8, 9, 10, 11, 12, 13, 14]
28+
canvas_tag: [] # e.g. "v2.6.1"
29+
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, Linux
30+
runs-on: ubuntu-latest
31+
container:
32+
image: chearon/canvas-prebuilt:7
33+
env:
34+
CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
35+
steps:
36+
- uses: actions/checkout@v2
37+
with:
38+
ref: ${{ matrix.canvas_tag }}
39+
40+
- uses: actions/setup-node@v1
41+
with:
42+
node-version: ${{ matrix.node }}
43+
44+
- name: Build
45+
run: |
46+
npm install -g node-gyp
47+
npm install --ignore-scripts
48+
. prebuild/Linux/preinstall.sh
49+
cp prebuild/Linux/binding.gyp binding.gyp
50+
node-gyp rebuild -j 2
51+
. prebuild/Linux/bundle.sh
52+
53+
- name: Test binary
54+
run: |
55+
cd /root/harfbuzz-* && make uninstall
56+
cd /root/cairo-* && make uninstall
57+
cd /root/pango-* && make uninstall
58+
cd /root/libpng-* && make uninstall
59+
cd /root/libjpeg-* && make uninstall
60+
cd /root/giflib-* && make uninstall
61+
cd $GITHUB_WORKSPACE && npm test
62+
63+
- name: Make bundle
64+
id: make_bundle
65+
run: . prebuild/tarball.sh
66+
67+
- name: Upload
68+
uses: actions/[email protected]
69+
with:
70+
script: |
71+
const fs = require("fs");
72+
const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
73+
const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
74+
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");
75+
76+
const releases = await github.repos.listReleases({owner, repo});
77+
const release = releases.data.find(r => r.tag_name === tagName);
78+
if (!release)
79+
throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);
80+
81+
const oldAsset = release.assets.find(a => a.name === assetName);
82+
if (oldAsset)
83+
await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});
84+
85+
// (This is equivalent to actions/upload-release-asset. We're
86+
// already in a script, so might as well do it here.)
87+
const r = await github.repos.uploadReleaseAsset({
88+
url: release.upload_url,
89+
headers: {
90+
"content-type": "application/x-gzip",
91+
"content-length": `${fs.statSync(assetName).size}`
92+
},
93+
name: assetName,
94+
data: fs.readFileSync(assetName)
95+
});
96+
97+
macOS:
98+
strategy:
99+
matrix:
100+
node: [8, 9, 10, 11, 12, 13, 14]
101+
canvas_tag: [] # e.g. "v2.6.1"
102+
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, macOS
103+
runs-on: macos-latest
104+
env:
105+
CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
106+
steps:
107+
- uses: actions/checkout@v2
108+
with:
109+
ref: ${{ matrix.canvas_tag }}
110+
111+
- uses: actions/setup-node@v1
112+
with:
113+
node-version: ${{ matrix.node }}
114+
115+
- name: Build
116+
run: |
117+
npm install -g node-gyp
118+
npm install --ignore-scripts
119+
. prebuild/macOS/preinstall.sh
120+
cp prebuild/macOS/binding.gyp binding.gyp
121+
node-gyp rebuild -j 2
122+
. prebuild/macOS/bundle.sh
123+
124+
- name: Test binary
125+
run: |
126+
brew uninstall --force cairo pango librsvg giflib harfbuzz
127+
npm test
128+
129+
- name: Make bundle
130+
id: make_bundle
131+
run: . prebuild/tarball.sh
132+
133+
- name: Upload
134+
uses: actions/[email protected]
135+
with:
136+
script: |
137+
const fs = require("fs");
138+
const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
139+
const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
140+
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");
141+
142+
const releases = await github.repos.listReleases({owner, repo});
143+
const release = releases.data.find(r => r.tag_name === tagName);
144+
if (!release)
145+
throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);
146+
147+
const oldAsset = release.assets.find(a => a.name === assetName);
148+
if (oldAsset)
149+
await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});
150+
151+
// (This is equivalent to actions/upload-release-asset. We're
152+
// already in a script, so might as well do it here.)
153+
const r = await github.repos.uploadReleaseAsset({
154+
url: release.upload_url,
155+
headers: {
156+
"content-type": "application/x-gzip",
157+
"content-length": `${fs.statSync(assetName).size}`
158+
},
159+
name: assetName,
160+
data: fs.readFileSync(assetName)
161+
});
162+
163+
Win:
164+
strategy:
165+
matrix:
166+
node: [8, 9, 10, 11, 12, 13, 14]
167+
canvas_tag: [] # e.g. "v2.6.1"
168+
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, Windows
169+
runs-on: windows-latest
170+
env:
171+
CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
172+
steps:
173+
# TODO drop when https://github.com/actions/virtual-environments/pull/632 lands
174+
- uses: numworks/setup-msys2@v1
175+
with:
176+
update: true
177+
path-type: inherit
178+
179+
- uses: actions/setup-node@v1
180+
with:
181+
node-version: ${{ matrix.node }}
182+
183+
- uses: actions/checkout@v2
184+
with:
185+
ref: ${{ matrix.canvas_tag }}
186+
187+
- name: Build
188+
run: |
189+
npm install -g node-gyp
190+
npm install --ignore-scripts
191+
msys2do . prebuild/Windows/preinstall.sh
192+
msys2do cp prebuild/Windows/binding.gyp binding.gyp
193+
msys2do node-gyp configure
194+
msys2do node-gyp rebuild -j 2
195+
196+
- name: Bundle
197+
run: msys2do . prebuild/Windows/bundle.sh
198+
199+
- name: Test binary
200+
# By not running in msys2, this doesn't have access to the msys2 libs
201+
run: npm test
202+
203+
- name: Make asset
204+
id: make_bundle
205+
# I can't figure out why this isn't an env var already. It shows up with `env`.
206+
run: msys2do UPLOAD_TO=${{ env.UPLOAD_TO }} CANVAS_VERSION_TO_BUILD=${{ env.CANVAS_VERSION_TO_BUILD}} . prebuild/tarball.sh
207+
208+
- name: Upload
209+
uses: actions/[email protected]
210+
with:
211+
script: |
212+
const fs = require("fs");
213+
const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
214+
const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
215+
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");
216+
217+
const releases = await github.repos.listReleases({owner, repo});
218+
const release = releases.data.find(r => r.tag_name === tagName);
219+
if (!release)
220+
throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);
221+
222+
const oldAsset = release.assets.find(a => a.name === assetName);
223+
if (oldAsset)
224+
await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});
225+
226+
// (This is equivalent to actions/upload-release-asset. We're
227+
// already in a script, so might as well do it here.)
228+
const r = await github.repos.uploadReleaseAsset({
229+
url: release.upload_url,
230+
headers: {
231+
"content-type": "application/x-gzip",
232+
"content-length": `${fs.statSync(assetName).size}`
233+
},
234+
name: assetName,
235+
data: fs.readFileSync(assetName)
236+
});

.travis.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,31 @@ project adheres to [Semantic Versioning](http://semver.org/).
99
==================
1010
### Changed
1111
### Added
12+
* Added support for `inverse()` and `invertSelf()` to `DOMMatrix` (#1648)
13+
### Fixed
14+
* Fix Pango logging "expect ugly output" on Windows (#1643)
15+
* Fix benchmark for createPNGStream (#1672)
16+
17+
2.7.0
18+
==================
19+
### Changed
20+
* Switch CI to Github Actions. (Adds Windows and macOS builds.)
21+
* Switch prebuilds to GitHub actions in the Automattic/node-canvas repository.
22+
Previously these were in the [node-gfx/node-canvas-prebuilt](https://github.com/node-gfx/node-canvas-prebuilt)
23+
and triggered manually.
24+
* Speed up `fillStyle=` and `strokeStyle=`
25+
### Added
26+
* Export `rsvgVersion`.
1227
### Fixed
1328
* Fix BMP issues. (#1497)
1429
* Update typings to support jpg and addPage on NodeCanvasRenderingContext2D (#1509)
30+
* Fix assertion failure when using Visual Studio Code debugger to inspect Image prototype (#1534)
31+
* Fix signed/unsigned comparison warning introduced in 2.6.0, and function cast warnings with GCC8+
32+
* Fix to compile without JPEG support (#1593).
33+
* Fix compile errors with cairo
34+
* Fix Image#complete if the image failed to load.
35+
* Upgrade node-pre-gyp to v0.15.0 to use latest version of needle to fix error when downloading prebuilds.
36+
* Don't throw if `fillStyle` or `strokeStyle` is set to an object, but that object is not a Gradient or Pattern. (This behavior was non-standard: invalid inputs are supposed to be ignored.)
1537

1638
2.6.1
1739
==================

Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# node-canvas
22

3-
[![Build Status](https://travis-ci.org/Automattic/node-canvas.svg?branch=master)](https://travis-ci.org/Automattic/node-canvas)
3+
![Test](https://github.com/Automattic/node-canvas/workflows/Test/badge.svg)
44
[![NPM version](https://badge.fury.io/js/canvas.svg)](http://badge.fury.io/js/canvas)
55

66
node-canvas is a [Cairo](http://cairographics.org/)-backed Canvas implementation for [Node.js](http://nodejs.org).

0 commit comments

Comments
 (0)