Repository navigation
Merge pull request #31 from ArchiveBox/dependabot/uv/pytest-9.0.3 #104
This file contains hidden or 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: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.event_name == 'workflow_dispatch' && github.run_id || github.ref }} | |
| cancel-in-progress: ${{ github.event_name != 'workflow_dispatch' }} | |
| jobs: | |
| pre-commit: | |
| uses: ./.github/workflows/pre-commit-hooks.yaml | |
| python: | |
| uses: ./.github/workflows/test_py.yaml | |
| typescript: | |
| uses: ./.github/workflows/test_ts.yaml | |
| go: | |
| uses: ./.github/workflows/test_go.yaml | |
| rust: | |
| uses: ./.github/workflows/test_rust.yaml | |
| release-artifacts: | |
| name: Build and verify release artifacts | |
| needs: [pre-commit, python, typescript, go, rust] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| with: | |
| python-version: "3.12.13" | |
| - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6 | |
| with: | |
| version: "0.10.6" | |
| enable-cache: false | |
| - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 | |
| with: | |
| version: 10.33.2 | |
| - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable | |
| with: | |
| toolchain: 1.97.1 | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version: 22.23.1 | |
| cache: pnpm | |
| cache-dependency-path: abxbus-ts/pnpm-lock.yaml | |
| - name: Build Python and npm distributions once | |
| run: | | |
| set -Eeuo pipefail | |
| rm -rf release-artifacts abxbus-ts/dist | |
| mkdir -p release-artifacts/python release-artifacts/npm release-artifacts/cratesio | |
| uv build --out-dir release-artifacts/python | |
| rm -f release-artifacts/python/.gitignore | |
| pnpm --dir abxbus-ts install --frozen-lockfile | |
| pnpm --dir abxbus-ts run build | |
| pnpm --dir abxbus-ts pack --pack-destination "$GITHUB_WORKSPACE/release-artifacts/npm" | |
| cargo package --locked --manifest-path abxbus-rust/Cargo.toml | |
| crate=(abxbus-rust/target/package/abxbus-*.crate) | |
| [[ "${#crate[@]}" -eq 1 ]] | |
| cp "${crate[0]}" release-artifacts/cratesio/ | |
| shopt -s nullglob | |
| wheels=(release-artifacts/python/abxbus-*.whl) | |
| sdists=(release-artifacts/python/abxbus-*.tar.gz) | |
| npm_packages=(release-artifacts/npm/abxbus-*.tgz) | |
| crates=(release-artifacts/cratesio/abxbus-*.crate) | |
| [[ "${#wheels[@]}" -eq 1 ]] | |
| [[ "${#sdists[@]}" -eq 1 ]] | |
| [[ "${#npm_packages[@]}" -eq 1 ]] | |
| [[ "${#crates[@]}" -eq 1 ]] | |
| [[ "$(find release-artifacts/python -maxdepth 1 -type f | wc -l | tr -d ' ')" -eq 2 ]] | |
| [[ "$(find release-artifacts/npm -maxdepth 1 -type f | wc -l | tr -d ' ')" -eq 1 ]] | |
| printf '%s\n' "$GITHUB_SHA" > release-artifacts/COMMIT_SHA | |
| ( | |
| cd release-artifacts | |
| find COMMIT_SHA python npm cratesio -type f -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS | |
| sha256sum --check SHA256SUMS | |
| ) | |
| - name: Smoke-test exact Python distributions | |
| run: | | |
| set -Eeuo pipefail | |
| shopt -s nullglob | |
| artifacts=(release-artifacts/python/abxbus-*.whl release-artifacts/python/abxbus-*.tar.gz) | |
| [[ "${#artifacts[@]}" -eq 2 ]] | |
| version="$(uv run --no-cache --no-project python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')" | |
| for artifact in "${artifacts[@]}"; do | |
| smoke_env="$(mktemp -d)/.venv" | |
| uv venv --python 3.12 "$smoke_env" | |
| uv pip install --no-cache --python "$smoke_env" "$artifact" | |
| VIRTUAL_ENV="$smoke_env" uv run --no-cache --active --no-project python -c 'import importlib.metadata; import abxbus; assert importlib.metadata.version("abxbus") == __import__("sys").argv[1]' "$version" | |
| done | |
| - name: Smoke-test exact npm distribution | |
| run: | | |
| set -Eeuo pipefail | |
| shopt -s nullglob | |
| npm_packages=(release-artifacts/npm/abxbus-*.tgz) | |
| [[ "${#npm_packages[@]}" -eq 1 ]] | |
| smoke_dir="$(mktemp -d)" | |
| cd "$smoke_dir" | |
| npm init --yes >/dev/null | |
| npm install --ignore-scripts "${GITHUB_WORKSPACE}/${npm_packages[0]}" | |
| node --input-type=module -e 'const pkg = await import("abxbus"); if (!pkg.EventBus) throw new Error("Missing ESM EventBus export")' | |
| node -e 'const pkg = require("abxbus"); if (!pkg.EventBus) throw new Error("Missing CJS EventBus export")' | |
| - name: Upload exact tested release artifacts | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: release-artifacts-${{ github.sha }} | |
| path: release-artifacts/ | |
| if-no-files-found: error | |
| retention-days: 90 |