mirror of
https://github.com/lovell/sharp.git
synced 2025-12-06 03:51:40 +01:00
CI: Separate platform-independent linter tasks
Run these before platform-specific build/testing tasks
This commit is contained in:
parent
ee437832e2
commit
a0af662d78
51
.github/workflows/ci.yml
vendored
51
.github/workflows/ci.yml
vendored
@ -4,9 +4,24 @@ on:
|
|||||||
- pull_request
|
- pull_request
|
||||||
permissions: {}
|
permissions: {}
|
||||||
jobs:
|
jobs:
|
||||||
|
lint:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v5
|
||||||
|
with:
|
||||||
|
node-version: "24"
|
||||||
|
- run: npm install --ignore-scripts --omit=optional
|
||||||
|
- run: npm run lint-cpp
|
||||||
|
- run: npm run lint-js
|
||||||
|
- run: npm run lint-licensing
|
||||||
|
- run: npm run lint-types
|
||||||
build-native:
|
build-native:
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
needs: lint
|
||||||
name: "build-${{ matrix.platform }} [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}"
|
name: "build-${{ matrix.platform }} [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}"
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
container: ${{ matrix.container }}
|
container: ${{ matrix.container }}
|
||||||
@ -150,17 +165,14 @@ jobs:
|
|||||||
python-version: "3.12"
|
python-version: "3.12"
|
||||||
- name: Dependencies (Node.js)
|
- name: Dependencies (Node.js)
|
||||||
if: "!contains(matrix.platform, 'linuxmusl')"
|
if: "!contains(matrix.platform, 'linuxmusl')"
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v5
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.nodejs_version }}
|
node-version: ${{ matrix.nodejs_version }}
|
||||||
architecture: ${{ matrix.nodejs_arch }}
|
architecture: ${{ matrix.nodejs_arch }}
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install
|
- run: npm install --build-from-source
|
||||||
run: npm install --build-from-source
|
- run: npm run test-unit
|
||||||
- name: Test
|
- if: matrix.package
|
||||||
run: npm test
|
|
||||||
- name: Populate npm package
|
|
||||||
if: matrix.package
|
|
||||||
run: npm run package-from-local-build
|
run: npm run package-from-local-build
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: matrix.package
|
if: matrix.package
|
||||||
@ -172,6 +184,7 @@ jobs:
|
|||||||
build-linuxmusl-arm64:
|
build-linuxmusl-arm64:
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
needs: lint
|
||||||
name: "build-linuxmusl-arm64 [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}"
|
name: "build-linuxmusl-arm64 [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}"
|
||||||
runs-on: ubuntu-24.04-arm
|
runs-on: ubuntu-24.04-arm
|
||||||
container:
|
container:
|
||||||
@ -199,12 +212,9 @@ jobs:
|
|||||||
- name: Dependencies
|
- name: Dependencies
|
||||||
run: apk add build-base git python3 font-noto --update-cache
|
run: apk add build-base git python3 font-noto --update-cache
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install
|
- run: npm install --build-from-source
|
||||||
run: npm install --build-from-source
|
- run: npm run test-unit
|
||||||
- name: Test
|
- if: matrix.package
|
||||||
run: npm test
|
|
||||||
- name: Populate npm package
|
|
||||||
if: matrix.package
|
|
||||||
run: npm run package-from-local-build
|
run: npm run package-from-local-build
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: matrix.package
|
if: matrix.package
|
||||||
@ -216,6 +226,7 @@ jobs:
|
|||||||
build-qemu:
|
build-qemu:
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
needs: lint
|
||||||
name: "build-${{ matrix.platform }} [Node.js ${{ matrix.nodejs_version_major }}] [package]"
|
name: "build-${{ matrix.platform }} [Node.js ${{ matrix.nodejs_version_major }}] [package]"
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
strategy:
|
strategy:
|
||||||
@ -267,6 +278,7 @@ jobs:
|
|||||||
build-emscripten:
|
build-emscripten:
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
needs: lint
|
||||||
name: "build-wasm32 [package]"
|
name: "build-wasm32 [package]"
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
container: "emscripten/emsdk:4.0.14"
|
container: "emscripten/emsdk:4.0.14"
|
||||||
@ -275,11 +287,10 @@ jobs:
|
|||||||
- name: Dependencies
|
- name: Dependencies
|
||||||
run: apt-get update && apt-get install -y pkg-config
|
run: apt-get update && apt-get install -y pkg-config
|
||||||
- name: Dependencies (Node.js)
|
- name: Dependencies (Node.js)
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v5
|
||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "20"
|
||||||
- name: Install
|
- run: emmake npm install --build-from-source
|
||||||
run: emmake npm install --build-from-source
|
|
||||||
- name: Verify emscripten versions match
|
- name: Verify emscripten versions match
|
||||||
run: |
|
run: |
|
||||||
EMSCRIPTEN_VERSION_LIBVIPS=$(node -p "require('@img/sharp-libvips-dev-wasm32/versions').emscripten")
|
EMSCRIPTEN_VERSION_LIBVIPS=$(node -p "require('@img/sharp-libvips-dev-wasm32/versions').emscripten")
|
||||||
@ -287,10 +298,8 @@ jobs:
|
|||||||
echo "libvips built with emscripten $EMSCRIPTEN_VERSION_LIBVIPS"
|
echo "libvips built with emscripten $EMSCRIPTEN_VERSION_LIBVIPS"
|
||||||
echo "sharp built with emscripten $EMSCRIPTEN_VERSION_SHARP"
|
echo "sharp built with emscripten $EMSCRIPTEN_VERSION_SHARP"
|
||||||
test "$EMSCRIPTEN_VERSION_LIBVIPS" = "$EMSCRIPTEN_VERSION_SHARP"
|
test "$EMSCRIPTEN_VERSION_LIBVIPS" = "$EMSCRIPTEN_VERSION_SHARP"
|
||||||
- name: Test
|
- run: emmake npm run test-unit
|
||||||
run: emmake npm test
|
- run: emmake npm run package-from-local-build
|
||||||
- name: Populate npm package
|
|
||||||
run: emmake npm run package-from-local-build
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: wasm32
|
name: wasm32
|
||||||
@ -314,7 +323,7 @@ jobs:
|
|||||||
path: npm
|
path: npm
|
||||||
- name: Create npm workspace tarball
|
- name: Create npm workspace tarball
|
||||||
run: tar -vcaf npm-workspace.tar.xz --directory npm --exclude=from-local-build.js .
|
run: tar -vcaf npm-workspace.tar.xz --directory npm --exclude=from-local-build.js .
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v5
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
- name: Create release notes
|
- name: Create release notes
|
||||||
|
|||||||
12
package.json
12
package.json
@ -94,12 +94,14 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"install": "node install/check.js",
|
"install": "node install/check.js",
|
||||||
"clean": "rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",
|
"clean": "rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",
|
||||||
"test": "npm run test-lint && npm run test-unit && npm run test-licensing && npm run test-types",
|
"test": "npm run lint && npm run test-unit",
|
||||||
"test-lint": "semistandard && cpplint",
|
"lint": "npm run lint-cpp && npm run lint-js && npm run lint-licensing && npm run lint-types",
|
||||||
"test-unit": "nyc --reporter=lcov --reporter=text --check-coverage --branches=100 mocha",
|
"lint-cpp": "cpplint",
|
||||||
"test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;LGPL-3.0-or-later;MIT\"",
|
"lint-js": "semistandard",
|
||||||
|
"lint-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;LGPL-3.0-or-later;MIT\"",
|
||||||
|
"lint-types": "tsd",
|
||||||
"test-leak": "./test/leak/leak.sh",
|
"test-leak": "./test/leak/leak.sh",
|
||||||
"test-types": "tsd",
|
"test-unit": "nyc --reporter=lcov --reporter=text --check-coverage --branches=100 mocha",
|
||||||
"package-from-local-build": "node npm/from-local-build.js",
|
"package-from-local-build": "node npm/from-local-build.js",
|
||||||
"package-release-notes": "node npm/release-notes.js",
|
"package-release-notes": "node npm/release-notes.js",
|
||||||
"docs-build": "node docs/build.mjs",
|
"docs-build": "node docs/build.mjs",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user