Files
stack/.gitea/workflows/lean-pay.yml
kert df29e8d958
All checks were successful
CI / lint (push) Successful in 52s
CI / notebooks-smoke (push) Successful in 2m11s
Deploy / changes (push) Successful in 18s
CI / test (push) Successful in 6m2s
Deploy / notebooks (push) Has been skipped
Deploy / zotero (push) Has been skipped
Deploy / docs (push) Has been skipped
Deploy / api (push) Has been skipped
Deploy / bcda (push) Has been skipped
Deploy / llm (push) Has been skipped
Deploy / mc (push) Has been skipped
Lean Pay / pay (push) Successful in 2m51s
Deploy / report (push) Successful in 15s
fix(ci): run lean from lean/Pay so elan finds the toolchain
The install step called lean at the repo root. Elan has no default
toolchain, so the job died before typecheck. Run 2121, issue #1657.
2026-11-17 14:08:55 -05:00

113 lines
4.4 KiB
YAML

# DO NOT EDIT — generated by gen_config.py from stack.toml
# Re-generate: uv run python dev/scripts/gen_config.py
name: Lean Pay
on:
workflow_dispatch:
push:
branches: [main]
jobs:
pay:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: https://github.com/actions/checkout@v4
- name: Detect Lean changes
id: filter
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "pay=true" >> "$GITHUB_OUTPUT"
exit 0
fi
# github.event.before misses files from a push that was cancelled
# before this job started. workflow_dispatch above is the rerun.
before="${{ github.event.before }}"
changed=__all__
if [ -n "$before" ] && [ "$before" != "0000000000000000000000000000000000000000" ]; then
git fetch --quiet --depth=1 origin "$before" || true
if git cat-file -e "${before}^{commit}" 2>/dev/null; then
changed="$(git diff --name-only "$before" "$GITHUB_SHA")" || changed=__all__
fi
fi
hit=false
if [ "$changed" = __all__ ]; then
hit=true
else
while IFS= read -r f; do
[ -n "$f" ] || continue
case "$f" in
lean/*|.gitea/workflows/lean-pay.yml) hit=true ;;
esac
done <<< "$changed"
fi
echo "pay=$hit" >> "$GITHUB_OUTPUT"
- name: Install Lean 4.34.0 from the GitHub release
if: steps.filter.outputs.pay == 'true'
run: |
set -euo pipefail
root="$HOME/.local/lean-4.34.0-linux"
if [ ! -x "$root/bin/lake" ]; then
curl -fL --retry 3 -o /tmp/lean.tar.zst \
"https://github.com/leanprover/lean4/releases/download/v4.34.0/lean-4.34.0-linux.tar.zst"
mkdir -p "$HOME/.local"
tar --zstd -xf /tmp/lean.tar.zst -C "$HOME/.local"
rm -f /tmp/lean.tar.zst
fi
if [ ! -x "$HOME/.elan/bin/elan" ]; then
curl -fsSL https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh \
| sh -s -- -y --default-toolchain none
fi
# shellcheck disable=SC1091
. "$HOME/.elan/env"
echo "$HOME/.elan/bin" >> "$GITHUB_PATH"
elan toolchain unlink "leanprover/lean4:v4.34.0" >/dev/null 2>&1 || true
elan toolchain link "leanprover/lean4:v4.34.0" "$root"
# The repo root has no lean-toolchain file, and elan has no
# default toolchain. The pin is lean/Pay/lean-toolchain.
cd lean/Pay
lean --version
lake --version
- name: Typecheck Pay and compare pay-cases
if: steps.filter.outputs.pay == 'true'
run: |
set -euo pipefail
export PATH="$HOME/.elan/bin:$PATH"
cd lean/Pay
lake update
lake exe cache get
lake build
lake exe pay-cases > /tmp/pay-cases.json
diff -u cases.json /tmp/pay-cases.json
- name: File failure issue
if: failure() && steps.filter.outputs.pay == 'true' && !startsWith(github.head_ref || github.ref_name, 'renovate/')
env:
GITEA_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
run: |
py=python3
command -v python3 >/dev/null 2>&1 || { command -v uv >/dev/null 2>&1 || curl -LsSf https://astral.sh/uv/install.sh | sh; export PATH="$HOME/.local/bin:$PATH"; py="uv run --no-project python"; }
$py src/api/diag/ci.py \
--workflow "Lean Pay" --job "pay" \
--run "${{ github.run_number }}" \
--sha "${{ github.sha }}" \
--ref "${{ github.ref }}" || true
- name: Close resolved issue
if: success() && steps.filter.outputs.pay == 'true' && !startsWith(github.head_ref || github.ref_name, 'renovate/')
env:
GITEA_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
run: |
py=python3
command -v python3 >/dev/null 2>&1 || { command -v uv >/dev/null 2>&1 || curl -LsSf https://astral.sh/uv/install.sh | sh; export PATH="$HOME/.local/bin:$PATH"; py="uv run --no-project python"; }
$py src/api/diag/ci.py \
--close \
--workflow "Lean Pay" --job "pay" \
--run "${{ github.run_number }}" \
--sha "${{ github.sha }}" \
--ref "${{ github.ref }}" || true