allow prerelease for certain types #2
Workflow file for this run
This file contains 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: Build | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build-linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
build: | |
- arch: 'x64' | |
type: 'cuda' | |
- arch: 'x64' | |
type: 'cpu' | |
- arch: 'x64' | |
type: 'rocm' | |
runs-on: ubuntu-latest | |
env: | |
artifact_name: linux-${{ matrix.build.arch }}-${{ matrix.build.type }}.tar.zst | |
python_url: 'https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9+20240415-x86_64_v3-unknown-linux-gnu-install_only.tar.gz' | |
uv_url: 'https://github.com/astral-sh/uv/releases/download/0.1.35/uv-x86_64-unknown-linux-gnu.tar.gz' | |
requirements: requirements.${{ matrix.build.type }}.txt | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache UV Download | |
uses: actions/cache@v4 | |
id: cache-uv | |
with: | |
path: uv | |
key: ${{ runner.os }}-uv | |
- name: Download UV | |
if: steps.cache-uv.outputs.cache-hit != 'true' | |
run: curl -L -o uv.tar.gz ${{ env.uv_url }} && tar --strip-components=1 -xzf uv.tar.gz && rm uv.tar.gz | |
- name: Cache Python Download | |
id: cache-python | |
uses: actions/cache@v4 | |
with: | |
path: python.tar.gz | |
key: ${{ runner.os }}-python | |
- name: Download Python | |
if: steps.cache-python.outputs.cache-hit != 'true' | |
run: curl -L -o python.tar.gz ${{ env.python_url }} | |
- name: Cache UV Packages | |
uses: actions/cache@v4 | |
id: cache-uv-packages | |
with: | |
path: ~/.cache/uv | |
key: ${{ runner.os }}-${{ matrix.build.type }}-packages | |
- name: Extract Python | |
run: tar -xzf python.tar.gz | |
- name: Install packages | |
run: ./uv pip install -r ${{ env.requirements }} --python ./python/bin/python | |
- name: Build artifact | |
run: tar -I"zstd -9 -T0" -cf /tmp/${{ env.artifact_name }} python | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.artifact_name }} | |
path: /tmp/${{ env.artifact_name }} | |
compression-level: 0 | |
build-windows: | |
strategy: | |
fail-fast: false | |
matrix: | |
build: | |
- arch: 'x64' | |
type: 'cuda' | |
- arch: 'x64' | |
type: 'directml' | |
- arch: 'x64' | |
type: 'cpu' | |
runs-on: windows-latest | |
env: | |
artifact_name: win32-${{ matrix.build.arch }}-${{ matrix.build.type }}.tar.zst | |
python_url: 'https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9+20240415-x86_64-pc-windows-msvc-install_only.tar.gz' | |
uv_url: 'https://github.com/astral-sh/uv/releases/download/0.1.35/uv-x86_64-pc-windows-msvc.zip' | |
requirements: requirements.${{ matrix.build.type }}.txt | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache UV Download | |
uses: actions/cache@v4 | |
id: cache-uv | |
with: | |
path: uv.exe | |
key: ${{ runner.os }}-uv | |
- name: Download UV | |
if: steps.cache-uv.outputs.cache-hit != 'true' | |
run: curl -L -o uv.zip ${{ env.uv_url }} && unzip uv.zip -d . && rm uv.zip | |
- name: Cache Python Download | |
id: cache-python | |
uses: actions/cache@v4 | |
with: | |
path: python.tar.gz | |
key: ${{ runner.os }}-python | |
- name: Download Python | |
if: steps.cache-python.outputs.cache-hit != 'true' | |
run: curl -L -o python.tar.gz ${{ env.python_url }} | |
- name: Cache UV Packages | |
uses: actions/cache@v4 | |
id: cache-uv-packages | |
with: | |
path: ~\AppData\Local\uv\cache | |
key: ${{ runner.os }}-${{ matrix.build.type }}-packages | |
- name: Extract Python | |
run: tar -xzf python.tar.gz | |
- name: Install packages | |
run: .\uv.exe pip install -r ${{ env.requirements }} --python .\python\python.exe | |
- name: Build artifact | |
run: cd python && tar -cf - * | zstd -9 -T0 > C:\WINDOWS\Temp\${{ env.artifact_name }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.artifact_name }} | |
path: C:\WINDOWS\Temp\${{ env.artifact_name }} | |
compression-level: 0 | |
build-mac-arm: | |
strategy: | |
fail-fast: false | |
matrix: | |
build: | |
- arch: 'arm64' | |
type: 'cpu' | |
runs-on: macos-14 | |
env: | |
artifact_name: darwin-${{ matrix.build.arch }}-${{ matrix.build.type }}.tar.zst | |
python_url: 'https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9+20240415-aarch64-apple-darwin-install_only.tar.gz' | |
requirements: requirements.${{ matrix.build.type }}.txt | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: brew update && brew install uv | |
- name: Cache Python Download | |
id: cache-python | |
uses: actions/cache@v4 | |
with: | |
path: python.tar.gz | |
key: ${{ runner.os }}-python | |
- name: Download Python | |
if: steps.cache-python.outputs.cache-hit != 'true' | |
run: curl -L -o python.tar.gz ${{ env.python_url }} | |
- name: Cache UV Packages | |
uses: actions/cache@v4 | |
id: cache-uv-packages | |
with: | |
path: ~/.cache/uv | |
key: ${{ runner.os }}-${{ matrix.build.type }}-packages | |
- name: Extract Python | |
run: tar -xzf python.tar.gz | |
- name: Install packages | |
run: uv pip install -r ${{ env.requirements }} --python ./python/bin/python | |
- name: Build artifact | |
run: cd python && tar -cf - * | zstd -9 -T0 > /tmp/${{ env.artifact_name }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.artifact_name }} | |
path: /tmp/${{ env.artifact_name }} | |
compression-level: 0 | |
build-mac-x86: | |
strategy: | |
fail-fast: false | |
matrix: | |
build: | |
- arch: 'x64' | |
type: 'cpu' | |
runs-on: macos-13 | |
env: | |
artifact_name: darwin-${{ matrix.build.arch }}-${{ matrix.build.type }}.tar.zst | |
python_url: 'https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9+20240415-x86_64-apple-darwin-install_only.tar.gz' | |
requirements: requirements.${{ matrix.build.type }}.txt | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: brew update && brew install uv | |
- name: Cache Python Download | |
id: cache-python | |
uses: actions/cache@v4 | |
with: | |
path: python.tar.gz | |
key: ${{ runner.os }}-python | |
- name: Download Python | |
if: steps.cache-python.outputs.cache-hit != 'true' | |
run: curl -L -o python.tar.gz ${{ env.python_url }} | |
- name: Cache UV Packages | |
uses: actions/cache@v4 | |
id: cache-uv-packages | |
with: | |
path: ~/.cache/uv | |
key: ${{ runner.os }}-${{ matrix.build.type }}-packages | |
- name: Extract Python | |
run: tar -xzf python.tar.gz | |
- name: Install packages | |
run: uv pip install -r ${{ env.requirements }} --python ./python/bin/python | |
- name: Build artifact | |
run: cd python && tar -cf - * | zstd -9 -T0 > /tmp/${{ env.artifact_name }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.artifact_name }} | |
path: /tmp/${{ env.artifact_name }} | |
compression-level: 0 | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: | |
- build-linux | |
- build-windows | |
- build-mac-arm | |
- build-mac-x86 | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- run: 'for filename in ./*.zst; do split -d -b 2000000000 "$filename" "$filename."; rm "$filename"; done' | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: '*.zst.*' |