Don't use Python3.7 in CI #367
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: | |
- master | |
tags: | |
- v* | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Test | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Test in Windows | |
- platform: windows-latest | |
pytest-version: '7.1.2' | |
blender-version: '3.1.2' | |
# Using 3.10 in Windows due to PIP encoding errors: | |
# https://github.com/pypa/pip/issues/11066 | |
python-version: '3.10' | |
# Test previous Blender versions | |
- platform: ubuntu-latest | |
pytest-version: '7.1.2' | |
blender-version: '2.83.20' | |
python-version: '3.8' | |
- platform: ubuntu-latest | |
pytest-version: '7.1.2' | |
blender-version: '2.82' | |
python-version: '3.8' | |
# Test against Pytest v7 | |
- platform: ubuntu-latest | |
pytest-version: '7.2.0' | |
blender-version: '3.1.1' | |
python-version: '3.10' | |
# Test against Pytest v6 | |
- platform: ubuntu-latest | |
pytest-version: '6.2.5' | |
blender-version: '2.93.9' | |
python-version: '3.9' | |
# Latest Blender (Py311) | |
- platform: ubuntu-latest | |
pytest-version: '7.2.0' | |
blender-version: '3.1.2' | |
python-version: '3.11' | |
# Latest Blender (Py312) | |
- platform: ubuntu-latest | |
pytest-version: '7.4.0' | |
blender-version: '3.1.2' | |
python-version: 3.12.0-rc.1 | |
# Test in MacOS (Py39) | |
- platform: macos-latest | |
pytest-version: '6.2.5' | |
blender-version: '2.93.9' | |
python-version: '3.9' | |
# Test in MacOS (Py310) | |
- platform: macos-latest | |
pytest-version: '7.1.2' | |
blender-version: '3.1.2' | |
python-version: '3.10' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python v${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade PIP | |
run: python -m pip install --upgrade pip | |
- name: Cache Blender ${{ matrix.blender-version }} | |
uses: actions/cache@v3 | |
id: cache-blender | |
with: | |
path: | | |
blender-* | |
_blender-executable-path.txt | |
key: ${{ runner.os }}-${{ matrix.blender-version }} | |
# Download Blender on Linux and MacOS | |
- name: Download Blender ${{ matrix.blender-version }} | |
if: | | |
steps.cache-blender.outputs.cache-hit != 'true' && | |
runner.os != 'Windows' | |
run: | | |
set -ex | |
python -m pip install --upgrade blender-downloader | |
python -m pip list | |
printf "%s" "$(blender-downloader ${{ matrix.blender-version }} --extract --remove-compressed --print-blender-executable --quiet)" > _blender-executable-path.txt | |
cat _blender-executable-path.txt | |
# Download Blender on Windows | |
- name: Download Blender ${{ matrix.blender-version }} | |
if: | | |
steps.cache-blender.outputs.cache-hit != 'true' && | |
runner.os == 'Windows' | |
run: | | |
Set-PSDebug -Trace 2 | |
python -m pip install --upgrade blender-downloader | |
python -m pip list | |
blender-downloader ${{ matrix.blender-version }} --extract --remove-compressed --print-blender-executable --quiet | Out-File -FilePath _blender-executable-path.txt | |
get-content _blender-executable-path.txt | |
# Install dependencies on Unix-based systems | |
- name: Install dependencies | |
if: runner.os != 'Windows' | |
id: install-dependencies-unix | |
run: | | |
set -ex | |
python -m pip install .[test] pytest==${{ matrix.pytest-version }} | |
BLENDER_EXECUTABLE="$(< _blender-executable-path.txt)" | |
echo "BLENDER_EXECUTABLE: $BLENDER_EXECUTABLE" | |
pytest-blender --blender-executable "$BLENDER_EXECUTABLE" | |
PYTHON_BLENDER_EXECUTABLE="$(pytest-blender --blender-executable $BLENDER_EXECUTABLE)" | |
echo "PYTHON_BLENDER_EXECUTABLE: $PYTHON_BLENDER_EXECUTABLE" | |
$PYTHON_BLENDER_EXECUTABLE -m ensurepip | |
$PYTHON_BLENDER_EXECUTABLE -m pip install pytest==${{ matrix.pytest-version }} pytest-cov | |
echo "blender-executable=$BLENDER_EXECUTABLE" >> $GITHUB_OUTPUT | |
# Install dependencies on Windows | |
- name: Install dependencies | |
if: runner.os == 'Windows' | |
id: install-dependencies-windows | |
run: | | |
Set-PSDebug -Trace 2 | |
python -m pip install .[test] pytest==${{ matrix.pytest-version }} | |
$BLENDER_EXECUTABLE = get-content _blender-executable-path.txt | |
echo "BLENDER_EXECUTABLE: $BLENDER_EXECUTABLE" | |
pytest-blender --blender-executable $(Get-Variable -Name BLENDER_EXECUTABLE -ValueOnly) | |
$PYTHON_BLENDER_EXECUTABLE = pytest-blender --blender-executable "$(Get-Variable -Name BLENDER_EXECUTABLE -ValueOnly)" | |
echo "PYTHON_BLENDER_EXECUTABLE: $PYTHON_BLENDER_EXECUTABLE" | |
Invoke-Expression "$PYTHON_BLENDER_EXECUTABLE -m pip install pytest==${{ matrix.pytest-version }} pytest-cov" | |
echo "blender-executable=$BLENDER_EXECUTABLE" >> $env:GITHUB_OUTPUT | |
- name: Unit tests | |
if: runner.os != 'Windows' | |
run: pytest -svv --strict-config --strict-markers tests | |
env: | |
BLENDER_EXECUTABLE: ${{ steps.install-dependencies-unix.outputs.blender-executable }} | |
- name: Unit tests | |
if: runner.os == 'Windows' | |
# Created empty pytest.ini file to avoid the reading of setup.cfg | |
# because there is a problem with encoding on Windows, see: | |
# https://github.com/pytest-dev/pytest/issues/4441 | |
# | |
# Note that pytest.ini will always take precedence, even if empty, see: | |
# https://docs.pytest.org/en/7.1.x/reference/customize.html#finding-the-rootdir | |
run: | | |
New-Item -Path 'pytest.ini' -ItemType File | |
pytest -svv -p no:pytest-blender -p pytester --strict-config --strict-markers tests | |
env: | |
BLENDER_EXECUTABLE: ${{ steps.install-dependencies-windows.outputs.blender-executable }} | |
- name: Integration tests | |
if: runner.os != 'Windows' | |
run: sh tests/integration.sh | |
env: | |
BLENDER_EXECUTABLE: ${{ steps.install-dependencies-unix.outputs.blender-executable }} | |
# TODO: integration tests on Windows? | |
build-sdist: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: test | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
name: Install Python | |
with: | |
python-version: '3.11' | |
- name: Build sdist | |
run: python setup.py sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
build-wheel: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: test | |
name: Build wheel | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
name: Set up Python | |
with: | |
python-version: '3.11' | |
- name: Install wheel | |
run: python -m pip install --upgrade wheel | |
- name: Build wheel | |
run: python setup.py bdist_wheel | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./dist/*.whl | |
pypi-upload: | |
name: Upload to PyPI | |
needs: | |
- build-sdist | |
- build-wheel | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
skip_existing: true | |
# repository_url: https://test.pypi.org/legacy/ | |
release: | |
name: Release | |
needs: | |
- build-sdist | |
- build-wheel | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get tag metadata | |
id: tag | |
run: | | |
TAG_TITLE=${GITHUB_REF#refs/*/} | |
echo "title=$TAG_TITLE" >> $GITHUB_OUTPUT | |
git -c protocol.version=2 fetch --prune --progress \ | |
--no-recurse-submodules origin \ | |
+refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* | |
TAG_BODY="$(git tag -l --format='%(contents)' $TAG_TITLE)" | |
TAG_BODY="${TAG_BODY//'%'/'%25'}" | |
TAG_BODY="${TAG_BODY//$'\n'/'%0A'}" | |
TAG_BODY="${TAG_BODY//$'\r'/'%0D'}" | |
echo "body=$TAG_BODY" >> $GITHUB_OUTPUT | |
- name: Create Release | |
uses: actions/create-release@v1.1.4 | |
id: create-release | |
with: | |
tag_name: ${{ steps.tag.outputs.title }} | |
release_name: ${{ steps.tag.outputs.title }} | |
body: ${{ steps.tag.outputs.body }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/download-artifact@v3 | |
name: Download builds | |
with: | |
name: artifact | |
path: dist | |
- uses: shogo82148/actions-upload-release-asset@v1.3.0 | |
name: Upload release assets | |
with: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
asset_path: dist/* |