Skip to content

Trying again to fix the version number #10

Trying again to fix the version number

Trying again to fix the version number #10

Workflow file for this run

name: Build documentation
on:
workflow_call:
jobs:
cancel-superseded:
name: Cancel superseded
runs-on: ubuntu-24.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
build-docs:
name: Build ${{ matrix.package }} ${{ matrix.version }} docs
needs: cancel-superseded
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
package: [msprime, tsinfer, tskit, tstrait, tscompare, tsbrowse, pyslim, tsdate, tszip, sc2ts]
version: [latest, stable]
include:
- package: msprime
cache-version: v11
additional-setup: sudo apt-get install -y libgsl0-dev
make-command: make
- package: tsinfer
cache-version: v13
additional-setup: sudo apt-get install -y tabix
make-command: make
- package: tskit
cache-version: v16
additional-setup: sudo apt-get install -y libgsl0-dev doxygen
requirements-path: python/requirements/CI-docs/requirements.txt
make-command: make -C python
- package: tstrait
cache-version: v4
- package: tscompare
cache-version: v1
requirements-path: requirements/CI-docs-pip/requirements.txt
- package: tsbrowse
cache-version: v2
requirements-path: requirements.txt
additional-setup: uv run --no-sync playwright install
- package: pyslim
cache-version: v6
additional-setup: |
sudo apt-get update
sudo apt-get install -y inkscape
git clone https://github.com/messerlab/SLiM.git
mkdir -p SLiM/Release
cd SLiM/Release
cmake -D CMAKE_POLICY_VERSION_MINIMUM=3.5 -D CMAKE_BUILD_TYPE=Release ..
make -j 2
sudo make install
- package: tsdate
cache-version: v8
requirements-path: docs/requirements.txt
- package: tszip
cache-version: v2
requirements-path: requirements/CI-docs.txt
- package: sc2ts
cache-version: v2
allow-pre-stable: true
steps:
- uses: actions/checkout@v4.2.2
name: Checkout ${{ matrix.package }}
with:
ref: ${{ matrix.version == 'latest' && 'main' || '' }}
repository: tskit-dev/${{ matrix.package }}
submodules: true
fetch-depth: 0
- name: Checkout stable tag
if: matrix.version == 'stable'
run: |
git fetch --tags --recurse-submodules=no
# Choose a stable tag; optionally allow pre-releases via matrix.allow-pre-stable.
if [ "${{ matrix.allow-pre-stable }}" = "true" ]; then
tag=$(git tag --list --sort=creatordate | tail -n1)
else
tag=$(git tag --list --sort=creatordate | grep -vi "[baC]" | tail -n1)
if [ -z "$tag" ]; then
tag=$(git tag --list --sort=creatordate | tail -n1)
fi
fi
echo "CHECKOUT_TAG=$tag"
git checkout "$tag"
git submodule update --init --recursive
- name: Show ref/sha/tag
run: |
echo "package=${{ matrix.package }}"
echo "version=${{ matrix.version }}"
echo "GITHUB_REF=${GITHUB_REF}"
echo "GITHUB_SHA=${GITHUB_SHA}"
echo "HEAD=$(git rev-parse HEAD)"
echo "DESCRIBE=$(git describe --tags --always --dirty || true)"
echo "Latest tags:"
git tag --list --sort=creatordate | tail -n5
- name: Get commit SHA1 for cache
run: git rev-parse HEAD > SHA1
- uses: actions/cache@v4.2.2
id: docs-cache
name: Docs cache
with:
path: dist
key: ${{ matrix.package }}-${{ matrix.version }}-docs-v4-${{ matrix.cache-version }}-${{ hashFiles('SHA1') }}
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v6
with:
python-version: 3.11
version: "0.8.15"
- name: Install deps
if: steps.docs-cache.outputs.cache-hit != 'true'
run: |
uv venv
# These can be removed after everything has had a release
if [ -f "${{ matrix.requirements-path }}" ]; then
uv pip install -r ${{ matrix.requirements-path }}
elif [ -f requirements/CI-docs/requirements.txt ]; then
uv pip install -r requirements/CI-docs/requirements.txt
elif [ -f pyproject.toml ]; then
uv pip install -r pyproject.toml --extra docs
elif [ -f python/pyproject.toml ]; then
uv pip install -r python/pyproject.toml --extra docs
else
echo "No requirements found"
exit 1
fi
- name: Additional setup
if: steps.docs-cache.outputs.cache-hit != 'true' && matrix.additional-setup
run: ${{ matrix.additional-setup }}
- name: Build C module
if: steps.docs-cache.outputs.cache-hit != 'true' && matrix.make-command
run: |
source .venv/bin/activate
${{ matrix.make-command }}
- name: Build Docs
if: steps.docs-cache.outputs.cache-hit != 'true'
run: |
source .venv/bin/activate
cd docs
if [ "${{ matrix.package }}" = "sc2ts" ]; then
SC2TS_VERSION=$(git describe --tags --dirty --always)
echo "Using SC2TS_VERSION=${SC2TS_VERSION}"
python - <<'PY'
import sc2ts

Check failure on line 170 in .github/workflows/build-docs.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-docs.yml

Invalid workflow file

You have an error in your yaml syntax on line 170
print("sc2ts.__version__:", getattr(sc2ts, "__version__", "<missing>"))
PY
make dist SC2TS_VERSION=${SC2TS_VERSION}
echo "Config version line (post-build):"
grep -n "SC2TS_VERSION" _config.yml || true
head -n 15 _config.yml || true
else
make dist
fi
git checkout .
- name: Copy docs
if: steps.docs-cache.outputs.cache-hit != 'true'
run: |
mkdir -p dist/${{ matrix.package }}/docs
cp -r docs/_build/html dist/${{ matrix.package }}/docs/${{ matrix.version }}
- name: Upload docs
uses: actions/upload-artifact@v4.6.1
with:
name: ${{ matrix.package }}-${{ matrix.version }}-docs
path: dist