swadhinbiswas ⚡ dx: switch CI to uv for faster dep resolution + OIDC publish · 7/25/2026
7a63124
116 lines · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: CI & Wheel Release Pipeline

on:
  push:
    branches: [ main, master ]
    tags: [ 'v*' ]
  pull_request:
    branches: [ main, master ]

permissions:
  contents: read

jobs:
  test-rust:
    name: Cargo Test & Lint (Linux x86_64)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt
      - name: Install cargo-deny
        uses: taiki-e/install-action@v2
        with:
          tool: cargo-deny
      - name: Security Advisory & License Check
        run: cargo deny check
      - name: Run Tests
        run: cargo test --workspace
      - name: Run Clippy
        run: cargo clippy --workspace --tests -- -D warnings
      - name: Check Formatting
        run: cargo fmt --check

  miri-test:
    name: Miri Test (justapi-core)
    runs-on: ubuntu-latest
    needs: test-rust
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: miri
      - name: Run Miri
        run: cargo miri test -p justapi-core
        env:
          MIRIFLAGS: -Zmiri-disable-isolation

  build-wheels:
    name: Build Wheels (${{ matrix.os }} - ${{ matrix.target }})
    runs-on: ${{ matrix.os }}
    needs: miri-test
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64
            args: --manylinux 2_28
          - os: ubuntu-latest
            target: aarch64
            args: --manylinux 2_28
          - os: ubuntu-latest
            target: x86_64
            args: --musllinux 1_2
          - os: macos-latest
            target: x86_64
          - os: macos-latest
            target: aarch64
          - os: windows-latest
            target: x64

    steps:
      - uses: actions/checkout@v4
      - uses: astral-sh/setup-uv@v5
        with:
          python-version: '3.12'
          enable-cache: true
          cache-dependency-glob: crates/justapi-py/pyproject.toml
      - name: Build wheels via Maturin
        uses: PyO3/maturin-action@v1
        with:
          target: ${{ matrix.target }}
          args: --release --out dist ${{ matrix.args }}
          manifest-path: crates/justapi-py/Cargo.toml
      - name: Install wheel & test
        shell: bash
        run: |
          uv pip install dist/*.whl pytest
          python -m pytest crates/justapi-py/tests/ -v --tb=short
      - name: Upload Wheels
        uses: actions/upload-artifact@v4
        with:
          name: wheels-${{ matrix.os }}-${{ matrix.target }}-${{ strategy.job-index }}
          path: dist/*.whl

  publish:
    name: Publish to PyPI
    runs-on: ubuntu-latest
    needs: build-wheels
    if: startsWith(github.ref, 'refs/tags/v')
    environment: pypi
    permissions:
      id-token: write
    steps:
      - uses: actions/checkout@v4
      - uses: astral-sh/setup-uv@v5
        with:
          python-version: '3.12'
      - uses: actions/download-artifact@v4
        with:
          pattern: wheels-*
          merge-multiple: true
          path: dist
      - name: Publish
        run: uv publish --package-dir crates/justapi-py --trusted-publishing always --verbose