733459f
commit 733459f
3 files changed
+108 -30
Showing 3 changed files+108-30
▼.github/workflows/publish.yml
+79-28
| @@ -3,48 +3,99 @@ name: Publish to PyPI | ||
3 | 3 | on: |
4 | 4 | release: |
5 | 5 | types: [published] |
6 | - push: | |
7 | - tags: | |
8 | - - 'v*' | |
6 | + workflow_dispatch: | |
7 | + | |
8 | +permissions: | |
9 | + contents: read | |
10 | + id-token: write | |
9 | 11 | |
10 | 12 | jobs: |
11 | - build-wheels: | |
13 | + check-version: | |
14 | + name: Check Version | |
12 | 15 | runs-on: ubuntu-latest |
16 | + outputs: | |
17 | + version: ${{ steps.version.outputs.version }} | |
13 | 18 | steps: |
14 | 19 | - uses: actions/checkout@v4 |
15 | - - name: Build abi3 wheel (GIL; CPython 3.11+) | |
16 | - uses: PyO3/maturin-action@v1 | |
20 | + - id: version | |
21 | + run: echo "version=$(grep '^version = ' crates/justapi-py/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')" >> "$GITHUB_OUTPUT" | |
22 | + | |
23 | + test-rust: | |
24 | + name: Cargo Test & Lint | |
25 | + runs-on: ubuntu-latest | |
26 | + needs: check-version | |
27 | + steps: | |
28 | + - uses: actions/checkout@v4 | |
29 | + - uses: dtolnay/rust-toolchain@stable | |
17 | 30 | with: |
18 | - target: x86_64 | |
19 | - args: --release --out dist -m crates/justapi-py/Cargo.toml | |
20 | - - name: Build free-threaded wheel (cp314t; no-GIL CPython 3.14) | |
21 | - uses: PyO3/maturin-action@v1 | |
31 | + components: clippy, rustfmt | |
32 | + - name: Install cargo-deny | |
33 | + uses: taiki-e/install-action@v2 | |
22 | 34 | with: |
23 | - target: x86_64 | |
24 | - args: --release --out dist -m crates/justapi-py/Cargo.toml -i python3.14t | |
25 | - - name: Upload wheels | |
26 | - uses: actions/upload-artifact@v4 | |
35 | + tool: cargo-deny | |
36 | + - name: Security & License Check | |
37 | + run: cargo deny check | |
38 | + - name: Run Tests | |
39 | + run: cargo test --workspace | |
40 | + - name: Clippy & Formatting | |
41 | + run: | | |
42 | + cargo clippy --workspace --tests -- -D warnings | |
43 | + cargo fmt --check | |
44 | + | |
45 | + build-wheels: | |
46 | + name: Build (${{ matrix.target }}) | |
47 | + runs-on: ${{ matrix.os }} | |
48 | + needs: test-rust | |
49 | + strategy: | |
50 | + fail-fast: false | |
51 | + matrix: | |
52 | + include: | |
53 | + - os: ubuntu-latest | |
54 | + target: x86_64 | |
55 | + args: --manylinux 2_28 | |
56 | + - os: ubuntu-latest | |
57 | + target: aarch64 | |
58 | + args: --manylinux 2_28 | |
59 | + - os: macos-latest | |
60 | + target: x86_64 | |
61 | + - os: macos-latest | |
62 | + target: aarch64 | |
63 | + - os: windows-latest | |
64 | + target: x64 | |
65 | + steps: | |
66 | + - uses: actions/checkout@v4 | |
67 | + - uses: actions/setup-python@v5 | |
27 | 68 | with: |
28 | - name: wheels | |
29 | - path: dist | |
69 | + python-version: '3.12' | |
70 | + - uses: PyO3/maturin-action@v1 | |
71 | + with: | |
72 | + target: ${{ matrix.target }} | |
73 | + args: --release --out dist ${{ matrix.args }} | |
74 | + manifest-path: crates/justapi-py/Cargo.toml | |
75 | + - name: Smoke test | |
76 | + shell: bash | |
77 | + run: | | |
78 | + python -m pip install dist/*.whl | |
79 | + python -c "import justapi; print(justapi.__version__)" | |
80 | + - uses: actions/upload-artifact@v4 | |
81 | + with: | |
82 | + name: wheels-${{ matrix.target }} | |
83 | + path: dist/*.whl | |
30 | 84 | |
31 | 85 | publish: |
32 | 86 | name: Publish to PyPI |
33 | - needs: [build-wheels] | |
34 | 87 | runs-on: ubuntu-latest |
35 | - environment: | |
36 | - name: pypi | |
37 | - url: https://pypi.org/p/justapi | |
88 | + needs: build-wheels | |
38 | 89 | permissions: |
39 | - id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
40 | - contents: read | |
90 | + id-token: write | |
41 | 91 | steps: |
42 | - - name: Download wheels | |
43 | - uses: actions/download-artifact@v4 | |
92 | + - uses: actions/download-artifact@v4 | |
44 | 93 | with: |
45 | - name: wheels | |
94 | + pattern: wheels-* | |
95 | + merge-multiple: true | |
46 | 96 | path: dist |
47 | - - name: Publish package to PyPI | |
48 | - uses: pypa/gh-action-pypi-publish@release/v1 | |
97 | + - name: Publish | |
98 | + uses: pypa/gh-action-pypa-publish@release/v1 | |
49 | 99 | with: |
50 | - packages-dir: dist | |
100 | + packages-dir: dist/ | |
101 | + skip-existing: true | |
51 | 102 | |
▼.github/workflows/wheels.yml
+29-2
| @@ -12,13 +12,19 @@ permissions: | ||
12 | 12 | |
13 | 13 | jobs: |
14 | 14 | test-rust: |
15 | - name: Cargo Test & Clippy (Linux x86_64) | |
15 | + name: Cargo Test & Lint (Linux x86_64) | |
16 | 16 | runs-on: ubuntu-latest |
17 | 17 | steps: |
18 | 18 | - uses: actions/checkout@v4 |
19 | 19 | - uses: dtolnay/rust-toolchain@stable |
20 | 20 | with: |
21 | 21 | components: clippy, rustfmt |
22 | + - name: Install cargo-deny | |
23 | + uses: taiki-e/install-action@v2 | |
24 | + with: | |
25 | + tool: cargo-deny | |
26 | + - name: Security Advisory & License Check | |
27 | + run: cargo deny check | |
22 | 28 | - name: Run Tests |
23 | 29 | run: cargo test --workspace |
24 | 30 | - name: Run Clippy |
| @@ -26,10 +32,24 @@ jobs: | ||
26 | 32 | - name: Check Formatting |
27 | 33 | run: cargo fmt --check |
28 | 34 | |
35 | + miri-test: | |
36 | + name: Miri Test (justapi-core) | |
37 | + runs-on: ubuntu-latest | |
38 | + needs: test-rust | |
39 | + steps: | |
40 | + - uses: actions/checkout@v4 | |
41 | + - uses: dtolnay/rust-toolchain@nightly | |
42 | + with: | |
43 | + components: miri | |
44 | + - name: Run Miri | |
45 | + run: cargo miri test -p justapi-core | |
46 | + env: | |
47 | + MIRIFLAGS: -Zmiri-disable-isolation | |
48 | + | |
29 | 49 | build-wheels: |
30 | 50 | name: Build Wheels (${{ matrix.os }} - ${{ matrix.target }}) |
31 | 51 | runs-on: ${{ matrix.os }} |
32 | - needs: test-rust | |
52 | + needs: miri-test | |
33 | 53 | strategy: |
34 | 54 | fail-fast: false |
35 | 55 | matrix: |
| @@ -63,6 +83,13 @@ jobs: | ||
63 | 83 | args: --release --out dist ${{ matrix.args }} |
64 | 84 | manifest-path: crates/justapi-py/Cargo.toml |
65 | 85 | |
86 | + - name: Install wheel & test | |
87 | + shell: bash | |
88 | + run: | | |
89 | + pip install dist/*.whl --force-reinstall | |
90 | + pip install pytest | |
91 | + python -m pytest crates/justapi-py/tests/ -v --tb=short | |
92 | + | |
66 | 93 | - name: Upload Wheels |
67 | 94 | uses: actions/upload-artifact@v4 |
68 | 95 | with: |
69 | 96 | |
▼demo_shop/shop.db
+0-0
Binary file not shown.