Skip to content

Merge pull request #72 from nansencenter/hotfix_yaml_safe_load #46

Merge pull request #72 from nansencenter/hotfix_yaml_safe_load

Merge pull request #72 from nansencenter/hotfix_yaml_safe_load #46

Workflow file for this run

name: Run unit tests and build Python package
on:
push:
branches: ['**']
release:
types: [released]
jobs:
tests:
runs-on: ubuntu-latest
env:
latest: ${{ matrix.python_version == '3.11' && 'true' || '' }}
strategy:
matrix:
python_version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade coveralls mock wheel
- name: Run unit tests
run: coverage run --omit=pythesint/tests/* --source=pythesint setup.py test
- name: Publish coverage
if: ${{ env.latest }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --service=github
build_publish_package:
runs-on: 'ubuntu-latest'
needs: tests
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3'
- name: Install build tools
run: pip install setuptools wheel
- name: Build Python package
run: >
PYTHESINT_RELEASE="${{ github.ref_name }}"
python setup.py sdist bdist_wheel
- name: Publish Python package
uses: pypa/gh-action-pypi-publish@release/v1
with:
# Storing the PyPI URL in the repositories' secrets makes
# publishing to the test PyPI from forks easy
repository_url: ${{ secrets.PYPI_REPOSITORY_URL }}
password: ${{ secrets.PYPI_TOKEN }}