add tests for new functionalities #149
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: CI | |
on: | |
- release | |
- push | |
- pull_request | |
jobs: | |
lint: | |
name: Run lint checks | |
runs-on: ubuntu-20.04 | |
# Workaround to disable pip upgrade warnings until fixed in setup-python | |
# See: https://github.com/actions/setup-python/issues/532 | |
env: | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install Poetry | |
# uses: snok/install-poetry@v1 | |
uses: Gr1N/setup-poetry@v8 | |
- name: Install dependencies (poetry) | |
run: poetry install --no-interaction --only=main,ci,lint | |
- name: Run lint checks | |
run: poetry run tox --quiet -e check | |
test: | |
name: Run tests | |
runs-on: ${{ matrix.platform }} | |
# Workaround to disable pip upgrade warnings until fixed in setup-python | |
# See: https://github.com/actions/setup-python/issues/532 | |
env: | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
strategy: | |
fail-fast: false | |
# Versions available: | |
# pypy: https://downloads.python.org/pypy/versions.json | |
# Python: https://github.com/actions/python-versions/blob/main/versions-manifest.json | |
# Additional info: https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md | |
# OS images: https://github.com/actions/runner-images | |
matrix: | |
python-version: | |
- "3.7" | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
architecture: | |
- x86 | |
- x64 | |
platform: | |
- ubuntu-20.04 | |
- windows-latest | |
# Fix tests failing on MacOS 14+ due to ARM architecture | |
# https://github.com/actions/setup-python/issues/825 | |
# TODO: update tests to use ARM MacOS with 14+, add | |
# architecture to the list of architectures above. | |
- macos-13 | |
exclude: | |
- platform: ubuntu-20.04 | |
architecture: x86 | |
- platform: macos-13 | |
architecture: x86 | |
# Not sure why, but 3.7 on x86 windows is cursed in CI | |
# It passes (for now), however it's quite slow, | |
# and I'm ADHD. | |
- platform: windows-latest | |
architecture: x86 | |
python-version: 3.7 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.architecture }} | |
- name: Install Poetry | |
# uses: snok/install-poetry@v1 | |
uses: Gr1N/setup-poetry@v8 | |
- name: Display platform and environment information | |
run: | | |
python --version | |
python -c "import sys; print('sys.version: %s' % str(sys.version))" | |
python -c "import sys; print('sys.platform: %s' % str(sys.platform))" | |
python -c "import os; print('os.name: %s' % str(os.name))" | |
python -c "import platform; print('platform.uname(): %s' % str(platform.uname()))" | |
- name: Install dependencies (poetry) | |
run: poetry install --no-interaction --only=main,ci,test | |
# TODO: fix benchmark results (maybe a separate Job?) | |
- name: Run tests | |
run: poetry run tox --quiet | |
- uses: codecov/codecov-action@v3 | |
with: | |
# codecov is annoying. Not sure why I'm still using it, | |
# may need to look at something that has less heisenbugs. | |
# https://community.codecov.com/t/ci-failure-due-to-too-many-uploads-to-this-commit/2587/12 | |
fail_ci_if_error: false | |
- name: Coveralls | |
if: ${{ matrix.platform == 'ubuntu-20.04' && github.event_name != 'pull_request' }} | |
uses: AndreMiras/coveralls-python-action@develop | |
with: | |
parallel: true | |
flag-name: ${{ matrix.python-version }}-${{ matrix.platform }} | |
coveralls_finish: | |
needs: test | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Coveralls Finished | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: AndreMiras/coveralls-python-action@develop | |
with: | |
parallel-finished: true | |
# TODO: publish releases using CI | |
# TODO: don't publish pre-releases OR publish them as pre-releases to PyPI | |
# https://github.com/marketplace/actions/upload-a-build-artifact | |
# name: "Build and publish a release" | |
# on: | |
# release: | |
# types: [released] | |
# jobs: | |
# publish: | |
# name: "📦 Publish Python distributions" | |
# runs-on: "ubuntu-20.04" | |
# strategy: | |
# matrix: | |
# python-version: | |
# - "3.8" | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: "🐍 Set up Python ${{ matrix.python-version }}" | |
# uses: actions/setup-python@v4 | |
# with: | |
# python-version: "${{ matrix.python-version }}" | |
# - name: "🐍 Install wheel and build" | |
# run: "python -m pip install wheel build --user" | |
# - name: "🐍 Build a binary wheel and a source tarball" | |
# run: "python -m build" | |
# - name: "📦 Publish distribution to PyPI" | |
# uses: "pypa/gh-action-pypi-publish@master" | |
# if: "startsWith(github.ref, 'refs/tags')" | |
# with: | |
# password: "${{ secrets.pypi_password }}" |