v2.12.0-rc1 #822
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - 'releases/**' | |
| pull_request: | |
| release: | |
| types: | |
| - released | |
| - prereleased | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| cramjam-docs: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.12 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cramjam | |
| run: pip install -e . | |
| - name: Build docs | |
| run: | | |
| pip install pdoc | |
| pdoc cramjam --docformat numpy --show-source --mermaid --search -o docs | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs | |
| publish_branch: gh-pages | |
| cramjam-js: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: cramjam-js | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - uses: actions/setup-node@v4 | |
| - name: Install WASM Pack | |
| run: | | |
| curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash | |
| cargo-binstall wasm-pack | |
| - name: Install Deps | |
| run: npm install -D | |
| - name: Build | |
| run: npm run build | |
| - name: Install Build | |
| run: npm run dev | |
| - name: Test | |
| run: npm run test | |
| build-test: | |
| runs-on: ${{ matrix.conf.os }} | |
| name: ${{ matrix.conf.os }}-${{ matrix.python-version }}-${{ matrix.conf.target-triple }}-${{ matrix.conf.target }} | |
| strategy: | |
| fail-fast: ${{ !( startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/tags/') ) }} | |
| matrix: | |
| python-version: | |
| - '3.10' | |
| - '3.11' | |
| - '3.12' | |
| - '3.13' | |
| - '3.14' | |
| - '3.14t' | |
| conf: | |
| - { os: ubuntu-latest, target: x86_64, target-triple: x86_64-unknown-linux-gnu, manylinux: auto } | |
| - { os: ubuntu-latest, target: x86_64, target-triple: x86_64-unknown-linux-musl, manylinux: musllinux_1_1 } | |
| - { os: ubuntu-latest, target: i686, target-triple: i686-unknown-linux-gnu, manylinux: auto } | |
| - { os: ubuntu-latest, target: i686, target-triple: i686-unknown-linux-musl, manylinux: musllinux_1_1 } | |
| - { os: ubuntu-latest, target: aarch64, target-triple: aarch64-unknown-linux-gnu, manylinux: auto } | |
| - { os: ubuntu-latest, target: aarch64, target-triple: aarch64-unknown-linux-musl, manylinux: musllinux_1_1 } | |
| - { os: ubuntu-latest, target: armv7, target-triple: armv7-unknown-linux-gnueabihf, manylinux: auto } | |
| - { os: ubuntu-latest, target: armv7, target-triple: armv7-unknown-linux-musleabihf, manylinux: musllinux_1_1 } | |
| - { os: ubuntu-latest, target: s390x, target-triple: s390x-unknown-linux-gnu, manylinux: auto } | |
| # - { os: ubuntu-latest, target: s390x, target-triple: s390x-unknown-linux-musl, manylinux: musllinux_1_1 } # no target musl for s390x | |
| - { os: ubuntu-latest, target: ppc64le, target-triple: powerpc64le-unknown-linux-gnu, manylinux: auto } | |
| # - { os: ubuntu-latest, target: ppc64le, target-triple: powerpc64le-unknown-linux-musleabihf, manylinux: musllinux_1_1 } # no target musl for ppc64le | |
| - { os: macos-15, target: x86_64, target-triple: x86_64-apple-darwin } | |
| - { os: macos-15, target: aarch64, target-triple: aarch64-apple-darwin } | |
| - { os: macos-15, target: universal2, target-triple: x86_64-apple-darwin } | |
| - { os: windows-latest, target: x86_64, target-triple: x86_64-pc-windows-msvc, python-architecture: x64 } | |
| - { os: windows-latest, target: i686, target-triple: i686-pc-windows-msvc, python-architecture: x86 } | |
| - { os: windows-11-arm, target: aarch64, target-triple: aarch64-pc-windows-msvc, python-architecture: arm64 } | |
| # Python 3.10 has no native ARM64 Windows installer | |
| exclude: | |
| - python-version: '3.10' | |
| conf: { os: windows-11-arm } | |
| include: | |
| # Windows x86_64 pypy | |
| - conf: { os: windows-latest, target: x86_64, target-triple: x86_64-pc-windows-msvc } | |
| python-version: pypy3.10 | |
| - conf: { os: windows-latest, target: x86_64, target-triple: x86_64-pc-windows-msvc } | |
| python-version: pypy3.11 | |
| # Linux x86_64 pypy | |
| - conf: { os: ubuntu-latest, target: x86_64, target-triple: x86_64-unknown-linux-gnu, manylinux: auto } | |
| python-version: pypy3.10 | |
| - conf: { os: ubuntu-latest, target: x86_64, target-triple: x86_64-unknown-linux-gnu, manylinux: auto } | |
| python-version: pypy3.11 | |
| # Linux arm pypy | |
| - conf: { os: ubuntu-latest, target: aarch64, target-triple: aarch64-unknown-linux-gnu, manylinux: auto } | |
| python-version: pypy3.10 | |
| - conf: { os: ubuntu-latest, target: aarch64, target-triple: aarch64-unknown-linux-gnu, manylinux: auto } | |
| python-version: pypy3.11 | |
| # OSX x86_64 pypy | |
| - conf: { os: macos-15, target: x86_64, target-triple: x86_64-apple-darwin } | |
| python-version: pypy3.10 | |
| - conf: { os: macos-15, target: x86_64, target-triple: x86_64-apple-darwin } | |
| python-version: pypy3.11 | |
| # OSX universal2 pypy | |
| - conf: { os: macos-15, target: universal2, target-triple: x86_64-apple-darwin } | |
| python-version: pypy3.10 | |
| - conf: { os: macos-15, target: universal2, target-triple: x86_64-apple-darwin } | |
| python-version: pypy3.11 | |
| # OSX arm pypy | |
| - conf: { os: macos-15, target: aarch64, target-triple: aarch64-apple-darwin } | |
| python-version: pypy3.10 | |
| - conf: { os: macos-15, target: aarch64, target-triple: aarch64-apple-darwin } | |
| python-version: pypy3.11 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| architecture: ${{ matrix.conf.python-architecture }} | |
| allow-prereleases: true | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| target: ${{ matrix.conf.target-triple }} | |
| - name: Set MSVC developer prompt | |
| if: runner.os == 'Windows' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Rust Tests | |
| if: matrix.conf.target == 'x86_64' && !startsWith(matrix.python-version, 'pypy') && matrix.python-version == '3.12' | |
| run: cargo test | |
| - name: Build wheel (OSX - Linux) | |
| if: runner.os != 'Windows' | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.conf.target }} | |
| manylinux: ${{ matrix.conf.manylinux }} | |
| args: -i ${{ matrix.python-version }} --release --out dist | |
| - name: Build wheel (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| python -m pip install maturin delvewheel | |
| maturin build -i python --release --out wheels --target ${{ matrix.conf.target-triple }} | |
| $file = Get-ChildItem -Path "wheels" | Select-Object -First 1 | |
| delvewheel repair -v "wheels\$($file.Name)" -w "dist" | |
| - name: Install built wheel and Test (Native) | |
| # TODO: I'm not sure but the actual collection of tests on windows using pypy3.10 takes forever and/or fails | |
| if: | | |
| !startsWith(matrix.conf.manylinux, 'musl') && | |
| !( matrix.python-version == 'pypy3.10' && runner.os == 'Windows' ) && | |
| ( matrix.conf.target == 'universal2' || (matrix.conf.target == 'aarch64' && runner.os == 'Windows') || (matrix.conf.target == 'x86_64' && runner.os != 'macOS') ) | |
| run: | | |
| # Second install guarantees it's going to install from local dir w/ --no-index | |
| # use first to get in dev dependencies | |
| python -m pip install cramjam[dev] --pre --find-links dist --force-reinstall | |
| python -m pip install cramjam --pre --no-index --find-links dist --force-reinstall | |
| python -m pytest -vs --benchmark-skip -n0 --dist no | |
| # Could use 'distro: alpine_latest' in 'run-on-arch-action' but seems difficult to install a specific version of python | |
| # so we'll just use existing python alpine images to test import and cli use w/o testing archs other than x86_64 | |
| - name: Install built wheel and Test (musllinux) | |
| # TODO: python:3.13-alpine doesn't exist yet | |
| if: startsWith(matrix.conf.manylinux, 'musl') && matrix.conf.target == 'x86_64' && !startsWith(matrix.python-version, '3.14') | |
| run: | | |
| docker run \ | |
| -v $(pwd)/dist:/wheels \ | |
| --rm python:${{ matrix.python-version }}-alpine sh \ | |
| -c "pip install cramjam --no-index --find-links /wheels && python -c 'import cramjam'" | |
| # xref: https://github.com/milesgranger/cramjam/issues/194 | |
| # - name: Install built wheel and Test (Cross) | |
| # if: | | |
| # !startsWith(matrix.conf.manylinux, 'musl') && | |
| # runner.os == 'Linux' && | |
| # contains(fromJson('["3.9", "3.11", "3.13"]'), matrix.python-version ) && | |
| # !startsWith(matrix.python-version, 'pypy') && | |
| # contains(fromJson('["armv6", "armv7", "aarch64", "riscv64", "s390x", "ppc64le"]'), matrix.conf.target) | |
| # uses: uraimo/run-on-arch-action@v2 | |
| # with: | |
| # arch: ${{ matrix.conf.target }} | |
| # distro: ubuntu22.04 | |
| # githubToken: ${{ github.token }} | |
| # # Mount the dist directory as /artifacts in the container | |
| # dockerRunArgs: | | |
| # --volume "${PWD}/dist:/artifacts" | |
| # install: | | |
| # apt-get update | |
| # apt-get install -y --no-install-recommends python3 python3-venv software-properties-common | |
| # add-apt-repository ppa:deadsnakes/ppa | |
| # apt-get update | |
| # apt-get install -y curl python${{ matrix.python-version }}-venv | |
| # run: | | |
| # ls -lrth /artifacts | |
| # PYTHON=python${{ matrix.python-version }} | |
| # $PYTHON -m venv venv | |
| # venv/bin/pip install -U pip | |
| # venv/bin/pip install cramjam --pre --no-index --find-links /artifacts --force-reinstall | |
| # venv/bin/python -c 'import cramjam' | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ ( startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/tags/') ) }} | |
| with: | |
| name: ${{ matrix.conf.os }}-${{ matrix.python-version }}-${{ matrix.conf.target-triple }}-${{ matrix.conf.target }} | |
| path: dist | |
| # build-wasm32-emscripten-pyodide: | |
| # runs-on: ubuntu-latest | |
| # strategy: | |
| # matrix: | |
| # python: | |
| # - "3.12" | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Install Rust toolchain | |
| # uses: dtolnay/rust-toolchain@stable | |
| # with: | |
| # toolchain: nightly | |
| # target: wasm32-unknown-emscripten | |
| # - uses: actions/setup-python@v5 | |
| # with: | |
| # python-version: ${{ matrix.python }} | |
| # - name: Install Emscripten | |
| # uses: mymindstorm/setup-emsdk@v14 | |
| # with: | |
| # # This needs to match the exact expected version pyodide expects...seems a bit brittle TBH, maybe I'm missing something. | |
| # # Discover by updating pyodide in package.json and re-running 'npm run test'; it'll spit out the error of | |
| # # the expected vs actual versions. | |
| # version: '3.1.58' | |
| # - name: Build | |
| # run: | | |
| # pip install maturin | |
| # maturin build --release -i python${{ matrix.python }} --features wasm32-compat --target wasm32-unknown-emscripten -o ./dist | |
| # - uses: actions/setup-node@v3 | |
| # with: | |
| # node-version: '18' | |
| # - run: npm install | |
| # - run: npm run test | |
| # - name: Upload wheels | |
| # uses: actions/upload-artifact@v4 | |
| # if: ${{ ( startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/tags/') ) }} | |
| # with: | |
| # name: wasm32-unknown-emscripten-python${{ matrix.python }} | |
| # path: dist | |
| build-sdist: | |
| name: Build sdists | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.12 | |
| - name: Build sdist cramjam | |
| run: | | |
| python -m pip install build | |
| python -m build --sdist -o ./dist | |
| - name: Upload sdists | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist | |
| pypi-publish: | |
| name: Upload release to PyPI | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| needs: [build-test, build-sdist] | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/cramjam | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: List artifacts | |
| run: ls -lhs dist/ | |
| - name: Remove wasm32 wheels # TODO: https://discuss.python.org/t/support-wasm-wheels-on-pypi/21924 | |
| run: rm -f dist/*wasm32.whl | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true | |
| packages-dir: dist/ | |
| gh-publish: | |
| name: Publish artifacts to GH | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| needs: [build-test, build-sdist] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: List artifacts | |
| run: ls -lhs dist/ | |
| - name: Upload to GitHub | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/* |