Fix gh action (#168) #957
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: PyTest | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
orderly: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
group: [1, 2, 3, 4, 5] | |
timeout-minutes: 15 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
# Setup Python (faster than using Python container) | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Install libpq-dev | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get install -y libpq-dev | |
- name: Install poetry | |
uses: Gr1N/setup-poetry@v8 | |
- name: Set Poetry config | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry config virtualenvs.path ~/.virtualenvs | |
# run poetry install if the poetry lock has changed | |
- name: Install dependencies | |
if: steps.cache-poetry.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
- name: Run test suite | |
run: poetry run pytest -v --cov --ignore=condition_prediction --splits 5 --group ${{ matrix.group }} --splitting-algorithm least_duration | |
- name: Upload coverage | |
uses: actions/upload-artifact@v2 | |
with: | |
name: coverage${{ matrix.group }} | |
path: .coverage | |
orderly_coverage: | |
needs: orderly | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install coverage | |
run: pip install coverage | |
- name: Download all artifacts | |
# Downloads coverage1, coverage2, etc. | |
uses: actions/download-artifact@v2 | |
- name: Run coverage | |
run: | | |
coverage combine coverage*/.coverage* | |
coverage report --fail-under=85 | |
coverage html | |
- name: Upload | |
uses: actions/upload-artifact@v1 | |
with: | |
name: coverage | |
path: htmlcov | |
# condition_prediction: | |
# runs-on: ubuntu-latest | |
# strategy: | |
# fail-fast: false | |
# timeout-minutes: 10 | |
# steps: | |
# - name: Check out repository code | |
# uses: actions/checkout@v2 | |
# # Setup Python (faster than using Python container) | |
# - name: Setup Python | |
# uses: actions/setup-python@v2 | |
# with: | |
# python-version: "3.10" | |
# - name: Install libpq-dev | |
# if: matrix.os == 'ubuntu-latest' | |
# run: sudo apt-get install -y libpq-dev | |
# - name: Install poetry | |
# run: python -m pip install --upgrade poetry wheel | |
# # - name: Add coverage | |
# # run: poetry add pytest-cov | |
# # - name: Set Poetry config | |
# # run: | | |
# # poetry config virtualenvs.in-project true | |
# # poetry config virtualenvs.path ~/.virtualenvs | |
# # run poetry install if the poetry lock has changed | |
# - name: Install dependencies | |
# if: steps.cache-poetry.outputs.cache-hit != 'true' | |
# run: cd condition_prediction && poetry install --no-interaction | |
# - name: Run test suite | |
# run: cd condition_prediction && poetry run pytest -v | |
# # - name: Upload | |
# # uses: actions/upload-artifact@v1 | |
# # with: | |
# # name: coverage | |
# # path: htmlcov |