Skip to content

Add guard against leaving temporary workflow runs #283

Add guard against leaving temporary workflow runs

Add guard against leaving temporary workflow runs #283

Workflow file for this run

name: Run tests
on:
push:
branches:
- main
- develop
- ci/uv
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- "**.md"
- "**.rst"
- "**.ipynb"
branches:
- main
- develop
jobs:
test_and_build:
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.10"]
name: Test and build for ${{ matrix.python-version }}, ${{ matrix.os }}
env:
EIT_PROCESSING_TEST_DATA: ${{ github.workspace }}/../eitprocessing_data/
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_eitprocessing
with:
dependencies: --extra testing
extract-data: true
python-version: ${{ matrix.python-version }}
token: ${{ secrets.GITHUB_TOKEN }}
data-directory: ${{ env.EIT_PROCESSING_TEST_DATA }}
- name: Run pytest
run: uv run pytest -v
# Guard: fail on PR to develop if 'ci/uv' is referenced in workflows
- name: Ensure 'ci/uv' is not referenced in workflows
if: ${{ github.event_name == 'pull_request' && github.base_ref == 'develop' }}
shell: bash
run: |
set -euo pipefail
if grep -R -nE '^[[:space:]]*-[[:space:]]*ci/uv[[:space:]]*$' .github/workflows/*.yml; then
echo "::error title=Remove 'ci/uv' from workflow triggers::Found 'ci/uv' branch listed under on.push.branches in workflow(s). Remove it before merging into 'develop'."
exit 1
fi
echo "::error title=Remove guard from workflow::This guard is only needed until 'ci/uv' is removed from workflows. Remove this step after that."
exit 1