Python build and test and deploy #119
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: Python build and test and deploy | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
create: | |
branches: [main] | |
tags: ['**'] | |
schedule: | |
- cron: "0 4 1 * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Update pip, setuptools, and wheel | |
run: python -m pip install --upgrade pip setuptools wheel build | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
run: python -m build --sdist | |
- name: Install sdist | |
run: pip install ./dist/eeg_positions-* | |
- name: Clean up working directory | |
run: rm -rf ./* | |
- name: Try importing eeg_positions | |
run: python -c 'import eeg_positions; print(eeg_positions.__version__)' | |
- name: Remove sdist install | |
run: pip uninstall -y eeg_positions | |
- uses: actions/checkout@v4 | |
- name: Build wheel | |
run: python -m build --wheel | |
- name: Install wheel | |
run: pip install ./dist/eeg_positions-*.whl | |
- name: Clean up working directory | |
run: rm -rf ./* | |
- name: Try importing eeg_positions | |
run: python -c 'import eeg_positions; print(eeg_positions.__version__)' | |
- name: Remove wheel install | |
run: pip uninstall -y eeg_positions | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.10"] | |
runs-on: ${{ matrix.platform }} | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
make inplace | |
- name: Check formatting | |
if: "matrix.platform == 'ubuntu-latest'" | |
run: | | |
make flake | |
make check-manifest | |
- name: Test with pytest | |
run: | | |
make test | |
- name: Upload coverage report | |
if: "matrix.platform == 'ubuntu-latest'" | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.xml | |
- name: build docs | |
if: "matrix.platform == 'ubuntu-latest'" | |
run: | | |
make build-doc | |
- name: Upload docs build artifacts | |
if: "matrix.platform == 'ubuntu-latest'" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs-artifact | |
path: docs/_build/html | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [build, test] | |
if: github.ref == 'refs/heads/main' # only run on main | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download docsbuild artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: docs-artifact | |
path: docs/_build/html | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages # The branch the action should deploy to. | |
folder: docs/_build/html # The folder the action should deploy. | |
clean: true # Automatically remove deleted files from the deploy branch | |
commit-message: "deploy to gh-pages [skip ci] [ci skip]" |