From 051d17389fa2d0803dfe0afecc99e912146c22f1 Mon Sep 17 00:00:00 2001 From: wowMalow <99668485+wowMalow@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:27:06 +0300 Subject: [PATCH] test all packages via GitHub Actions --- .github/workflows/main.yml | 123 +++++++++++++++++++++++++++++++------ 1 file changed, 104 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9be1aeabf..65d132dc0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,6 +39,7 @@ jobs: pylint replay pytest_core: + needs: static_tests runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -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: @@ -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 @@ -116,38 +207,35 @@ 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 @@ -155,25 +243,22 @@ jobs: ./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