From 764440e1e262db9306db8836d0a334683a553a93 Mon Sep 17 00:00:00 2001 From: Derrick Chambers Date: Sun, 12 Jul 2026 18:17:42 +0200 Subject: [PATCH 1/2] CI: isolate network tests from required suite --- .github/actions/load-shared-vars/action.yml | 4 +++ .github/test_code.sh | 11 +++--- .github/workflows/runtests.yml | 38 +++++++++++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/.github/actions/load-shared-vars/action.yml b/.github/actions/load-shared-vars/action.yml index e14081ac3..cfc74c14e 100644 --- a/.github/actions/load-shared-vars/action.yml +++ b/.github/actions/load-shared-vars/action.yml @@ -4,6 +4,9 @@ name: "Load Shared Variables" description: "Loads shared variables and sets them as environment variables and outputs" outputs: + python-default: + description: "Default Python version for single-version jobs" + value: ${{ steps.load.outputs.python-default }} python-test-matrix: description: "Python version matrix for full tests" value: ${{ steps.load.outputs.python-test-matrix }} @@ -26,6 +29,7 @@ runs: python_test_matrix='["3.11","3.12","3.13","3.14"]' test_os_matrix='["ubuntu-latest","macos-latest","windows-latest"]' echo "PYTHON_DEFAULT=$python_default" >> "$GITHUB_ENV" + echo "python-default=$python_default" >> "$GITHUB_OUTPUT" echo "python-test-matrix=$python_test_matrix" >> "$GITHUB_OUTPUT" echo "python-min-deps-matrix=$python_min_deps_matrix" >> "$GITHUB_OUTPUT" echo "test-os-matrix=$test_os_matrix" >> "$GITHUB_OUTPUT" diff --git a/.github/test_code.sh b/.github/test_code.sh index 52a452260..399da2f11 100755 --- a/.github/test_code.sh +++ b/.github/test_code.sh @@ -1,17 +1,20 @@ #!/bin/bash # Script to run tests to account for wonkiness of periodic mac failures. -args="tests -s --cov dascore --cov-append --cov-report=xml" +args=(tests -m "not network" -s --cov dascore --cov-append --cov-report=xml) +if [[ "$1" == "network" ]]; then + args=(tests -m network -s) +fi if [[ "$1" == "doctest" ]]; then - args="dascore --doctest-modules" + args=(dascore --doctest-modules) fi if [[ "$1" == "profile" ]]; then - args="benchmarks --codspeed" + args=(benchmarks --codspeed) fi exit_code=0 -python -m pytest $args || exit_code=$? +python -m pytest "${args[@]}" || exit_code=$? # Check the exit code is related to sporadic failures on mac, see #312 if [ $exit_code -ne 132 ] && [ $exit_code -ne 0 ]; then diff --git a/.github/workflows/runtests.yml b/.github/workflows/runtests.yml index a83be02da..38d79a4b8 100644 --- a/.github/workflows/runtests.yml +++ b/.github/workflows/runtests.yml @@ -34,6 +34,7 @@ jobs: runs-on: ubuntu-latest outputs: # Shared values live in .github/actions/load-shared-vars/action.yml + python-default: ${{ steps.load-vars.outputs.python-default }} python-matrix: ${{ steps.load-vars.outputs.python-test-matrix }} os-matrix: ${{ steps.load-vars.outputs.test-os-matrix }} steps: @@ -120,3 +121,40 @@ jobs: if: steps.generate_qmd_tests.outcome == 'failure' || steps.run_test_suite.outcome == 'failure' || steps.run_docstrings.outcome == 'failure' shell: bash run: exit 1 + + network_tests: + needs: setup + timeout-minutes: 60 + continue-on-error: true + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + + # Keep remote-IO coverage visible without blocking unrelated changes. + if: github.event_name == 'push' || !contains(github.event.pull_request.labels.*.name, 'no_ci') + + env: + env_file: 'environment.yml' + + steps: + - uses: actions/checkout@v4 + with: + fetch-tags: 'true' + fetch-depth: '0' + + - uses: ./.github/actions/mamba-install-dascore + with: + python-version: ${{ needs.setup.outputs.python-default }} + cache-number: ${{ env.CACHE_NUMBER }} + prepare-test-data: "true" + + - name: run network tests + shell: bash -el {0} + run: ./.github/test_code.sh network + + - name: summarize non-gating failure + if: failure() + shell: bash + run: echo "Network tests failed, but this report-only job does not block the workflow." >> "$GITHUB_STEP_SUMMARY" From be9fbfd766d7738b49ea28f3af67e7d5fa5a045d Mon Sep 17 00:00:00 2001 From: Derrick Chambers Date: Sun, 12 Jul 2026 21:56:54 +0200 Subject: [PATCH 2/2] CI: preserve coverage across network split --- .github/test_code.sh | 2 +- .github/workflows/runtests.yml | 9 +++++++++ codecov.yml | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 codecov.yml diff --git a/.github/test_code.sh b/.github/test_code.sh index 399da2f11..d752ff8af 100755 --- a/.github/test_code.sh +++ b/.github/test_code.sh @@ -3,7 +3,7 @@ # Script to run tests to account for wonkiness of periodic mac failures. args=(tests -m "not network" -s --cov dascore --cov-append --cov-report=xml) if [[ "$1" == "network" ]]; then - args=(tests -m network -s) + args=(tests -m network -s --cov dascore --cov-append --cov-report=xml) fi if [[ "$1" == "doctest" ]]; then args=(dascore --doctest-modules) diff --git a/.github/workflows/runtests.yml b/.github/workflows/runtests.yml index 38d79a4b8..a31290fe7 100644 --- a/.github/workflows/runtests.yml +++ b/.github/workflows/runtests.yml @@ -143,6 +143,7 @@ jobs: with: fetch-tags: 'true' fetch-depth: '0' + persist-credentials: false - uses: ./.github/actions/mamba-install-dascore with: @@ -154,6 +155,14 @@ jobs: shell: bash -el {0} run: ./.github/test_code.sh network + - uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: false + files: ./coverage.xml + flags: network + name: PR_network_tests_${{ matrix.os }} + token: ${{ secrets.CODECOV_TOKEN }} + - name: summarize non-gating failure if: failure() shell: bash diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..4d6cf5961 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,5 @@ +flags: + unittests: + carryforward: false + network: + carryforward: true