1.1.4 #3
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: Release | |
on: | |
release: | |
types: [published] | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build: | |
name: Build | |
strategy: | |
matrix: | |
python: ["3.7", "3.8", "3.9", "3.10", "3.11"] | |
target: | |
- id: 'linux-amd64' | |
os: 'ubuntu-latest' | |
target-name: 'x86_64-unknown-linux-gnu' | |
rust-toolchain: 'stable' | |
llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz' | |
# - id: 'linux-aarch64' | |
# os: ['self-hosted', 'linux', 'ARM64', 'python'] | |
# target-name: 'aarch64-unknown-linux-gnu' | |
# rust-toolchain: 'stable' | |
# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/11.x/linux-aarch64.tar.gz' | |
# - id: 'darwin-amd64' | |
# os: 'macos-latest' | |
# target-name: 'x86_64-apple-darwin' | |
# rust-toolchain: 'stable' | |
# llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz' | |
# | |
# - id: 'windows-amd64' | |
# os: 'windows-latest' | |
# target-name: 'x86_64-pc-windows-msvc' | |
# rust-toolchain: 'stable' | |
# # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/11.x/windows-amd64.tar.gz' | |
# llvm_choco_version: 13.0.0 | |
fail-fast: true | |
runs-on: ${{ matrix.target.os }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
if: matrix.target.id == 'linux-amd64' | |
run: | | |
sudo apt-get update -y | |
wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb | |
sudo apt install ./libtinfo5_6.3-2ubuntu0.1_amd64.deb | |
echo "LD_LIBRARY_PATH=/lib/x86_64-linux-gnu" >> $GITHUB_ENV | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.target.rust-toolchain }} | |
default: true | |
override: true | |
target: ${{ matrix.target.target-name }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Set current Python version | |
shell: bash | |
run: | | |
echo "${{ matrix.python }}" > .python-version | |
- name: Set up Python ${{ matrix.python }} (amd64) | |
if: matrix.target.id != 'linux-aarch64' | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Set up Python ${{ matrix.python }} (aarch64) | |
if: matrix.target.id == 'linux-aarch64' | |
shell: bash | |
run: | | |
test -d $HOME/.pyenv || curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash | |
export PATH="$HOME/.pyenv/bin:$PATH" | |
eval "$(pyenv init -)" | |
eval "$(pyenv virtualenv-init -)" | |
pyenv install --list | grep '^ ${{ matrix.python }}' | tail -n 1 | tr -d '[:space:]' > .python-version | |
pyenv install --skip-existing "$(cat .python-version)" | |
- name: Install LLVM (Choco - Windows) | |
if: matrix.target.llvm_choco_version | |
shell: bash | |
run: | | |
choco install llvm --version ${{ matrix.target.llvm_choco_version }} --allow-downgrade | |
cd 'C:\Program Files\LLVM\' | |
LLVM_DIR=$(pwd) | |
echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV | |
- name: Install LLVM (macOS Apple Silicon) | |
if: matrix.target.os == 'macos-latest' && !matrix.target.llvm_url | |
run: | | |
brew install llvm | |
- name: Install LLVM | |
if: matrix.target.llvm_url | |
shell: bash | |
run: | | |
curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.target.llvm_url }} -L -o llvm.tar.xz | |
LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} | |
mkdir ${LLVM_DIR} | |
tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} | |
echo "${LLVM_DIR}/bin" >> $GITHUB_PATH | |
echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV | |
env: | |
LLVM_DIR: .llvm | |
- name: Set up utilities | |
shell: bash | |
run: | | |
export PATH="$HOME/.cargo/bin:$PATH" | |
export PATH="$HOME/.pyenv/versions/$(cat .python-version)/bin:$PATH" | |
test -f $HOME/.cargo/bin/just || cargo install just | |
test -f $HOME/.cargo/bin/fd || cargo install fd-find | |
- name: Set up extra utilities for macOS | |
if: matrix.target.id == 'darwin-amd64' | |
shell: bash | |
run: | | |
brew install gnu-sed | |
- name: Install the prelude | |
shell: bash | |
run: | | |
export PATH="$HOME/.cargo/bin:$PATH" | |
export PATH="$HOME/.pyenv/versions/$(cat .python-version)/bin:$PATH" | |
just prelude | |
- name: Compile the library | |
shell: bash | |
run: | | |
export PATH="$HOME/.cargo/bin:$PATH" | |
export PATH="$HOME/.pyenv/versions/$(cat .python-version)/bin:$PATH" | |
if test -d .env/bin/; then source .env/bin/activate; else source .env/Scripts/activate; fi | |
maturin list-python | |
PYTHON_INTERPRETER=$(maturin list-python 2>&1 | grep -o "CPython $(cat .python-version | grep -o -E '^[^\.]+\.[^\.]+').* at .*" | cut -d' ' -f 4 | tr '\\' '/') | |
echo "Selected interpreter: ${PYTHON_INTERPRETER}" | |
just build-all "${{ matrix.target.target-name }}" | |
- name: Run all the tests | |
shell: bash | |
run: | | |
export PATH="$HOME/.cargo/bin:$PATH" | |
export PATH="$HOME/.pyenv/versions/$(cat .python-version)/bin:$PATH" | |
if test -d .env/bin/; then source .env/bin/activate; else source .env/Scripts/activate; fi | |
just test | |
- name: Build the wheels | |
shell: bash | |
run: | | |
export PATH="$HOME/.cargo/bin:$PATH" | |
export PATH="$HOME/.pyenv/versions/$(cat .python-version)/bin:$PATH" | |
if test -d .env/bin/; then source .env/bin/activate; else source .env/Scripts/activate; fi | |
maturin list-python | |
PYTHON_INTERPRETER=$(maturin list-python 2>&1 | grep -o "CPython $(cat .python-version | grep -o -E '^[^\.]+\.[^\.]+').* at .*" | cut -d' ' -f 4 | tr '\\' '/') | |
echo "Selected interpreter: ${PYTHON_INTERPRETER}" | |
just build-all-wheels "${PYTHON_INTERPRETER}" "${{ matrix.target.target-name }}" | |
just build-any-wheel | |
- name: Inspect wheels | |
shell: bash | |
run: | | |
ls -lhaGiR target/wheels/*.whl | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.python }}-${{ matrix.target.id }} | |
path: target/wheels | |
if-no-files-found: error | |
retention-days: 1 | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Download the Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Inspect artifacts | |
id: inspect_artifacts | |
shell: bash | |
run: | | |
ls -lhaGiR artifacts/* | |
for wheel in $(ls artifacts/wheels-*/*.whl | tr '/' '\t' | sort -k 3 | uniq -f 2 | tr '\t' '/') | |
do | |
echo -e "${wheel}\t$(basename ${wheel})\tapplication/x-pywheel+zip" | |
done | tee wheels | |
echo ::set-output name=wheels::wheels | |
- name: Set current Python version | |
shell: bash | |
run: | | |
echo "3.11" > .python-version | |
- name: Set up Python ${{ matrix.python }} (amd64) | |
if: matrix.target.id != 'linux-aarch64' | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.11 | |
- name: Set up Python ${{ matrix.python }} (aarch64) | |
if: matrix.target.id == 'linux-aarch64' | |
shell: bash | |
run: | | |
test -d $HOME/.pyenv || curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash | |
export PATH="$HOME/.pyenv/bin:$PATH" | |
eval "$(pyenv init -)" | |
eval "$(pyenv virtualenv-init -)" | |
pyenv install --list | grep '^ 3.11' | tail -n 1 | tr -d '[:space:]' > .python-version | |
pyenv install --skip-existing "$(cat .python-version)" | |
# Caching is disabled because it interferes with artifact creation | |
#- uses: Swatinem/rust-cache@v1 | |
- name: Set up utilities | |
shell: bash | |
run: | | |
export PATH="$HOME/.cargo/bin:$PATH" | |
export PATH="$HOME/.pyenv/versions/$(cat .python-version)/bin:$PATH" | |
test -f $HOME/.cargo/bin/just || cargo install just | |
- name: Install the prelude | |
shell: bash | |
run: | | |
export PATH="$HOME/.cargo/bin:$PATH" | |
export PATH="$HOME/.pyenv/versions/$(cat .python-version)/bin:$PATH" | |
just prelude | |
# - name: Publish the wheels on PyPI | |
# shell: bash | |
# env: | |
# TWINE_PASSWORD: ${{ secrets.MATURIN_PASSWORD }} | |
# run: | | |
# export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH" | |
# export PATH="$HOME/.pyenv/versions/$(cat .python-version)/bin:$PATH" | |
# if test -d .env/bin/; then source .env/bin/activate; else source .env/Scripts/activate; fi | |
# just publish pypi $(cat wheels | cut -f 1 | grep --invert-match aarch64) | |
- name: Upload the wheels as Github release assets | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ${{ steps.inspect_artifacts.outputs.wheels }} |