Skip to content

Commit 29410a1

Browse files
Vrixyzsebcrozet
andauthored
Automate building packages with different feature sets (#309)
* wip prepare build script Generating no-compat files ; simd + non-deterministic working locally ; package lock missing may be a problem for ci, not sure * add manual workflow trigger * fix build all projects script * aggregate features to rust packages ; renamed old packages, they'll be removed in the future * fix cargo workspace complaining * removed building on mac + fix comment * enable publish ci + list files in runtime * fix prettier * revert wrong change * compat working locally * removed is-compat option from rust builds * npm run fmt -- --write * fix tests * add changelog line * removed no-compat template directory Because there is only one subfolder: compat builds are handled by rapier-compat. * re-enable ci matrix (mac build) * chore: remove dead directories * feat: add a script to publish to npmjs * fix published package names * feat: improve readme * chore: cargo fmt * chore: more readme improvements * fix CI * chore: update cargo.lock * chore: cargo fmt * chore: run compat build on their separate workflow * fix(ci). make canary publish depend on build-compat too --------- Co-authored-by: Sébastien Crozet <[email protected]>
1 parent b0903e9 commit 29410a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1831
-2476
lines changed

.github/workflows/main.yml

+39-39
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches: [master]
66
pull_request:
77
branches: [master]
8+
workflow_dispatch:
89

910
env:
1011
CARGO_TERM_COLOR: always
@@ -41,34 +42,55 @@ jobs:
4142
target/
4243
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
4344
- run: npm ci;
45+
- name: Prepare no-compat builds
46+
run: |
47+
./builds/prepare_builds/prepare_all_projects.sh
48+
- name: Build all no-compat projects
49+
run: |
50+
./builds/prepare_builds/build_all_projects.sh
51+
- uses: actions/upload-artifact@v4
52+
with:
53+
name: pkg ${{ matrix.os }}
54+
path: |
55+
builds/*/pkg
56+
overwrite: true
57+
build-compat:
58+
strategy:
59+
matrix:
60+
os: [ubuntu-latest, macos-latest]
61+
runs-on: ${{ matrix.os }}
62+
env:
63+
RUSTFLAGS: -D warnings
64+
steps:
65+
- uses: actions/checkout@v4
66+
- uses: actions/cache@v3
67+
with:
68+
path: |
69+
~/.cargo/bin/
70+
~/.cargo/registry/index/
71+
~/.cargo/registry/cache/
72+
~/.cargo/git/db/
73+
target/
74+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
75+
- run: npm ci;
76+
- name: Prepare compat builds
77+
run: |
78+
./builds/prepare_builds/prepare_all_projects.sh
4479
- name: Build rapier-compat
4580
run: |
4681
cd rapier-compat;
4782
npm ci;
4883
npm run build;
4984
npm run test;
50-
- name: Build rapier2d
51-
run: |
52-
cd rapier2d;
53-
npm ci;
54-
npm run build;
55-
- name: Build rapier3d
56-
run: |
57-
cd rapier3d;
58-
npm ci;
59-
npm run build;
6085
- uses: actions/upload-artifact@v4
6186
with:
6287
name: pkg ${{ matrix.os }}
6388
path: |
64-
rapier2d/pkg
65-
rapier3d/pkg
66-
rapier-compat/pkg2d
67-
rapier-compat/pkg3d
89+
rapier-compat/builds/*/pkg
6890
overwrite: true
6991
publish:
7092
runs-on: ubuntu-latest
71-
needs: build
93+
needs: [build, build-compat]
7294
if: github.ref == 'refs/heads/master'
7395
steps:
7496
- uses: actions/checkout@v4
@@ -79,30 +101,8 @@ jobs:
79101
with:
80102
node-version: "22.x"
81103
registry-url: "https://registry.npmjs.org"
82-
- name: Publish rapier3d
83-
run: |
84-
cd rapier3d/pkg; npm version 0.0.0-$(git rev-parse --short HEAD)-$(date '+%Y%m%d') --git-tag-version false;
85-
npm publish --tag canary --access public;
86-
env:
87-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
88-
- name: Publish rapier2d
89-
run: |
90-
cd rapier2d/pkg;
91-
npm version 0.0.0-$(git rev-parse --short HEAD)-$(date '+%Y%m%d') --git-tag-version false;
92-
npm publish --tag canary --access public;
93-
env:
94-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
95-
- name: Publish rapier3d-compat
96-
run: |
97-
cd rapier-compat/pkg3d;
98-
npm version 0.0.0-$(git rev-parse --short HEAD)-$(date '+%Y%m%d') --git-tag-version false;
99-
npm publish --tag canary --access public;
100-
env:
101-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
102-
- name: Publish rapier2d-compat
104+
- name: Publish projects
103105
run: |
104-
cd rapier-compat/pkg2d;
105-
npm version 0.0.0-$(git rev-parse --short HEAD)-$(date '+%Y%m%d') --git-tag-version false;
106-
npm publish --tag canary --access public;
106+
./publish_all_canary.sh
107107
env:
108108
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ target
77
.DS_Store
88
dist
99
pkg
10-
pkg2d
11-
pkg3d
1210
gen2d/
1311
gen3d/
1412
docs
1513
*.swp
16-
*.d.ts
14+
*.d.ts
15+
16+
# Made by the prepare_builds crate
17+
builds/*
18+
!builds/prepare_builds
19+
20+
# compat generated builds
21+
rapier-compat/builds/

.prettierignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
pkg
2-
pkg2d
3-
pkg3d
42
gen2d
53
gen3d
64
docs

CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,26 @@
99

1010
- Update to Rapier 0.24.
1111
- Package tree shaking has been disabled to avoid a crash on certain build configuration (#289).
12+
- Multiple packages with different feature sets are now released, and their build process has been automated (#309)
13+
- Released packages are:
14+
- rapier2d
15+
- rapier2d-compat
16+
- rapier2d-simd
17+
- rapier2d-simd-compat
18+
- rapier2d-deterministic
19+
- rapier2d-deterministic-compat
20+
- rapier3d
21+
- rapier3d-compat
22+
- rapier2d
23+
- rapier2d-compat
24+
- rapier3d-simd
25+
- rapier3d-simd-compat
26+
- rapier3d-deterministic
27+
- rapier3d-deterministic-compat
28+
- :warning: To this occasion, existing packages `rapier2d` and `rapier3d` are now built without `enhanced-determinism` feature enabled,
29+
so if you rely on that feature, you should migrate to the new `-deterministic` flavor.
30+
31+
1232

1333
### 0.14.0 (20 July 2024)
1434

0 commit comments

Comments
 (0)