Skip to content

Commit

Permalink
Rework actions for faster PR CI
Browse files Browse the repository at this point in the history
- Whitespace change in @turf/difference should rebuild/test difference and @turf/turf
  • Loading branch information
mfedderly committed Aug 9, 2024
1 parent 5f0d405 commit 5eab8b4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/turf.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
name: CI build

on:
push:
branches:
- master
- support/6.x
pull_request:
branches:
- master
- support/6.x

permissions:
contents: read
Expand All @@ -24,6 +19,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4
Expand All @@ -37,5 +34,8 @@ jobs:
node-version: ${{ matrix.node-version }}

- run: pnpm install --frozen-lockfile
- run: pnpm lerna run build --since origin/master --ignore @turf/turf
- run: git diff --exit-code
- run: pnpm test
- run: pnpm lerna run test --since origin/master
# note: does not run linting
# note: does not run last-checks
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"{projectRoot}/test/**",
"{projectRoot}/types.ts"
],
"dependsOn": ["build"],
"dependsOn": [],
"cache": true
},
"last-checks": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lint:mrl": "mrl check",
"lint:prettier": "prettier --check .",
"preinstall": "npx only-allow pnpm",
"prepare": "husky && lerna run build",
"prepare": "husky",
"test": "pnpm run lint && lerna run test && lerna run --scope @turf/turf last-checks"
},
"lint-staged": {
Expand Down
1 change: 1 addition & 0 deletions packages/turf-difference/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function difference(
const properties = features.features[0].properties || {};

const differenced = polygonClipping.difference(geoms[0], ...geoms.slice(1));

if (differenced.length === 0) return null;
if (differenced.length === 1) return polygon(differenced[0], properties);
return multiPolygon(differenced, properties);
Expand Down

0 comments on commit 5eab8b4

Please sign in to comment.