[BE] PyPi integration + local model cache + Github actions #2
Workflow file for this run
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 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_call: | |
jobs: | |
test: | |
runs-on: ubuntu-latest # TODO add macos tests too | |
strategy: | |
max-parallel: 10 | |
matrix: | |
python_version: ['3.9', '3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python_version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Cache pip | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: Install dependencies and package | |
# this can be added along with a dependabot config to run tests with latest versions | |
# pip install -r requirements.txt | |
# pip install -r requirements-optional.txt | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e .[dev] | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
if [ -f requirements-optional.txt ]; then pip install -r requirements.txt; fi | |
- name: Test with pytest | |
run: | | |
pytest tests -vv --cov-report=xml --cov=ocpmodels | |
- if: ${{ matrix.python_version == '3.11' }} | |
name: codecov-report | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: false # optional (default = false) | |
files: ./coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} # required | |
verbose: true # optional (default = false) |