Skip to content

Commit

Permalink
test all packages via GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
wowMalow authored Jan 25, 2024
1 parent eefdf15 commit 051d173
Showing 1 changed file with 104 additions and 19 deletions.
123 changes: 104 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
pylint replay
pytest_core:
needs: static_tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
Expand Down Expand Up @@ -67,9 +68,69 @@ jobs:
name: .coverage_core_${{ matrix.python-version }}
path: .coverage_core_${{ matrix.python-version }}

pytest_extras:
pytest_torch:
needs: pytest_core
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install torch package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1 lightfm==1.17
poetry cache clear pypi --all
./poetry_wrapper.sh install -E torch
- name: pytest
run: |
. ./venv/bin/activate
pytest -m "not spark and not experimental" tests/ --ignore=tests/experimental
mv .coverage .coverage_torch_${{ matrix.python-version }}
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: .coverage_torch_${{ matrix.python-version }}
path: .coverage_torch_${{ matrix.python-version }}

pytest_spark:
needs: pytest_torch
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install spark package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1 lightfm==1.17
poetry cache clear pypi --all
./poetry_wrapper.sh install -E spark
- name: pytest
run: |
. ./venv/bin/activate
pytest -m "not torch and not experimental" tests/ --ignore=tests/experimental
mv .coverage .coverage_spark_${{ matrix.python-version }}
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: .coverage_spark_${{ matrix.python-version }}
path: .coverage_spark_${{ matrix.python-version }}

pytest_spark_torch:
needs: pytest_spark
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
Expand All @@ -83,22 +144,52 @@ jobs:
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1 poetry-dynamic-versioning lightfm==1.17
pip install --upgrade pip wheel poetry==1.5.1 lightfm==1.17
poetry cache clear pypi --all
./poetry_wrapper.sh install --all-extras
- name: pytest
run: |
. ./venv/bin/activate
pytest -m "not experimental" --ignore=replay/experimental --ignore=tests/experimental
mv .coverage .coverage_all_${{ matrix.python-version }}
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: .coverage_all_${{ matrix.python-version }}
path: .coverage_all_${{ matrix.python-version }}

pytest_experimental:
needs: pytest_spark_torch
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install experimental package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1 lightfm==1.17
poetry cache clear pypi --all
./poetry_wrapper.sh --experimental install --all-extras
- name: pytest
run: |
. ./venv/bin/activate
pytest -m "not core"
mv .coverage .coverage_extras_${{ matrix.python-version }}
pytest -m "experimental"
mv .coverage .coverage_experimental_${{ matrix.python-version }}
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: .coverage_extras_${{ matrix.python-version }}
path: .coverage_extras_${{ matrix.python-version }}
name: .coverage_experimental_${{ matrix.python-version }}
path: .coverage_experimental_${{ matrix.python-version }}

merge_coverage:
needs: pytest_extras
needs: pytest_experimental
runs-on: ubuntu-20.04
strategy:
fail-fast: false
Expand All @@ -116,64 +207,58 @@ jobs:
pip install --upgrade pip wheel poetry==1.5.1 poetry-dynamic-versioning lightfm==1.17
poetry cache clear pypi --all
./poetry_wrapper.sh install --only dev
- name: Download coveradge reports
- name: Download coverage reports
uses: actions/download-artifact@v4
with:
pattern: .coverage_*
merge-multiple: true
- name: coverage_report
- name: Combine coverage
run: |
. ./venv/bin/activate
coverage combine .coverage_core_${{ matrix.python-version }} .coverage_extras_${{ matrix.python-version }}
coverage report --fail-under=95
coverage combine .coverage_core_${{ matrix.python-version }} .coverage_torch_${{ matrix.python-version }} .coverage_spark_${{ matrix.python-version }} .coverage_all_${{ matrix.python-version }} .coverage_experimental_${{ matrix.python-version }}
coverage report --fail-under=100
coverage xml
build_production:
needs: merge_coverage
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Install production package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1 poetry-dynamic-versioning
poetry cache clear pypi --all
./poetry_wrapper.sh install --all-extras
- name: Build
run: |
. ./venv/bin/activate
export PACKAGE_SUFFIX=.dev
./poetry_wrapper.sh build
build_experimental:
needs: merge_coverage
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Install full package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1 poetry-dynamic-versioning lightfm==1.17
poetry cache clear pypi --all
./poetry_wrapper.sh --experimental install --all-extras
- name: Build
run: |
. ./venv/bin/activate
Expand Down

0 comments on commit 051d173

Please sign in to comment.