Python package #1490
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 package | |
on: | |
push: | |
pull_request: | |
# Schedule a nightly build. Times are UTC | |
# See https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events | |
schedule: | |
# 5:15 am UTC (https://en.wikipedia.org/wiki/5:15) | |
- cron: '15 5 * * *' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# Default builds are on Ubuntu | |
os: [ubuntu-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10'] | |
include: | |
# Also test on macOS and Windows using latest Python 3 | |
- os: macos-latest | |
python-version: '3.x' | |
- os: windows-latest | |
python-version: '3.x' | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
shell: bash | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
python -m pip install . | |
python -m pip install 'pycodestyle>=2.10.0' 'pylint>=2.17' | |
- name: Test with unittest | |
shell: bash | |
# Python 3.12 has lots of deprecation warnings about | |
# datetime.datetime.utcfromtimestamp in the standard library. | |
# disable warnings checks for python 3.12. | |
run: | | |
WARNINGS="-We" | |
PY_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") | |
if [ "${PY_VERSION}" == "3.12" ]; then echo "Disabling warnings"; WARNINGS=""; fi | |
python $WARNINGS -m unittest discover -s test | |
pycodestyle sbol3 test | |
pylint sbol3 test |