Skip to content

CI

CI #911

Workflow file for this run

name: CI
on:
push:
pull_request:
schedule:
- cron: '0 8 * * 1' # Each Monday at 8 am
jobs:
Prepare:
runs-on: ubuntu-latest
outputs:
partiels_version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: pip install semver
- name: Get latest Partiels tag if scheduled, else use default
id: version
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ github.event_name }}" = "schedule" ]; then
version=$(curl -s -H "Authorization: token $GH_TOKEN" \
https://api.github.com/repos/Ircam-Partiels/Partiels/releases/latest \
| jq -r '.tag_name')
else
version=$(python src/partielspy/version.py)
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
Format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black flake8 isort
- name: Check code formatting with Black
run: black --check .
- name: Check import order with isort
run: isort . --check --diff
- name: Run Flake8
run: flake8 src tests examples
Ubuntu:
needs: [Prepare, Format]
runs-on: ubuntu-22.04
env:
PARTIELS_VERSION: ${{ needs.Prepare.outputs.partiels_version }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Prepare
run: sudo apt update && sudo apt install -y unzip wget
- name: Download and install Partiels and plugins
run: ./scripts/install_partiels.sh --partiels_version $PARTIELS_VERSION
- name: Upgrade pip and setuptools
run: python -m pip install --upgrade pip setuptools
- name: Install dependencies
run: pip install pytest build pillow
- name: Build partielspy
run: python -m build
- name: Install partielspy
run: pip install dist/*.whl
- name: Run tests
run: pytest -s tests/
Windows:
needs: [Prepare, Format]
runs-on: windows-latest
env:
PARTIELS_VERSION: ${{ needs.Prepare.outputs.partiels_version }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Download and install Partiels and plugins
run: .\scripts\install_partiels.ps1 -partiels_version $env:PARTIELS_VERSION
- name: Upgrade pip and setuptools
run: python -m pip install --upgrade pip setuptools
- name: Install dependencies
run: pip install pytest build pillow
- name: Build partielspy
run: python -m build
- name: Install partielspy
shell: powershell
run: Get-ChildItem -Path dist\*.whl | ForEach-Object { pip install $_.FullName }
- name: Run tests
run: pytest -s tests/
MacOS:
needs: [Prepare, Format]
runs-on: macos-latest
env:
PARTIELS_VERSION: ${{ needs.Prepare.outputs.partiels_version }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Download and install Partiels and plugins
run: sudo ./scripts/install_partiels.sh --partiels_version $PARTIELS_VERSION
- name: Upgrade pip and setuptools
run: python -m pip install --upgrade pip setuptools
- name: Install dependencies
run: pip install pytest build pillow
- name: Build partielspy
run: python -m build
- name: Install partielspy
run: pip install dist/*.whl
- name: Run tests
run: pytest -s tests/
Doc:
runs-on: ubuntu-latest
needs: Format
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install project and dependencies
run: python -m pip install --upgrade pip && pip install .
- name: Install dependencies
run: pip install sphinx furo
- name: Generate documentation
run: sphinx-build -W -E -b html ./docs ./docs/_build/html
- name: Upload documentation as artifact
uses: actions/upload-artifact@v4
with:
name: html-doc
path: docs/_build/html
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html