Skip to content

Commit 3e44504

Browse files
authored
Merge pull request #365 from Climate-REF/self-hosted
2 parents 7c0d5cb + a0a0a79 commit 3e44504

File tree

6 files changed

+1784
-1777
lines changed

6 files changed

+1784
-1777
lines changed

.github/workflows/ci-integration.yaml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@ on:
1313

1414
jobs:
1515
tests-slow:
16+
if: github.repository == 'Climate-REF/climate-ref'
1617
env:
1718
REF_TEST_OUTPUT: "test-outputs"
18-
REF_DATASET_CACHE_DIR: "data"
1919
PYTEST_ADDOPTS: "--slow"
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
os: [ "ubuntu-latest" ]
24-
python-version: [ "3.11", "3.12", "3.13" ]
25-
runs-on: "${{ matrix.os }}"
23+
python-version: [ "3.11", "3.13" ]
24+
runs-on: "self-hosted"
2625
defaults:
2726
run:
2827
shell: bash
@@ -32,21 +31,15 @@ jobs:
3231
- uses: ./.github/actions/setup
3332
with:
3433
python-version: ${{ matrix.python-version }}
35-
- name: Cache downloaded data
36-
uses: actions/cache@v4
37-
with:
38-
path: |
39-
${{ env.REF_DATASET_CACHE_DIR }}
40-
key: reference-datasets
4134
- name: Run tests
4235
run: |
4336
make virtual-environment
4437
make fetch-test-data
45-
uv run ref datasets fetch-data --registry ilamb
46-
uv run ref datasets fetch-data --registry iomb
47-
uv run ref datasets fetch-data --registry esmvaltool
38+
uv run ref datasets fetch-data --registry ilamb --symlink
39+
uv run ref datasets fetch-data --registry iomb --symlink
40+
uv run ref datasets fetch-data --registry esmvaltool --symlink
4841
uv run ref providers create-env
49-
make test
42+
uv run pytest packages tests --slow --no-docker -r a -v
5043
# Upload the scratch and executions directories as artifacts
5144
- name: Upload scratch artifacts
5245
uses: actions/upload-artifact@v4

changelog/365.improvement.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Use a self-hosted CI runner for the integration tests.
2+
The GitHub runner do not have enough disk space to store the required datasets,
3+
and these data are downloaded over the internet on each run.

conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@
4242

4343
def pytest_configure(config):
4444
config.addinivalue_line("markers", "slow: mark test as slow to run")
45+
config.addinivalue_line("markers", "docker: mark test requires docker to run")
4546

4647

4748
def pytest_addoption(parser):
4849
parser.addoption("--slow", action="store_true", help="include tests marked slow")
50+
parser.addoption("--no-docker", action="store_true", help="skip docker tests")
4951

5052

5153
def pytest_collection_modifyitems(config, items):
@@ -54,6 +56,11 @@ def pytest_collection_modifyitems(config, items):
5456
for item in items:
5557
if item.get_closest_marker("slow"):
5658
item.add_marker(skip_slow)
59+
if config.getoption("--no-docker"):
60+
skip_docker = pytest.mark.skip(reason="--no-docker option provided")
61+
for item in items:
62+
if item.get_closest_marker("docker"):
63+
item.add_marker(skip_docker)
5764

5865

5966
@pytest.fixture(scope="session")

packages/climate-ref-core/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dependencies = [
3939
"environs>=11",
4040
"pyyaml>=6.0.2",
4141
# Not used directly, but required to support some installations
42-
"setuptools>=75.8.0",
42+
"setuptools<81",
4343

4444
# SPEC 0000 constraints
4545
# We follow [SPEC-0000](https://scientific-python.org/specs/spec-0000/)

tests/integration/test_postgres.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def config(config, postgres_container):
7575
return config
7676

7777

78+
@pytest.mark.docker
7879
def test_connect_and_migrations(config, cmip6_data_catalog):
7980
database = Database.from_config(config)
8081
assert database.url.startswith("postgresql")
@@ -87,6 +88,7 @@ def test_connect_and_migrations(config, cmip6_data_catalog):
8788
adapter.register_dataset(config, database, data_catalog_dataset)
8889

8990

91+
@pytest.mark.docker
9092
def test_check_up_to_date(config):
9193
database = Database.from_config(config)
9294

0 commit comments

Comments
 (0)