Merge pull request #17 from Smithsonian/testcov #4
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: Unit Tests | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'src/**' | |
- '.github/workflows/python_tests.yml' | |
pull_request: | |
paths: | |
- 'src/**' | |
- '.github/workflows/python_tests.yml' | |
jobs: | |
build: | |
defaults: | |
run: | |
shell: bash -l {0} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
max-parallel: 9 | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ['3.10', '3.11', '3.12', '3.x'] | |
redis-version: [latest] | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Git checkout smax-server | |
uses: actions/checkout@v4 | |
with: | |
repository: Smithsonian/smax-server | |
path: smax-server | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Pip install pytest pytest-cov | |
run: pip3 install pytest pytest-cov | |
- name: Pip install SMAX package | |
run: pip3 install . | |
- name: Setup redis | |
uses: shogo82148/actions-setup-redis@v1 | |
with: | |
redis-version: ${{ matrix.redis-version }} | |
auto-start: "true" | |
redis-conf: | | |
bind 127.0.0.1 | |
protected-mode no | |
- name: Load LUA scripts | |
run: | | |
cd smax-server | |
./smax-init.sh lua | |
- name: Test with pytest | |
run: | | |
pytest -v -x --log-level=DEBUG --cov --cov-report=xml | |
- name: Upload coverage to Codecov.io | |
if: ${{ matrix.python-version == '3.x' }} | |
uses: codecov/codecov-action@v4 | |
continue-on-error: true | |
with: | |
fail_ci_if_error: false | |
flags: unittests | |
name: codecov | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |