update to latest pngquant 3.0.3, use latest maturin #44
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: CI | |
on: | |
push: | |
branches: [main] | |
tags: ["v*.*.*"] | |
pull_request: | |
branches: [main] | |
jobs: | |
build_sdist: | |
name: Build Source Distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
submodules: recursive | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Build sdist | |
run: python build.py sdist | |
- name: Check metadata | |
run: twine check dist/*.tar.gz | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pure | |
path: dist/*.tar.gz | |
build_macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: x86_64-apple-darwin | |
profile: minimal | |
default: true | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Build wheel - x86_64 | |
run: python build.py wheel | |
- name: Install wheel | |
run: | | |
pip install --no-index --find-links dist/ --force-reinstall pngquant-cli | |
which pngquant | |
pngquant --version | |
- name: Build wheels - universal2 | |
run: python build.py wheel --universal2 | |
- name: Upload wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos | |
path: dist/*.whl | |
build_windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
platform: [ | |
{ python-architecture: "x64", target: "x86_64-pc-windows-msvc" }, | |
{ python-architecture: "x86", target: "i686-pc-windows-msvc" }, | |
] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
architecture: ${{ matrix.platform.python-architecture }} | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.platform.target }} | |
profile: minimal | |
default: true | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Build wheel | |
run: python build.py wheel --target ${{matrix.platform.target}} | |
- name: Install wheel | |
shell: bash | |
run: | | |
pip install --no-index --find-links dist/ --force-reinstall pngquant-cli | |
which pngquant | |
pngquant --version | |
- name: Upload wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-${{matrix.platform.python-architecture}} | |
path: dist/*.whl | |
build_linux: | |
runs-on: ubuntu-latest | |
container: | |
image: docker://quay.io/pypa/manylinux_2_28_x86_64:latest | |
env: | |
PYTHON_DIR: /opt/python/cp38-cp38/bin/ | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
default: true | |
- name: Install dependencies | |
# I haven't figured out how to make $PATH persist throughout the job. | |
# THe `echo "PATH=..." >> GITHUB_ENV` trick doesn't seem to work inside the | |
# docker container. Hence I do export PATH=... each time. | |
run: | | |
export PATH=$PYTHON_DIR:$PATH | |
python --version | |
pip --version | |
pip install -U pip | |
pip install -r requirements.txt | |
- name: Build wheel | |
run: | | |
export PATH=$PYTHON_DIR:$PATH | |
python build.py wheel | |
- name: Install wheel | |
run: | | |
export PATH=$PYTHON_DIR:$PATH | |
pip install --no-index --find-links dist/ --force-reinstall pngquant-cli | |
which pngquant | |
pngquant --version | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux | |
path: dist/*.whl | |
release: | |
name: Release on tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [build_sdist, build_macos, build_windows, build_linux ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: dist | |
- name: Extract release notes from annotated tag message | |
id: release_notes | |
env: | |
# e.g. v0.1.0a1, v1.2.0b2 or v2.3.0rc3, but not v1.0.0 | |
PRERELEASE_TAG_PATTERN: "v[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+([ab]|rc)[[:digit:]]+" | |
run: | | |
# GH checkout action doesn't preserve tag annotations, we must fetch them | |
# https://github.com/actions/checkout/issues/290 | |
git fetch --tags --force | |
# strip leading 'refs/tags/' to get the tag name | |
TAG_NAME="${GITHUB_REF##*/}" | |
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV" | |
# Dump tag message to temporary .md file (excluding the PGP signature at the bottom) | |
TAG_MESSAGE=$(git tag -l --format='%(contents)' $TAG_NAME | sed -n '/-----BEGIN PGP SIGNATURE-----/q;p') | |
echo "$TAG_MESSAGE" > "${{ runner.temp }}/release_notes.md" | |
# if the tag has a pre-release suffix mark the Github Release accordingly | |
if egrep -q "$PRERELEASE_TAG_PATTERN" <<< "$TAG_NAME"; then | |
echo "Tag contains a pre-release suffix" | |
echo "IS_PRERELEASE=true" >> "$GITHUB_ENV" | |
else | |
echo "Tag does not contain pre-release suffix" | |
echo "IS_PRERELEASE=false" >> "$GITHUB_ENV" | |
fi | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: ${{ env.TAG_NAME }} | |
tag_name: ${{ github.ref }} | |
body_path: "${{ runner.temp }}/release_notes.md" | |
draft: false | |
prerelease: ${{ env.IS_PRERELEASE }} | |
files: dist/* | |
- uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} | |
skip_existing: true |