diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27bb46d..9044f08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,67 @@ on: pull_request: jobs: + check-version-bump: + name: Check mcdi version bump + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check if cli_tools/mcdi changed + id: changed + run: | + git fetch origin "${{ github.base_ref }}" --depth=1 + if git diff --name-only "origin/${{ github.base_ref }}...HEAD" -- cli_tools/mcdi | grep -q .; then + echo "mcdi_changed=true" >> "$GITHUB_OUTPUT" + else + echo "mcdi_changed=false" >> "$GITHUB_OUTPUT" + fi + + - name: Read version from package __init__.py + if: steps.changed.outputs.mcdi_changed == 'true' + id: version + run: | + VERSION=$(grep -m1 '^__version__' cli_tools/mcdi/mcdi/__init__.py | sed -E 's/__version__ = "(.*)"/\1/') + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + + - uses: docker/setup-buildx-action@v3 + if: steps.changed.outputs.mcdi_changed == 'true' + + - name: Fail if version tag already exists on Quay + if: steps.changed.outputs.mcdi_changed == 'true' + run: | + IMAGE_REF="quay.io/goeckslab/mcdi:${{ steps.version.outputs.version }}" + if docker buildx imagetools inspect "$IMAGE_REF" >/dev/null 2>&1; then + echo "cli_tools/mcdi changed but version ${{ steps.version.outputs.version }} is already published at $IMAGE_REF." >&2 + echo "Bump __version__ in mcdi/__init__.py before merging." >&2 + exit 1 + fi + + check-tool-version-match: + name: Check Galaxy tool versions match mcdi package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Verify @TOOL_VERSION@ tokens match mcdi package version + run: | + MCDI_VERSION=$(grep -m1 '^__version__' cli_tools/mcdi/mcdi/__init__.py | sed -E 's/__version__ = "(.*)"/\1/') + echo "mcdi package version: $MCDI_VERSION" + fail=0 + for f in tools/*/macros.xml; do + TOOL_VERSION=$(grep -oP '(?<=)[^<]+' "$f" || true) + [ -z "$TOOL_VERSION" ] && continue + echo "$f: @TOOL_VERSION@ = $TOOL_VERSION" + if [ "$TOOL_VERSION" != "$MCDI_VERSION" ]; then + echo "::error file=$f::@TOOL_VERSION@ ($TOOL_VERSION) does not match mcdi package version ($MCDI_VERSION)" + fail=1 + fi + done + exit $fail + pytest: name: Unit tests (mcdi) runs-on: ubuntu-latest diff --git a/cli_tools/mcdi/mcdi/__init__.py b/cli_tools/mcdi/mcdi/__init__.py index 24c15fa..3aaafce 100644 --- a/cli_tools/mcdi/mcdi/__init__.py +++ b/cli_tools/mcdi/mcdi/__init__.py @@ -6,7 +6,7 @@ import os -__version__ = "0.5.0" +__version__ = "0.6.0" # Container image build id (e.g. git SHA); empty for local/editable installs. BUILD = os.environ.get("MCDI_BUILD", "").strip() diff --git a/tools/manifest_downloader/macros.xml b/tools/manifest_downloader/macros.xml index 929f619..a262654 100644 --- a/tools/manifest_downloader/macros.xml +++ b/tools/manifest_downloader/macros.xml @@ -1,5 +1,5 @@ - 0.5.0 + 0.6.0 0 25.1 diff --git a/tools/manifest_gdc/macros.xml b/tools/manifest_gdc/macros.xml index 82d0627..01e9c2a 100644 --- a/tools/manifest_gdc/macros.xml +++ b/tools/manifest_gdc/macros.xml @@ -1,5 +1,5 @@ - 0.4.0 + 0.6.0 0 22.05