-
-
Notifications
You must be signed in to change notification settings - Fork 215
[MNT] Dockerized tests for CI runs using localhost #1629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
83e1531
f90036d
3a257ab
3b79017
f524d75
7ef12c2
a5601e3
d862be2
16699e6
7c14c68
78b2038
16ceeaa
015acf4
937fc77
30972f8
775dcf7
319cb35
a680ebe
b161b3b
0b989d1
892ea6c
ae3befb
5f396a0
8a319cd
4ba4239
0292404
a7b5d76
9b0f3d7
630f240
c61d410
1ab42b7
06405c8
e22b7ca
1b00a7f
cc6e673
c1bf558
1a794fe
dbe7782
d8be5f1
b204845
54725fa
abc44a5
b034687
b8826f5
445cbe8
295ef93
488f409
93d7409
45e7257
7fcf039
37cfb2e
9290010
bbfa193
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add env var |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -101,6 +101,35 @@ 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 | ||||||||||||||||||||||||||
| cd services | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| git config user.email "ci@openml.org" | ||||||||||||||||||||||||||
| git config user.name "CI" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| git fetch origin pull/13/head:pr-13 | ||||||||||||||||||||||||||
| git merge pr-13 --no-edit | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| git fetch origin pull/15/head:pr-15 | ||||||||||||||||||||||||||
| git merge pr-15 --no-edit | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - 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 | ||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need to run |
||||||||||||||||||||||||||
| docker wait openml-test-database-setup | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
satvshr marked this conversation as resolved.
Show resolved
Hide resolved
satvshr marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||
| - name: Verify API is Reachable | ||||||||||||||||||||||||||
| if: matrix.os == 'ubuntu-latest' | ||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||
| timeout 20s bash -c 'until curl -sSf http://localhost:8000/api/v1/xml/data/1 > /dev/null; do sleep 3; done' | ||||||||||||||||||||||||||
| curl -I http://localhost:8000/api/v1/task/1 | ||||||||||||||||||||||||||
|
Comment on lines
129
to
131
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to what there was earlier, changed it the previous commit and was going to revert it after CIs
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to what there was earlier, changed it the previous commit and was going to revert it after CIs |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Show installed dependencies | ||||||||||||||||||||||||||
| run: python -m pip list | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -112,9 +141,9 @@ jobs: | |||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if [ "${{ matrix.sklearn-only }}" = "true" ]; then | ||||||||||||||||||||||||||
| marks="sklearn and not production and not uses_test_server" | ||||||||||||||||||||||||||
| marks="sklearn and not production" | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| marks="not production and not uses_test_server" | ||||||||||||||||||||||||||
| marks="not production" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks" | ||||||||||||||||||||||||||
|
|
@@ -127,9 +156,9 @@ jobs: | |||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if [ "${{ matrix.sklearn-only }}" = "true" ]; then | ||||||||||||||||||||||||||
| marks="sklearn and production and not uses_test_server" | ||||||||||||||||||||||||||
| marks="sklearn and production" | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| marks="production and not uses_test_server" | ||||||||||||||||||||||||||
| marks="production" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks" | ||||||||||||||||||||||||||
|
|
@@ -139,6 +168,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' && always() | ||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||
| sudo rm -rf services | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Check for files left behind by test | ||||||||||||||||||||||||||
| if: matrix.os != 'windows-latest' && always() | ||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||
|
|
@@ -151,15 +194,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 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -277,7 +277,7 @@ def with_server(request): | |
| openml.config.apikey = None | ||
| yield | ||
| return | ||
| openml.config.server = "https://test.openml.org/api/v1/xml" | ||
| openml.config.server = f"{openml.config.TEST_SERVER_URL}/api/v1/xml" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check the env variable @pytest.fixture(autouse=True)
def with_server(request):
if os.getenv("OPENML_USE_LOCAL_SERVICES") == "true":
openml.config.TEST_SERVER_URL = "http://localhost:8080"
if "production" in request.keywords:
openml.config.server = "https://www.openml.org/api/v1/xml"
openml.config.apikey = None
yield
return
openml.config.server = f"{openml.config.TEST_SERVER_URL}/api/v1/xml"
openml.config.apikey = TestBase.user_key
yield |
||
| openml.config.apikey = TestBase.user_key | ||
| yield | ||
|
|
||
|
|
@@ -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" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there should be following steps to setup the docker services, though these should be ignored for window machines