@@ -45,178 +45,178 @@ on: workflow_dispatch
4545# this file depending on what you're building!!
4646
4747jobs :
48- # Linux:
49- # strategy:
50- # fail-fast: false
51- # matrix:
52- # node: [8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
53- # canvas_tag: ["v2.11.1 "] # e.g. "v2.6.1"
54- # name: ${{ matrix.canvas_tag }}, Node.js ${{ matrix.node }}, Linux
55- # runs-on: ubuntu-latest
56- # container:
57- # image: ${{ matrix.node < 18 && 'chearon/canvas-prebuilt:9' || 'zbbjornson/canvas-prebuilt:10' }}
58- # env:
59- # CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
60- # steps:
61- # - uses: actions/checkout@v2
62- # with:
63- # ref: ${{ matrix.canvas_tag }}
64-
65- # # Use the files in the prebuild/ directory from the commit that was used
66- # # to trigger the prebuild workflow. The version of git that's installed on
67- # # this Linux here doesn't support the method used on Mac and Win, so we
68- # # checkout the prebuild branch and copy the files from the prebuild/
69- # # directory in the Build step.
70- # - uses: actions/checkout@v2
71- # with:
72- # ref: ${{ env.GITHUB_SHA }}
73- # path: prebuild-branch
74-
75- # - uses: actions/setup-node@v1
76- # with:
77- # node-version: ${{ matrix.node }}
78-
79- # - name: Build
80- # run: |
81- # set -ex
82- # mkdir -p prebuild
83- # cp -rfv ./prebuild-branch/prebuild/* ./prebuild/
84- # npm install -g node-gyp@6
85- # npm install --ignore-scripts
86- # . prebuild/Linux/preinstall.sh
87- # cp prebuild/Linux/binding.gyp binding.gyp
88- # node-gyp rebuild -j 2
89- # . prebuild/Linux/bundle.sh
90-
91- # - name: Test binary
92- # continue-on-error: true
93- # run: |
94- # set -ex
95- # cd /root/harfbuzz-* && make uninstall
96- # cd /root/cairo-* && make uninstall
97- # cd /root/pango-* && cd _build && ninja uninstall
98- # cd /root/libpng-* && make uninstall
99- # cd /root/libjpeg-* && cd b && make uninstall
100- # cd /root/giflib-* && make uninstall
101-
102- # cd $GITHUB_WORKSPACE
103- # ls build/Release
104- # ldd build/Release/canvas.node
105- # npx mocha test/*.test.js
106-
107- # - name: Make bundle
108- # id: make_bundle
109- # run: . prebuild/tarball.sh
110-
111- # - name: Upload
112- # uses: actions/github-script@v2
113- # with:
114- # script: |
115- # const fs = require("fs");
116- # const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
117- # const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
118- # const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");
119-
120- # const releases = await github.repos.listReleases({owner, repo});
121- # const release = releases.data.find(r => r.tag_name === tagName);
122- # if (!release)
123- # throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);
124-
125- # const oldAsset = release.assets.find(a => a.name === assetName);
126- # if (oldAsset)
127- # await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});
128-
129- # // (This is equivalent to actions/upload-release-asset. We're
130- # // already in a script, so might as well do it here.)
131- # const r = await github.repos.uploadReleaseAsset({
132- # url: release.upload_url,
133- # headers: {
134- # "content-type": "application/x-gzip",
135- # "content-length": `${fs.statSync(assetName).size}`
136- # },
137- # name: assetName,
138- # data: fs.readFileSync(assetName)
139- # });
140-
141- # macOS:
142- # strategy:
143- # fail-fast: false
144- # matrix:
145- # node: [13, 14, 15, 16, 17, 18, 19]
146- # canvas_tag: ["v2.11.1 "] # e.g. "v2.6.1"
147- # name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, macOS
148- # runs-on: macos-latest
149- # env:
150- # CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
151- # steps:
152- # - uses: actions/checkout@v2
153- # with:
154- # ref: ${{ matrix.canvas_tag }}
155- # # Fetch all commits/all branches so we can checkout the prebuild
156- # # branch's files
157- # fetch-depth: 0
158-
159- # - uses: actions/setup-node@v1
160- # with:
161- # node-version: ${{ matrix.node }}
162-
163- # - name: Build
164- # run: |
165- # set -Eeuxo pipefail
166- # git checkout ${{ matrix.canvas_tag }}
167- # git checkout $GITHUB_SHA -- prebuild/
168- # npm install -g node-gyp
169- # npm install --ignore-scripts
170- # . prebuild/macOS/preinstall.sh
171- # cp prebuild/macOS/binding.gyp binding.gyp
172- # node-gyp rebuild -j 2
173- # . prebuild/macOS/bundle.sh
174-
175- # - name: Test binary
176- # run: |
177- # brew uninstall --force --ignore-dependencies cairo pango librsvg giflib harfbuzz
178- # npm test
179-
180- # - name: Make bundle
181- # id: make_bundle
182- # run: . prebuild/tarball.sh
183-
184- # - name: Upload
185- # uses: actions/github-script@v2
186- # with:
187- # script: |
188- # const fs = require("fs");
189- # const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
190- # const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
191- # const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");
192-
193- # const releases = await github.repos.listReleases({owner, repo});
194- # const release = releases.data.find(r => r.tag_name === tagName);
195- # if (!release)
196- # throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);
197-
198- # const oldAsset = release.assets.find(a => a.name === assetName);
199- # if (oldAsset)
200- # await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});
201-
202- # // (This is equivalent to actions/upload-release-asset. We're
203- # // already in a script, so might as well do it here.)
204- # const r = await github.repos.uploadReleaseAsset({
205- # url: release.upload_url,
206- # headers: {
207- # "content-type": "application/x-gzip",
208- # "content-length": `${fs.statSync(assetName).size}`
209- # },
210- # name: assetName,
211- # data: fs.readFileSync(assetName)
212- # });
48+ Linux :
49+ strategy :
50+ fail-fast : false
51+ matrix :
52+ node : [8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
53+ canvas_tag : ["v2.11.2 "] # e.g. "v2.6.1"
54+ name : ${{ matrix.canvas_tag }}, Node.js ${{ matrix.node }}, Linux
55+ runs-on : ubuntu-latest
56+ container :
57+ image : ${{ matrix.node < 18 && 'chearon/canvas-prebuilt:9' || 'zbbjornson/canvas-prebuilt:10' }}
58+ env :
59+ CANVAS_VERSION_TO_BUILD : ${{ matrix.canvas_tag }}
60+ steps :
61+ - uses : actions/checkout@v2
62+ with :
63+ ref : ${{ matrix.canvas_tag }}
64+
65+ # Use the files in the prebuild/ directory from the commit that was used
66+ # to trigger the prebuild workflow. The version of git that's installed on
67+ # this Linux here doesn't support the method used on Mac and Win, so we
68+ # checkout the prebuild branch and copy the files from the prebuild/
69+ # directory in the Build step.
70+ - uses : actions/checkout@v2
71+ with :
72+ ref : ${{ env.GITHUB_SHA }}
73+ path : prebuild-branch
74+
75+ - uses : actions/setup-node@v1
76+ with :
77+ node-version : ${{ matrix.node }}
78+
79+ - name : Build
80+ run : |
81+ set -ex
82+ mkdir -p prebuild
83+ cp -rfv ./prebuild-branch/prebuild/* ./prebuild/
84+ npm install -g node-gyp@6
85+ npm install --ignore-scripts
86+ . prebuild/Linux/preinstall.sh
87+ cp prebuild/Linux/binding.gyp binding.gyp
88+ node-gyp rebuild -j 2
89+ . prebuild/Linux/bundle.sh
90+
91+ - name : Test binary
92+ continue-on-error : true
93+ run : |
94+ set -ex
95+ cd /root/harfbuzz-* && make uninstall
96+ cd /root/cairo-* && make uninstall
97+ cd /root/pango-* && cd _build && ninja uninstall
98+ cd /root/libpng-* && make uninstall
99+ cd /root/libjpeg-* && cd b && make uninstall
100+ cd /root/giflib-* && make uninstall
101+
102+ cd $GITHUB_WORKSPACE
103+ ls build/Release
104+ ldd build/Release/canvas.node
105+ npx mocha test/*.test.js
106+
107+ - name : Make bundle
108+ id : make_bundle
109+ run : . prebuild/tarball.sh
110+
111+ - name : Upload
112+ uses : actions/github-script@v2
113+ with :
114+ script : |
115+ const fs = require("fs");
116+ const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
117+ const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
118+ const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");
119+
120+ const releases = await github.repos.listReleases({owner, repo});
121+ const release = releases.data.find(r => r.tag_name === tagName);
122+ if (!release)
123+ throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);
124+
125+ const oldAsset = release.assets.find(a => a.name === assetName);
126+ if (oldAsset)
127+ await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});
128+
129+ // (This is equivalent to actions/upload-release-asset. We're
130+ // already in a script, so might as well do it here.)
131+ const r = await github.repos.uploadReleaseAsset({
132+ url: release.upload_url,
133+ headers: {
134+ "content-type": "application/x-gzip",
135+ "content-length": `${fs.statSync(assetName).size}`
136+ },
137+ name: assetName,
138+ data: fs.readFileSync(assetName)
139+ });
140+
141+ macOS :
142+ strategy :
143+ fail-fast : false
144+ matrix :
145+ node : [13, 14, 15, 16, 17, 18, 19]
146+ canvas_tag : ["v2.11.2 "] # e.g. "v2.6.1"
147+ name : ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, macOS
148+ runs-on : macos-latest
149+ env :
150+ CANVAS_VERSION_TO_BUILD : ${{ matrix.canvas_tag }}
151+ steps :
152+ - uses : actions/checkout@v2
153+ with :
154+ ref : ${{ matrix.canvas_tag }}
155+ # Fetch all commits/all branches so we can checkout the prebuild
156+ # branch's files
157+ fetch-depth : 0
158+
159+ - uses : actions/setup-node@v1
160+ with :
161+ node-version : ${{ matrix.node }}
162+
163+ - name : Build
164+ run : |
165+ set -Eeuxo pipefail
166+ git checkout ${{ matrix.canvas_tag }}
167+ git checkout $GITHUB_SHA -- prebuild/
168+ npm install -g node-gyp
169+ npm install --ignore-scripts
170+ . prebuild/macOS/preinstall.sh
171+ cp prebuild/macOS/binding.gyp binding.gyp
172+ node-gyp rebuild -j 2
173+ . prebuild/macOS/bundle.sh
174+
175+ - name : Test binary
176+ run : |
177+ brew uninstall --force --ignore-dependencies cairo pango librsvg giflib harfbuzz
178+ npm test
179+
180+ - name : Make bundle
181+ id : make_bundle
182+ run : . prebuild/tarball.sh
183+
184+ - name : Upload
185+ uses : actions/github-script@v2
186+ with :
187+ script : |
188+ const fs = require("fs");
189+ const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
190+ const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
191+ const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");
192+
193+ const releases = await github.repos.listReleases({owner, repo});
194+ const release = releases.data.find(r => r.tag_name === tagName);
195+ if (!release)
196+ throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);
197+
198+ const oldAsset = release.assets.find(a => a.name === assetName);
199+ if (oldAsset)
200+ await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});
201+
202+ // (This is equivalent to actions/upload-release-asset. We're
203+ // already in a script, so might as well do it here.)
204+ const r = await github.repos.uploadReleaseAsset({
205+ url: release.upload_url,
206+ headers: {
207+ "content-type": "application/x-gzip",
208+ "content-length": `${fs.statSync(assetName).size}`
209+ },
210+ name: assetName,
211+ data: fs.readFileSync(assetName)
212+ });
213213
214214 Win :
215215 strategy :
216216 fail-fast : false
217217 matrix :
218- node : [12 ]
219- canvas_tag : ["v2.11.1 "] # e.g. "v2.6.1"
218+ node : [13, 14, 15, 16, 17, 18, 19 ]
219+ canvas_tag : ["v2.11.2 "] # e.g. "v2.6.1"
220220 name : ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, Windows
221221 runs-on : windows-2019
222222 env :
0 commit comments