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
|
||||
permissions: {}
|
||||
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:
|
||||
permissions:
|
||||
contents: read
|
||||
needs: lint
|
||||
name: "build-${{ matrix.platform }} [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}"
|
||||
runs-on: ${{ matrix.os }}
|
||||
container: ${{ matrix.container }}
|
||||
@ -150,17 +165,14 @@ jobs:
|
||||
python-version: "3.12"
|
||||
- name: Dependencies (Node.js)
|
||||
if: "!contains(matrix.platform, 'linuxmusl')"
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: ${{ matrix.nodejs_version }}
|
||||
architecture: ${{ matrix.nodejs_arch }}
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install
|
||||
run: npm install --build-from-source
|
||||
- name: Test
|
||||
run: npm test
|
||||
- name: Populate npm package
|
||||
if: matrix.package
|
||||
- run: npm install --build-from-source
|
||||
- run: npm run test-unit
|
||||
- if: matrix.package
|
||||
run: npm run package-from-local-build
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: matrix.package
|
||||
@ -172,6 +184,7 @@ jobs:
|
||||
build-linuxmusl-arm64:
|
||||
permissions:
|
||||
contents: read
|
||||
needs: lint
|
||||
name: "build-linuxmusl-arm64 [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}"
|
||||
runs-on: ubuntu-24.04-arm
|
||||
container:
|
||||
@ -199,12 +212,9 @@ jobs:
|
||||
- name: Dependencies
|
||||
run: apk add build-base git python3 font-noto --update-cache
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install
|
||||
run: npm install --build-from-source
|
||||
- name: Test
|
||||
run: npm test
|
||||
- name: Populate npm package
|
||||
if: matrix.package
|
||||
- run: npm install --build-from-source
|
||||
- run: npm run test-unit
|
||||
- if: matrix.package
|
||||
run: npm run package-from-local-build
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: matrix.package
|
||||
@ -216,6 +226,7 @@ jobs:
|
||||
build-qemu:
|
||||
permissions:
|
||||
contents: read
|
||||
needs: lint
|
||||
name: "build-${{ matrix.platform }} [Node.js ${{ matrix.nodejs_version_major }}] [package]"
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
@ -267,6 +278,7 @@ jobs:
|
||||
build-emscripten:
|
||||
permissions:
|
||||
contents: read
|
||||
needs: lint
|
||||
name: "build-wasm32 [package]"
|
||||
runs-on: ubuntu-24.04
|
||||
container: "emscripten/emsdk:4.0.14"
|
||||
@ -275,11 +287,10 @@ jobs:
|
||||
- name: Dependencies
|
||||
run: apt-get update && apt-get install -y pkg-config
|
||||
- name: Dependencies (Node.js)
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: "20"
|
||||
- name: Install
|
||||
run: emmake npm install --build-from-source
|
||||
- run: emmake npm install --build-from-source
|
||||
- name: Verify emscripten versions match
|
||||
run: |
|
||||
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 "sharp built with emscripten $EMSCRIPTEN_VERSION_SHARP"
|
||||
test "$EMSCRIPTEN_VERSION_LIBVIPS" = "$EMSCRIPTEN_VERSION_SHARP"
|
||||
- name: Test
|
||||
run: emmake npm test
|
||||
- name: Populate npm package
|
||||
run: emmake npm run package-from-local-build
|
||||
- run: emmake npm run test-unit
|
||||
- run: emmake npm run package-from-local-build
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wasm32
|
||||
@ -314,7 +323,7 @@ jobs:
|
||||
path: npm
|
||||
- name: Create npm workspace tarball
|
||||
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:
|
||||
node-version: '24'
|
||||
- name: Create release notes
|
||||
|
||||
12
package.json
12
package.json
@ -94,12 +94,14 @@
|
||||
"scripts": {
|
||||
"install": "node install/check.js",
|
||||
"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-lint": "semistandard && cpplint",
|
||||
"test-unit": "nyc --reporter=lcov --reporter=text --check-coverage --branches=100 mocha",
|
||||
"test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;LGPL-3.0-or-later;MIT\"",
|
||||
"test": "npm run lint && npm run test-unit",
|
||||
"lint": "npm run lint-cpp && npm run lint-js && npm run lint-licensing && npm run lint-types",
|
||||
"lint-cpp": "cpplint",
|
||||
"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-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-release-notes": "node npm/release-notes.js",
|
||||
"docs-build": "node docs/build.mjs",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user