pydantic model generator for atproto lexicons
at main 169 lines 4.8 kB view raw
1# CI workflow for pmgfal 2name: CI 3 4on: 5 push: 6 branches: [main] 7 tags: ['*'] 8 pull_request: 9 workflow_dispatch: 10 11permissions: 12 contents: read 13 14jobs: 15 linux: 16 runs-on: ubuntu-22.04 17 strategy: 18 matrix: 19 target: [x86_64, aarch64] 20 steps: 21 - uses: actions/checkout@v4 22 - name: Set version from git tag 23 if: startsWith(github.ref, 'refs/tags/') 24 run: sed -i "s/^version = .*/version = \"${GITHUB_REF_NAME#v}\"/" Cargo.toml 25 - name: Build wheels 26 uses: PyO3/maturin-action@v1 27 with: 28 target: ${{ matrix.target }} 29 args: --release --out dist --find-interpreter 30 sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} 31 manylinux: auto 32 - name: Upload wheels 33 uses: actions/upload-artifact@v4 34 with: 35 name: wheels-linux-${{ matrix.target }} 36 path: dist 37 - name: Install uv 38 if: matrix.target == 'x86_64' 39 uses: astral-sh/setup-uv@v7 40 with: 41 enable-cache: true 42 - name: Unit tests 43 if: matrix.target == 'x86_64' 44 run: | 45 unset RUSTC_WRAPPER 46 uv sync 47 uv run pytest -v -m "not integration" 48 49 windows: 50 runs-on: windows-latest 51 steps: 52 - uses: actions/checkout@v4 53 - name: Set version from git tag 54 if: startsWith(github.ref, 'refs/tags/') 55 shell: pwsh 56 run: | 57 $version = $env:GITHUB_REF_NAME -replace '^v', '' 58 (Get-Content Cargo.toml) -replace '^version = .*', "version = `"$version`"" | Set-Content Cargo.toml 59 - name: Build wheels 60 uses: PyO3/maturin-action@v1 61 with: 62 target: x64 63 args: --release --out dist --find-interpreter 64 sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} 65 - name: Upload wheels 66 uses: actions/upload-artifact@v4 67 with: 68 name: wheels-windows-x64 69 path: dist 70 - name: Install uv 71 uses: astral-sh/setup-uv@v7 72 with: 73 enable-cache: true 74 - name: Unit tests 75 shell: pwsh 76 run: | 77 $env:RUSTC_WRAPPER = $null 78 uv sync 79 uv run pytest -v -m "not integration" 80 81 macos: 82 runs-on: ${{ matrix.runner }} 83 strategy: 84 matrix: 85 include: 86 - runner: macos-13 87 target: x86_64 88 - runner: macos-14 89 target: aarch64 90 steps: 91 - uses: actions/checkout@v4 92 - name: Set version from git tag 93 if: startsWith(github.ref, 'refs/tags/') 94 run: sed -i '' "s/^version = .*/version = \"${GITHUB_REF_NAME#v}\"/" Cargo.toml 95 - name: Build wheels 96 uses: PyO3/maturin-action@v1 97 with: 98 target: ${{ matrix.target }} 99 args: --release --out dist --find-interpreter 100 sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} 101 - name: Upload wheels 102 uses: actions/upload-artifact@v4 103 with: 104 name: wheels-macos-${{ matrix.target }} 105 path: dist 106 - name: Install uv 107 uses: astral-sh/setup-uv@v7 108 with: 109 enable-cache: true 110 - name: Unit tests 111 run: | 112 unset RUSTC_WRAPPER 113 uv sync 114 uv run pytest -v -m "not integration" 115 116 integration: 117 name: Integration tests 118 runs-on: ubuntu-latest 119 needs: [linux] 120 steps: 121 - uses: actions/checkout@v4 122 - uses: astral-sh/setup-uv@v7 123 with: 124 enable-cache: true 125 - name: Build and install 126 run: | 127 uv sync 128 uv run maturin develop --release 129 - name: Integration tests 130 run: uv run pytest -v -m integration 131 132 sdist: 133 runs-on: ubuntu-latest 134 steps: 135 - uses: actions/checkout@v4 136 - name: Set version from git tag 137 if: startsWith(github.ref, 'refs/tags/') 138 run: sed -i "s/^version = .*/version = \"${GITHUB_REF_NAME#v}\"/" Cargo.toml 139 - name: Build sdist 140 uses: PyO3/maturin-action@v1 141 with: 142 command: sdist 143 args: --out dist 144 - name: Upload sdist 145 uses: actions/upload-artifact@v4 146 with: 147 name: wheels-sdist 148 path: dist 149 150 release: 151 name: Release 152 runs-on: ubuntu-latest 153 if: startsWith(github.ref, 'refs/tags/') 154 needs: [linux, windows, macos, sdist] 155 permissions: 156 id-token: write 157 contents: write 158 attestations: write 159 steps: 160 - uses: actions/download-artifact@v4 161 - name: Generate artifact attestation 162 uses: actions/attest-build-provenance@v2 163 with: 164 subject-path: 'wheels-*/*' 165 - name: Publish to PyPI 166 uses: PyO3/maturin-action@v1 167 with: 168 command: upload 169 args: --non-interactive --skip-existing wheels-*/*