Skip to content

Bump version: 0.2.1 → 0.3.0 #23

Bump version: 0.2.1 → 0.3.0

Bump version: 0.2.1 → 0.3.0 #23

Workflow file for this run

name: Python Package CI/CD
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_and_test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: ['3.10', '3.11', '3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
# max-parallel: 3
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python: ${{ matrix.python }}
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel build ruff
- name: Run Linter
run: make style
- name: Build package
run: |
python -m build --sdist --wheel
- name: Create virtual environment
run: python -m venv test_env
- name: Install built package in virtual environment
run: |
source test_env/bin/activate
pip install dist/zsuite*.whl
- name: Copy tests to a separate directory
run: mkdir test_env/tests && cp -r tests/* test_env/tests/
- name: Delete raw code from working directory to ensure tests are isolated
run: rm -rf zsuite
- name: Run tests in isolated environment
run: |
source test_env/bin/activate
pip install -r requirements-dev.txt
cd test_env/tests
pytest
publish:
runs-on: ubuntu-latest
environment: release
if: startsWith(github.ref, 'refs/tags/') && needs.build_and_test.result == 'success'
needs: build_and_test
permissions:
contents: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python: '3.12'
- name: Install build dependencies
run: |
pip install setuptools wheel build
- name: Build package
run: python -m build --sdist --wheel
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1