Merge pull request #64 from CederGroupHub/pre-commit-ci-update-config #75
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: test | |
env: | |
scip-version: 8.0.0 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_call: | |
workflow_dispatch: | |
jobs: | |
test: | |
# Only 20.04 is known to work with scip 8.0.0 | |
runs-on: ubuntu-20.04 | |
strategy: | |
max-parallel: 10 | |
matrix: | |
# '3.11' fails because h5py has to be built from source since prebuilt wheels are not provided yet | |
python_version: ['3.9', '3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python_version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Install SCIP dependency | |
run: | | |
wget --quiet --no-check-certificate https://scipopt.org/download/release/SCIPOptSuite-${{ env.scip-version }}-Linux-ubuntu.deb | |
sudo apt-get update && sudo apt install -y ./SCIPOptSuite-${{ env.scip-version }}-Linux-ubuntu.deb | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: Install dependencies and package | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r requirements-optional.txt | |
pip install -e .[tests] | |
- name: Test with pytest | |
run: | | |
pytest tests --cov=WFacer --cov-report=xml | |
# If using python 3.11, need to restrict PR codacy report to PR within the same repo, | |
# so that PR across forks will not be reported. Otherwise, will fail to run the report action. | |
# Here we revert to python = 3.11. | |
- if: ${{ matrix.python_version == 3.11 && github.event_name == 'push'}} | |
name: codacy-coverage-reporter | |
uses: codacy/codacy-coverage-reporter-action@v1 | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
coverage-reports: coverage.xml |