Skip to content

fix repo/ref name

fix repo/ref name #5

Workflow file for this run

name: Test and publish PNL release
on:
push:
tags:
- 'v*'
jobs:
create-python-dist:
runs-on: ubuntu-latest
strategy:
matrix:
# Python version in matrix for easier reference
python-version: [3.8]
environment: test-pypi
outputs:
sdist: ${{ steps.create_dist.outputs.sdist }}
wheel: ${{ steps.create_dist.outputs.wheel }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Create Python Dist files
id: create_dist
shell: bash
run: |
# We don't care about the python version used.
pip install setuptools wheel
python setup.py sdist
python setup.py bdist_wheel
cd dist
echo "sdist=$(ls *.tar.gz)" >> $GITHUB_OUTPUT
echo "wheel=$(ls *.whl)" >> $GITHUB_OUTPUT
- name: Upload Python dist files
uses: actions/upload-artifact@v4
with:
name: Python-dist-files
path: dist/
retention-days: 1
- name: Upload dist files to test PyPI
shell: bash
run: |
# Include implicit dependency on setuptools{,-rust} and preinstall wheel
pip install setuptools setuptools-rust wheel
pip install twine
# This expects TWINE_USERNAME, TWINE_PASSWORD, and TWINE_REPOSITORY_URL
# environment variables
# It's not possible to condition steps on env or secrets,
# We need an explicit check here
if [ -n "$TWINE_USERNAME" -a -n "$TWINE_PASSWORD" ]; then
twine upload dist/*
else
echo "::warning::Not uploading to test PyPI, no credentials available!"
fi
env:
TWINE_USERNAME: ${{ secrets.TWINE_TEST_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_TEST_PASSWORD }}
TWINE_REPOSITORY_URL: ${{ secrets.TWINE_TEST_REPOSITORY_URL }}
test-release:
if: false
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.11', '3.12']
python-architecture: ['x64']
extra-args: ['']
os: [ubuntu, macos, windows]
version-restrict: ['']
include:
# code-coverage build on macos python 3.9
- python-version: '3.9'
os: macos
extra-args: '--cov=psyneulink'
# --forked run of python only tests
# Python tests are enough to test potential naming issues
- python-version: '3.9'
os: ubuntu
extra-args: '--forked -m "not llvm"'
# add 32-bit build on windows
- python-version: '3.8'
python-architecture: 'x86'
os: windows
# fp32 run on linux python 3.10
- python-version: '3.10'
os: ubuntu
extra-args: '--fp-precision=fp32'
# --benchmark-enable run on macos python 3.10
- python-version: '3.10'
os: macos
# pytest needs both '--benchmark-only' and '-m benchmark'
# The former fails the test if benchmarks cannot be enabled
# (e.g. due to --dist setting)
# The latter works around a crash in pytest when collecting tests:
# https://github.com/ionelmc/pytest-benchmark/issues/243
extra-args: '-m benchmark --benchmark-enable --benchmark-only --benchmark-min-rounds=2 --benchmark-max-time=0.001 --benchmark-warmup=off -n0 --dist=no'
# add python 3.7 with deps restricted to min supported version
- python-version: '3.7'
python-architecture: 'x64'
os: ubuntu
version-restrict: 'min'
# add python 3.8 build on macos since 3.7 is broken
# https://github.com/actions/virtual-environments/issues/4230
# use default python-architecture
- python-version: '3.8'
os: macos
exclude:
# 3.7 is broken on macos-11,
# https://github.com/actions/virtual-environments/issues/4230
- python-version: '3.7'
os: macos
runs-on: ${{ matrix.os }}
needs: [create-python-dist]
steps:
- name: Download dist files
uses: actions/download-artifact@v4
with:
name: Python-dist-files
path: dist/
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# The installation _could_ reuse the 'install-pnl' action,
# but actions deploys workarounds that we want to avoid here.
- name: MacOS dependencies
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install graphviz
if: startsWith(runner.os, 'macOS')
- name: Linux dependencies
run: sudo apt-get install -y graphviz
if: startsWith(runner.os, 'Linux')
- name: Windows dependencies
run: choco install --no-progress -y graphviz --version=2.38.0.20190211
if: startsWith(runner.os, 'Windows')
- name: Install wheel
shell: bash
if: matrix.dist == 'wheel'
run: pip install dist/${{ needs.create-python-dist.outputs.wheel }}[dev]
- name: Install sdist
shell: bash
if: matrix.dist == 'sdist'
run: pip install dist/${{ needs.create-python-dist.outputs.sdist }}[dev]
- name: Get tests from the repository
uses: actions/checkout@v4
- name: Run tests
shell: bash
# run only tests/. We don't care about codestyle/docstyle at this point
timeout-minutes: 80
run: |
# remove sources to prevent conflict with the isntalled package
rm -r -f psyneulink/ docs/ bin/ Matlab/
# run tests
echo "<skipped>" pytest --junit-xml=tests_out.xml --verbosity=0 -n auto tests
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-${{ matrix.python-version }}
path: tests_out.xml
retention-days: 30
if: success() || failure()
publish-pypi:
runs-on: ubuntu-latest
needs: [create-python-dist, test-release]
environment: pypi
steps:
- name: Download dist files
uses: actions/download-artifact@v4
with:
name: Python-dist-files
path: dist/
- name: Upload dist files to PyPI
shell: bash
run: |
# Include implicit dependency on setuptools{,-rust} and preinstall wheel
pip3 install --user setuptools setuptools-rust wheel
pip3 install --user twine
# This expects TWINE_USERNAME, TWINE_PASSWORD, and TWINE_REPOSITORY_URL
# environment variables
# It's not possible to condition steps on env or secrets,
# We need an explicit check here
if [ -n "$TWINE_USERNAME" -a -n "$TWINE_PASSWORD" ]; then
echo "<skipped> twine upload dist/*"
else
echo "::warning::Not uploading to PyPI, no credentials available!"
fi
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_REPOSITORY_URL: ${{ secrets.TWINE_REPOSITORY_URL }}
publish-github:
runs-on: ubuntu-latest
needs: [create-python-dist] #, test-release]
environment: gh-release
permissions:
contents: write
steps:
- name: Download dist files
uses: actions/download-artifact@v4
with:
name: Python-dist-files
path: dist/
- name: Upload dist files to release
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
previous_release=$(gh --repo ${{ github.repository }} | head -n 1 | awk '{print $1}')
gh --repo ${{ github.repository }} release create --verify-tag --generate-notes --notes-start-tag "$previous_release" ${{ github.ref }} dist/*