restructure CI into build + smoketest pipeline (#6)
This commit is contained in:
81
.github/workflows/test.yml
vendored
81
.github/workflows/test.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: ./test.sh
|
name: ci
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -6,20 +6,45 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
build:
|
||||||
name: ${{ matrix.image || matrix.os }}
|
name: build (${{ matrix.platform }})
|
||||||
runs-on: ${{ matrix.runs-on }}
|
runs-on: ${{ matrix.runs-on }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
# native (no docker)
|
- platform: macos
|
||||||
- os: macos-latest
|
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
- platform: linux-x86_64
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
- platform: linux-arm64
|
||||||
|
runs-on: ubuntu-24.04-arm
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: actions/setup-python@v6
|
||||||
|
with:
|
||||||
|
python-version: "3.14"
|
||||||
|
- name: Build wheels
|
||||||
|
run: |
|
||||||
|
for pkg in */pyproject.toml; do
|
||||||
|
pip wheel "./$(dirname "$pkg")" --no-deps --wheel-dir dist/
|
||||||
|
done
|
||||||
|
- name: Smoketest locally
|
||||||
|
run: bash smoketest.sh dist/
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: wheels-${{ matrix.platform }}
|
||||||
|
path: dist/*.whl
|
||||||
|
|
||||||
# the provided github actions runner images
|
test:
|
||||||
# have tons of pre-installed packages. the
|
name: test (${{ matrix.image }})
|
||||||
# goal here is to test across many vanilla setups
|
needs: build
|
||||||
|
runs-on: ${{ matrix.runs-on }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
# test on vanilla linux images
|
||||||
- image: debian:bookworm-slim
|
- image: debian:bookworm-slim
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
- image: ubuntu:24.04
|
- image: ubuntu:24.04
|
||||||
@@ -28,8 +53,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
- image: archlinux:latest
|
- image: archlinux:latest
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
- image: alpine:3.21 # musl libc
|
# TODO: make musl work
|
||||||
runs-on: ubuntu-latest
|
#- image: alpine:3.21
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
- image: opensuse/tumbleweed:latest
|
- image: opensuse/tumbleweed:latest
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
- image: ghcr.io/void-linux/void-glibc:latest
|
- image: ghcr.io/void-linux/void-glibc:latest
|
||||||
@@ -38,36 +64,27 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04-arm
|
runs-on: ubuntu-24.04-arm
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
# native (macOS)
|
|
||||||
- if: ${{ !matrix.image }}
|
|
||||||
uses: actions/setup-python@v6
|
|
||||||
with:
|
with:
|
||||||
python-version: "3.14"
|
name: wheels-${{ contains(matrix.runs-on, 'arm') && 'linux-arm64' || 'linux-x86_64' }}
|
||||||
- if: ${{ !matrix.image }}
|
path: wheels
|
||||||
name: ./test.sh
|
- name: build docker
|
||||||
run: ./test.sh
|
|
||||||
|
|
||||||
# docker (vanilla Linux)
|
|
||||||
- if: ${{ matrix.image }}
|
|
||||||
name: install python3
|
|
||||||
run: |
|
run: |
|
||||||
docker build -t test -f - . <<'DOCKERFILE'
|
docker build -t smoketest -f - . <<'DOCKERFILE'
|
||||||
FROM ${{ matrix.image }}
|
FROM ${{ matrix.image }}
|
||||||
RUN if command -v apk >/dev/null; then \
|
RUN if command -v apk >/dev/null; then \
|
||||||
apk add --no-cache python3 py3-pip bash curl; \
|
apk add --no-cache python3 py3-pip bash; \
|
||||||
elif command -v apt-get >/dev/null; then \
|
elif command -v apt-get >/dev/null; then \
|
||||||
apt-get update && apt-get install -y --no-install-recommends python3 python3-pip python3-venv curl ca-certificates; \
|
apt-get update && apt-get install -y --no-install-recommends python3 python3-pip python3-venv; \
|
||||||
elif command -v dnf >/dev/null; then \
|
elif command -v dnf >/dev/null; then \
|
||||||
dnf install -y python3 python3-pip curl; \
|
dnf install -y python3 python3-pip; \
|
||||||
elif command -v pacman >/dev/null; then \
|
elif command -v pacman >/dev/null; then \
|
||||||
pacman -Sy --noconfirm python python-pip curl; \
|
pacman -Sy --noconfirm python python-pip; \
|
||||||
elif command -v zypper >/dev/null; then \
|
elif command -v zypper >/dev/null; then \
|
||||||
zypper install -y python3 python3-pip curl; \
|
zypper install -y python3 python3-pip; \
|
||||||
elif command -v xbps-install >/dev/null; then \
|
elif command -v xbps-install >/dev/null; then \
|
||||||
xbps-install -Sy python3 python3-pip bash curl; \
|
xbps-install -Sy python3 python3-pip bash; \
|
||||||
fi
|
fi
|
||||||
DOCKERFILE
|
DOCKERFILE
|
||||||
- if: ${{ matrix.image }}
|
- name: ./smoketest.sh
|
||||||
name: ./test.sh
|
run: docker run --rm -v "$PWD:/work" -w /work smoketest bash smoketest.sh wheels/
|
||||||
run: docker run --rm -v "$PWD:/work" -w /work test bash ./test.sh
|
|
||||||
|
|||||||
@@ -19,3 +19,9 @@ def _run_objcopy():
|
|||||||
|
|
||||||
def _run_size():
|
def _run_size():
|
||||||
_run("arm-none-eabi-size")
|
_run("arm-none-eabi-size")
|
||||||
|
|
||||||
|
|
||||||
|
def smoketest():
|
||||||
|
import subprocess
|
||||||
|
gcc = os.path.join(TOOLCHAIN_DIR, "bin", "arm-none-eabi-gcc")
|
||||||
|
subprocess.run([gcc, "--version"], check=True)
|
||||||
|
|||||||
18
smoketest.sh
Executable file
18
smoketest.sh
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
|
WHEEL_DIR="${1:?Usage: smoketest.sh <wheel-directory>}"
|
||||||
|
WHEEL_DIR="$(cd "$WHEEL_DIR" && pwd)"
|
||||||
|
|
||||||
|
VENV_DIR="$(mktemp -d)"
|
||||||
|
trap 'rm -rf "$VENV_DIR"' EXIT
|
||||||
|
python3 -m venv "$VENV_DIR"
|
||||||
|
source "$VENV_DIR/bin/activate"
|
||||||
|
pip install --upgrade pip >/dev/null
|
||||||
|
pip install "$WHEEL_DIR"/*.whl
|
||||||
|
|
||||||
|
for toml in "$REPO_DIR"/*/pyproject.toml; do
|
||||||
|
module="$(basename "$(dirname "$toml")" | tr '-' '_')"
|
||||||
|
python3 -c "import $module; $module.smoketest()" && echo "$module: OK"
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user