release: prepare v0.1.1 local candidate #10
Workflow file for this run
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: Tests | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| PIP_DISABLE_PIP_VERSION_CHECK: "1" | |
| PYTHONUTF8: "1" | |
| jobs: | |
| test: | |
| name: ${{ format('{0} / Python {1}', matrix.os, matrix.python-version) }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-24.04 | |
| - macos-15 | |
| python-version: | |
| - "3.9" | |
| - "3.14" | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install test dependency for Python 3.9 | |
| if: matrix.python-version == '3.9' | |
| run: python -m pip install "pytest==8.3.5" | |
| - name: Install test dependency for latest Python | |
| if: matrix.python-version != '3.9' | |
| run: python -m pip install "pytest==8.4.2" | |
| - name: Compile Python source | |
| run: python -m py_compile codex-instruct.py | |
| - name: Run tests | |
| run: python -m pytest -p no:cacheprovider -q tests | |
| quality: | |
| name: Quality / Python 3.14 | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Set up Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: "3.14" | |
| - name: Install quality dependencies | |
| run: python -m pip install -r requirements-quality.txt | |
| - name: Compile Python sources | |
| run: >- | |
| python -m py_compile | |
| codex-instruct.py | |
| scripts/build_release.py | |
| scripts/run_prompt_bank_regression.py | |
| - name: Run Ruff | |
| run: python -m ruff check codex-instruct.py tests scripts | |
| - name: Run branch coverage | |
| run: | | |
| python -m coverage erase | |
| python -m coverage run --branch --parallel-mode -m pytest -p no:cacheprovider -q tests | |
| python -m coverage combine | |
| python -m coverage report --include=codex-instruct.py,scripts/run_prompt_bank_regression.py --fail-under=81 | |
| - name: Validate prompt bank contracts | |
| run: python scripts/run_prompt_bank_regression.py --validate-only | |
| - name: Build or reject release candidate assets | |
| run: | | |
| release_tag="v$(tr -d '\r\n' < VERSION)" | |
| source_commit="$(git rev-parse --verify 'HEAD^{commit}')" | |
| shallow="$(git rev-parse --is-shallow-repository)" | |
| if [ "$shallow" != "false" ]; then | |
| echo "Release verification requires a complete checkout with tags." >&2 | |
| exit 1 | |
| fi | |
| if [ "$source_commit" != "$GITHUB_SHA" ]; then | |
| echo "Checked-out HEAD does not match GITHUB_SHA." >&2 | |
| exit 1 | |
| fi | |
| tag_ref="refs/tags/${release_tag}" | |
| if git show-ref --verify --quiet "$tag_ref"; then | |
| tag_commit="$(git rev-parse --verify "${tag_ref}^{commit}")" | |
| if [ "$tag_commit" != "$source_commit" ]; then | |
| echo "${release_tag} is already bound to ${tag_commit}; verifying refusal for ${source_commit}." | |
| if refusal="$(python scripts/build_release.py "$release_tag" --source-commit "$source_commit" --output-dir dist 2>&1)"; then | |
| echo "Release builder accepted a conflicting existing version tag." >&2 | |
| exit 1 | |
| fi | |
| expected="release tag ${release_tag} already points to ${tag_commit}, not candidate ${source_commit}" | |
| case "$refusal" in | |
| *"$expected"*) ;; | |
| *) | |
| echo "$refusal" >&2 | |
| echo "Release builder failed for an unexpected reason." >&2 | |
| exit 1 | |
| ;; | |
| esac | |
| test ! -e dist | |
| echo "Release builder correctly refused the conflicting candidate." | |
| exit 0 | |
| fi | |
| fi | |
| echo "Candidate-only verification for ${release_tag} at ${source_commit}; no release is published." | |
| python scripts/build_release.py "$release_tag" --source-commit "$source_commit" --output-dir dist | |
| cd dist | |
| sha256sum --check SHA256SUMS |