diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b10721f55..a21992474 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,16 +1,13 @@ ---- name: Tests on: workflow_dispatch: - push: branches: - main - develop tags: - "v*.*.*" - pull_request: branches: - main @@ -101,11 +98,25 @@ jobs: echo "BEFORE=$git_status" >> $GITHUB_ENV echo "Repository status before tests: $git_status" + - name: Clone Services + if: matrix.os == 'ubuntu-latest' + run: git clone --depth 1 https://github.com/openml/services.git + + - name: Start Docker Services + if: matrix.os == 'ubuntu-latest' + working-directory: ./services + run: | + sudo systemctl stop mysql.service + docker compose --profile rest-api --profile minio --profile evaluation-engine up -d + docker wait openml-test-database-setup + - name: Show installed dependencies run: python -m pip list - name: Run tests on Ubuntu Test if: matrix.os == 'ubuntu-latest' + env: + TEST_SERVER_URL: "http://localhost:8000" run: | if [ "${{ matrix.code-cov }}" = "true" ]; then codecov="--cov=openml --long --cov-report=xml" @@ -121,6 +132,8 @@ jobs: - name: Run tests on Ubuntu Production if: matrix.os == 'ubuntu-latest' + env: + TEST_SERVER_URL: "http://localhost:8000" run: | if [ "${{ matrix.code-cov }}" = "true" ]; then codecov="--cov=openml --long --cov-report=xml" @@ -139,6 +152,20 @@ jobs: run: | # we need a separate step because of the bash-specific if-statement in the previous one. pytest -n 4 --durations=20 --dist load -sv --reruns 5 --reruns-delay 1 -m "not uses_test_server" + - name: Upload coverage + if: matrix.code-cov && always() + uses: codecov/codecov-action@v4 + with: + files: coverage.xml + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + verbose: true + + - name: Cleanup Docker setup + if: matrix.os == 'ubuntu-latest' + run: | + sudo rm -rf services + - name: Check for files left behind by test if: matrix.os != 'windows-latest' && always() run: | @@ -151,15 +178,6 @@ jobs: exit 1 fi - - name: Upload coverage - if: matrix.code-cov && always() - uses: codecov/codecov-action@v4 - with: - files: coverage.xml - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true - verbose: true - dummy_windows_py_sk024: name: (windows-latest, Py, sk0.24.*, sk-only:false) runs-on: ubuntu-latest diff --git a/tests/conftest.py b/tests/conftest.py index bd974f3f3..ae67f2f43 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -295,8 +295,8 @@ def with_test_cache(test_files_directory, request): openml.config.set_root_cache_directory(_root_cache_directory) if tmp_cache.exists(): shutil.rmtree(tmp_cache) - + @pytest.fixture def static_cache_dir(): return Path(__file__).parent / "files"