diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index cb12160a..518800d0 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -5,45 +5,64 @@ env: PDF_DOCS: ${{ github.workspace }}/docs/build_pdf on: push: - branches: [main, develop] + branches: main pull_request: - branches: [main, develop] + branches: main jobs: + # Get user/group of runner account so that subsequent jobs can run containers + # using that account rather than root. Based on discussions in: + # https://github.com/actions/runner/issues/691 + configure: + runs-on: ubuntu-latest + outputs: + uid_gid: ${{ steps.get_user.outputs.uid_gid }} + steps: + - id: get_user + run: | + MY_UID=$(id -u) + MY_GID=$(id -g) + echo "User = $(id -u -n) ($MY_UID)" + echo "Group = $(id -g -n) ($MY_GID)" + echo "uid_gid=$MY_UID:$MY_GID" >> "$GITHUB_OUTPUT" + build_pypkg_sphinx: - runs-on: ${{ matrix.os }} - strategy: - matrix: - # We would like to use 3.12, but this presently fails with the error: - # Could not import extension sphinxcontrib.bibtex (exception: No module named 'pkg_resources') - os: [ubuntu-latest] - python-version: ["3.11"] + # Prefer LaTeX installation by official image over manual installation to + # get more consistent and quick setup times. + # + # It's challenging at the very least to get a compiler suite installed in + # this container. Therefore, we need to choose the OS and Python version + # such that pip can install all packages (e.g., the numpy version needed to + # build the package) from prebuilt wheels. + runs-on: ubuntu-latest + needs: configure + env: + UID_GID: ${{ needs.configure.outputs.uid_gid }} + container: + image: texlive/texlive:latest + options: --user ${{ needs.configure.outputs.uid_gid }} steps: ##-- General Setup Steps - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - name: Set up Python + uses: actions/setup-python@v6 with: - python-version: ${{ matrix.python-version }} - - - name: Install LaTeX - run: | - sudo apt-get update - sudo apt-get -y install texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra latexmk + python-version: 3.13 - name: Setup python with tox - run: $CLONE_PATH/.github/workflows/install_tox.sh - + run: | + echo "UID/GID from configure = $UID_GID" + echo "UID/GID actual = $(id -u):$(id -g)" + $CLONE_PATH/.github/workflows/install_tox.sh - name: Build sphinx docs run: | - pushd $CLONE_PATH + cd $CLONE_PATH tox -r -e pdf,html - popd ##-- Make documents available as artifacts - name: Archive surmise docs - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: surmise-sphinx-docs path: | diff --git a/.github/workflows/install_tox.sh b/.github/workflows/install_tox.sh index 340318d2..7dbb056f 100755 --- a/.github/workflows/install_tox.sh +++ b/.github/workflows/install_tox.sh @@ -10,7 +10,7 @@ which pip which tox echo python --version -pip --version tox --version echo -pip list +python -m pip list +echo