CI: Run build and tests on Windows and MacOS too #44
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: | |
push: | |
branches: | |
- master | |
- github_ci | |
tags: | |
- '*' | |
jobs: | |
build_and_test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
include: | |
- python-version: "3.5" | |
os: ubuntu-20.04 | |
- python-version: "3.6" | |
os: ubuntu-20.04 | |
- python-version: "3.x" | |
os: macos-latest | |
- python-version: "3.x" | |
os: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/cache@v4 | |
with: | |
key: ${{ runner.os}}-pip-${{ matrix.python-version }} | |
path: ~/.cache/pip | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Update package list | |
run: | | |
sudo apt-get update | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: MatteoH2O1999/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache-build: true | |
- run: | | |
lsb_release -a | |
uname -a | |
if: startsWith(matrix.os, 'ubuntu') | |
- run: python --version | |
- name: Install dependencies | |
run: | | |
pip install -U pytest pytest-cov codecov coveralls | |
pip install -U cpp-coveralls | |
pip install scrutinizer-ocular | |
- name: Install package | |
run: | | |
pip install -e ".[all]" | |
- run: pip list | |
- name: Test | |
run: | | |
py.test -v --doctest-glob='*.md' --cov src | |
coveralls --build-root=. --include=src --dump=cpp-coveralls.json | |
- name: Convert coverage | |
run: python -m coverage xml | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v3 | |
- name: Upload to Coveralls | |
if: startsWith(matrix.os, 'ubuntu') && matrix.python-version != '2.7' | |
run: | | |
python -m coveralls --service=github --merge=cpp-coveralls.json | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_PARALLEL: true | |
COVERALLS_FLAG_NAME: py${{ matrix.python-version }} | |
coverage: | |
needs: build_and_test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: Finish coverage collection | |
run: | | |
python -m pip install -U pip | |
python -m pip install -U coveralls | |
python -m coveralls --finish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |