Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .copier-answers.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: cb37079
_commit: d814faa
_src_path: https://github.com/python-project-templates/base.git
add_docs: true
add_extension: rustjswasm
Expand Down
28 changes: 17 additions & 11 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]

steps:
- name: Checkout
Expand Down Expand Up @@ -85,29 +85,35 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
with:
platforms: all
if: runner.os == 'Linux' && runner.arch == 'X64'

- name: Free disk space
run: |
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /usr/local/.ghcup /usr/share/swift
df -h /
shell: bash
if: matrix.os == 'ubuntu-latest'
if: runner.os == 'Linux'

- name: Build distributions (Linux)
- name: Build distributions (Linux x86_64)
run: |
rm -rf dist
make dist-rs
make dist-py-sdist
make dist-py-wheel
make dist-check
shell: bash
env:
CIBW_ARCHS_LINUX: native
if: matrix.os == 'ubuntu-latest'

- name: Build distributions (Linux ARM64)
run: |
rm -rf dist
make dist-py-wheel
make dist-check
shell: bash
env:
CIBW_ARCHS_LINUX: native
if: matrix.os == 'ubuntu-24.04-arm'

- name: Build distributions (macOS/Windows)
run: |
rm -rf dist
Expand All @@ -116,13 +122,13 @@ jobs:
shell: bash
env:
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=11.0
if: matrix.os != 'ubuntu-latest'
if: runner.os != 'Linux'

- name: Test wheel
uses: actions-ext/python/test-wheel@6e1b91a408ea89f49bc8aff8724f83826f7b5446
with:
module: python_template_rust
if: matrix.os == 'ubuntu-latest'
if: runner.os == 'Linux'

- name: Test source distribution
uses: actions-ext/python/test-sdist@6e1b91a408ea89f49bc8aff8724f83826f7b5446
Expand Down
18 changes: 13 additions & 5 deletions js/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ const BUNDLES = [
];

async function build() {
if (fs.existsSync("dist")) {
for (const entry of fs.readdirSync("dist")) {
if (entry !== "pkg") {
fs.rmSync(`dist/${entry}`, { recursive: true, force: true });
}
}
}
fs.rmSync("../python_template_rust/extension", {
recursive: true,
force: true,
});

// Bundle css
await bundle_css();

Expand All @@ -33,10 +45,6 @@ async function build() {
await Promise.all(BUNDLES.map(bundle)).catch(() => process.exit(1));

// Copy servable assets to python extension (exclude esm/)
fs.rmSync("../python_template_rust/extension", {
recursive: true,
force: true,
});
fs.mkdirSync("../python_template_rust/extension", { recursive: true });
await cpy("dist/**/*", "../python_template_rust/extension", {
filter: (file) =>
Expand All @@ -45,4 +53,4 @@ async function build() {
});
}

build();
await build();
7 changes: 4 additions & 3 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@
"./package.json": "./package.json"
},
"files": [
"dist/**/*",
"index.d.ts"
"dist/**/*"
],
"types": "./dist/esm/index.d.ts",
"publishConfig": {
"access": "public"
},
"scripts": {
"setup": "cargo install -f wasm-bindgen-cli --version 0.2.126 --locked",
"build:clean": "node -e \"const fs=require('fs'); fs.rmSync('dist',{recursive:true,force:true}); fs.rmSync('../python_template_rust/extension',{recursive:true,force:true})\"",
"build:debug": "node build.mjs --debug",
"build:rust": "cargo build --release --all-features --target wasm32-unknown-unknown --target-dir ../target",
"build:wasm-bindgen": "wasm-bindgen ../target/wasm32-unknown-unknown/release/python_template_rust.wasm --out-dir ./dist/pkg --target web",
"build:prod": "node build.mjs",
"build": "npm-run-all build:rust build:wasm-bindgen build:prod",
"build:types": "tsc",
"build": "npm-run-all build:clean build:rust build:wasm-bindgen build:prod build:types",
"clean": "rm -rf dist lib playwright-report ../python_template_rust/extension",
"dev": "npm-run-all -p start watch",
"lint:js": "oxlint . && oxfmt --check \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"",
Expand Down
4 changes: 2 additions & 2 deletions js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"noFallthroughCasesInSwitch": true,
"outDir": "./dist/esm",
"resolveJsonModule": true,
"rootDir": ".",
"rootDir": "./src/ts",
"skipLibCheck": true,
"strict": true,
"target": "ES2020",
"useDefineForClassFields": true
},
"include": ["./src/ts/*.ts", "./tests/*.ts"]
"include": ["./src/ts/*.ts"]
}
Loading