3.0 Release #204
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: Test and Release | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
# Every friday at 22:00 UTC (Every saturday at 07:00 KST/JST) | |
- cron: "0 22 * * FRI" | |
env: | |
FORCE_COLOR: 1 | |
jobs: | |
test: | |
name: Test Python ${{ matrix.python-version }} [${{ matrix.qt-api }}] | |
runs-on: ubuntu-latest | |
env: | |
DISPLAY: ':99.0' | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.11", "3.12"] | |
qt-api: ["pyqt6", "pyside6"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: tlambert03/setup-qt-libs@v1 | |
- name: Setup for Qt testing | |
run: | | |
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX | |
- name: Install pytest and dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -v .[viz,io,perf,misc,dev] ${{ matrix.qt-api }} | |
export QT_API=${{ matrix.qt-api }} | |
- name: Test with pytest | |
if: matrix.python-version != '3.12' || matrix.qt-api != 'pyqt6' | |
run: | | |
python -u -m pytest -vv --full-trace | |
- name: Test with pytest with coverage | |
if: matrix.python-version == '3.12' && matrix.qt-api == 'pyqt6' | |
run: | | |
python -u -m pytest -vv --full-trace --cov erlab --junitxml=junit.xml | |
- name: Upload coverage to Codecov | |
if: matrix.python-version == '3.12' && matrix.qt-api == 'pyqt6' | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload test results to Codecov | |
if: ${{ matrix.python-version == '3.12' && matrix.qt-api == 'pyqt6' && !cancelled() }} | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
mypy: | |
name: Static type checking | |
runs-on: ubuntu-latest | |
env: | |
DISPLAY: ':99.0' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install mypy and dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install .[viz,io,perf,misc,dev] mypy[reports] pyqt6 | |
- name: Run mypy | |
run: mypy --install-types --non-interactive --html-report mypy-report . | |
- name: Upload mypy results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: mypy-report | |
path: mypy-report/ | |
if-no-files-found: error | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
concurrency: | |
group: release | |
needs: [test, mypy] | |
if: github.event_name == 'push' && github.repository == 'kmnhan/erlabpy' | |
environment: | |
name: pypi | |
url: https://pypi.org/p/erlab | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
if: github.event_name == 'pull_request' | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
- uses: actions/checkout@v4 | |
if: github.event_name != 'pull_request' | |
with: | |
fetch-depth: 0 | |
- name: Run commitizen | |
if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }} | |
id: cz | |
uses: commitizen-tools/commitizen-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
changelog_increment_filename: body.md | |
extra_requirements : "cz-changeup" | |
- name: Build package distributions | |
id: build | |
if: env.REVISION != env.PREVIOUS_REVISION | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
python -m pip install --upgrade build | |
python -m build | |
- name: Publish package distributions to PyPI | |
id: pypi-publish | |
if: env.REVISION != env.PREVIOUS_REVISION | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
verbose: true | |
- name: Publish package distributions to GitHub Releases | |
id: github-release | |
if: env.REVISION != env.PREVIOUS_REVISION | |
uses: softprops/action-gh-release@v2 | |
with: | |
body_path: "body.md" | |
tag_name: v${{ steps.cz.outputs.version }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: dist/* |