Upgrade dev-cmd and simplify slightly. #514
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**' | |
- '!*.md' | |
pull_request: | |
paths: | |
- '**' | |
- '!*.md' | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: CI-${{ github.ref }} | |
# Queue on all branches and tags, but only cancel overlapping PR burns. | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') }} | |
jobs: | |
org-check: | |
name: Check GitHub Organization | |
if: github.repository_owner == 'a-scie' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Noop | |
run: "true" | |
ci: | |
name: (${{ matrix.name }}) CI | |
needs: org-check | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# N.B.: macos-13 is the oldest non-deprecated Intel Mac runner and macos-14 is the oldest | |
# non-deprecated ARM Mac runner. | |
include: | |
- os: ubuntu-24.04 | |
name: Linux x86-64 | |
docker-platform: linux/amd64 | |
- os: ubuntu-24.04 | |
name: Linux aarch64 | |
docker-platform: linux/arm64 | |
- os: ubuntu-24.04 | |
name: Linux armv7l | |
docker-platform: linux/arm/v7 | |
- os: ubuntu-24.04 | |
name: Linux s390x | |
docker-platform: linux/s390x | |
- os: ubuntu-24.04 | |
name: Linux powerpc64le | |
docker-platform: linux/ppc64le | |
- os: macos-13 | |
name: macOS x86-64 | |
- os: macos-14 | |
name: macOS aarch64 | |
- os: windows-2022 | |
name: Windows x86-64 | |
- os: windows-arm64 | |
name: Windows aarch64 | |
env: | |
FORCE_COLOR: 1 | |
SCIENCE_AUTH_API_GITHUB_COM_BEARER: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Install the latest version of uv | |
if: matrix.docker-platform == '' && matrix.os != 'windows-arm64' | |
uses: astral-sh/setup-uv@v5 | |
- name: Setup uv | |
if: matrix.docker-platform == '' && matrix.os != 'windows-arm64' | |
run: | | |
export UV="$(which uv)" | |
"${UV}" -V | |
echo UV="${UV}" >> ${GITHUB_ENV} | |
- name: Install the latest version of uv | |
if: matrix.os == 'windows-arm64' | |
run: | | |
CI_BIN_DIR="$(mktemp -d)" | |
echo CI_BIN_DIR="${CI_BIN_DIR}" >> ${GITHUB_ENV} | |
( | |
cd "${CI_BIN_DIR}" | |
curl -fL -O https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-pc-windows-msvc.zip | |
curl -fL -O https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-pc-windows-msvc.zip.sha256 | |
shasum -c uv-x86_64-pc-windows-msvc.zip.sha256 | |
unzip uv-x86_64-pc-windows-msvc.zip | |
) | |
export UV="${CI_BIN_DIR}/uv.exe" | |
"${UV}" -V | |
echo UV="${UV}" >> ${GITHUB_ENV} | |
- name: Setup x86_64 Python for Prism | |
if: matrix.os == 'windows-arm64' | |
run: | | |
# N.B.: We use an x86-64 Python for Windows ARM64 because this is what we ship with via | |
# PBS, and we need to be able to resolve x86-64 compatible requirements (which include | |
# native deps like psutil) for our shiv. | |
UV_PYTHON_VERSION=cpython-3.12.8-windows-x86_64-none | |
"${UV}" python install ${UV_PYTHON_VERSION} | |
echo UV_PYTHON="${UV_PYTHON_VERSION}" >> ${GITHUB_ENV} | |
- name: Installing emulators | |
if: matrix.docker-platform != '' | |
run: docker run --privileged --rm tonistiigi/binfmt --install all | |
- name: Checkout Lift | |
uses: actions/checkout@v4 | |
- name: Check Formatting & Lints | |
if: matrix.docker-platform == '' | |
run: | | |
"${UV}" run dev-cmd ci --skip test | |
- name: Check Formatting & Lints | |
if: matrix.docker-platform != '' | |
run: | | |
docker run --rm \ | |
-e FORCE_COLOR \ | |
-e SCIENCE_AUTH_API_GITHUB_COM_BEARER \ | |
-v $PWD:/code \ | |
-w /code \ | |
--platform ${{ matrix.docker-platform }} \ | |
python:3.12-bookworm \ | |
bash -c " | |
pip install --root-user-action ignore uv && | |
addgroup --gid $(id -g) build && | |
adduser --disabled-password --gecos '' --gid $(id -g) --uid $(id -u) build && | |
su build -c 'uv run dev-cmd ci --skip test' | |
" | |
- name: Configure Windows pytest short tmp dir path | |
if: matrix.os == 'windows-2022' || matrix.os == 'windows-arm64' | |
run: | | |
mkdir -p C:/tmp/gha | |
echo PYTEST_ADDOPTS="--basetemp C:/tmp/gha/pytest" >> ${GITHUB_ENV} | |
echo SCIE_BASE=C:/tmp/gha/nce >> ${GITHUB_ENV} | |
- name: Unit Tests | |
if: matrix.docker-platform == '' | |
run: | | |
"${UV}" run dev-cmd test -- -vvs | |
- name: Unit Tests | |
if: matrix.docker-platform != '' | |
run: | | |
cat << EOF > _ci_test.sh | |
set -euo pipefail | |
if [[ "${{ matrix.docker-platform }}" == "linux/s390x" ]]; then | |
# This hack gets the PyPy provider tests working on this image. The old PyPy s390x | |
# distributions dynamically link libffi at an older version than I've been able to | |
# find a multi-platform image with s390x support for. | |
ln -s /usr/lib/s390x-linux-gnu/libffi.so.8 /usr/lib/s390x-linux-gnu/libffi.so.6 | |
elif [[ "${{ matrix.docker-platform }}" == "linux/ppc64le" ]]; then | |
echo "Skipping tests on ppc64le." | |
exit 0 | |
fi | |
pip install --root-user-action ignore uv | |
addgroup --gid $(id -g) build | |
adduser --disabled-password --gecos '' --gid $(id -g) --uid $(id -u) build | |
su build -c "uv run dev-cmd test -- -vvs" | |
EOF | |
docker run --rm \ | |
-e FORCE_COLOR \ | |
-e SCIENCE_AUTH_API_GITHUB_COM_BEARER \ | |
-v $PWD:/code \ | |
-w /code \ | |
--platform ${{ matrix.docker-platform }} \ | |
python:3.12-bookworm bash _ci_test.sh | |
- name: Build & Package | |
if: matrix.docker-platform == '' | |
run: | | |
"${UV}" run dev-cmd package | |
- name: Build & Package | |
if: matrix.docker-platform != '' | |
run: | | |
docker run --rm \ | |
-e FORCE_COLOR \ | |
-e SCIENCE_AUTH_API_GITHUB_COM_BEARER \ | |
-v $PWD:/code \ | |
-w /code \ | |
--platform ${{ matrix.docker-platform }} \ | |
python:3.12-bookworm \ | |
bash -c " | |
pip install --root-user-action ignore uv && | |
addgroup --gid $(id -g) build && | |
adduser --disabled-password --gecos '' --gid $(id -g) --uid $(id -u) build && | |
su build -c 'uv run dev-cmd package' | |
" | |
- name: Generate Doc Site | |
if: matrix.docker-platform == '' | |
run: | | |
"${UV}" run dev-cmd doc linkcheck | |
- name: Generate Doc Site | |
if: matrix.docker-platform != '' | |
run: | | |
docker run --rm \ | |
-e FORCE_COLOR \ | |
-e SCIENCE_AUTH_API_GITHUB_COM_BEARER \ | |
-v $PWD:/code \ | |
-w /code \ | |
--platform ${{ matrix.docker-platform }} \ | |
python:3.12-bookworm \ | |
bash -c " | |
pip install --root-user-action ignore uv && | |
addgroup --gid $(id -g) build && | |
adduser --disabled-password --gecos '' --gid $(id -g) --uid $(id -u) build && | |
su build -c 'uv run dev-cmd doc linkcheck' | |
" | |
- name: Cleanup | |
if: always() | |
run: | | |
if [[ -n "${CI_BIN_DIR}" && -d "${CI_BIN_DIR}" ]]; then | |
rm -rf "${CI_BIN_DIR}" | |
fi |