Fix usage of license references (#246) #81
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
# SPDX-FileCopyrightText: ASSUME Developers | |
# | |
# SPDX-License-Identifier: AGPL-3.0-or-later | |
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Tests | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: '**/pyproject.toml' | |
- name: Check reuse compliance | |
run: | | |
pip install reuse | |
reuse lint | |
- name: Install dependencies | |
run: | | |
sudo apt-get update && sudo apt-get install --no-install-recommends -y coinor-cbc gcc g++ libglpk-dev glpk-utils && sudo rm -rf /var/lib/apt/lists/* | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
python -m pip install -e .[test] | |
- name: Lint with black and isort | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
black --check assume examples tests | |
isort --check assume examples tests | |
- name: Test with pytest & integration tests | |
run: | | |
pytest -m "not require_learning" | |
- name: Install torch dependencies | |
run: | | |
python -m pip install -e .[learning] | |
- name: Test pytest with torch & integration tests | |
run: | | |
pytest --cov --cov-report=xml --junitxml="result.xml" | |
- name: Upload tests results | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: test-results | |
path: | | |
coverage.xml | |
result.xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
flags: pytest |