name: Jules Lean Loop
on:
schedule:
- cron: '17 5 * * *'
workflow_dispatch:
permissions:
contents: write
actions: write
pull-requests: write
jobs:
optimize:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install elan
run: |
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y
echo "$HOME/.elan/bin" >> "$GITHUB_PATH"
- name: Cache Lean toolchain
uses: actions/cache@v4
with:
path: ~/.elan
key: ${{ runner.os }}-elan-${{ hashFiles('lean-toolchain') }}
- name: Cache Lake artifacts
uses: actions/cache@v4
with:
path: .lake
key: ${{ runner.os }}-lake-v1-${{ hashFiles('lean-toolchain', 'lakefile.lean', 'lake-manifest.json') }}
restore-keys: |
${{ runner.os }}-lake-v1-${{ hashFiles('lean-toolchain', 'lakefile.lean') }}-
${{ runner.os }}-lake-v1-${{ hashFiles('lean-toolchain') }}-
- name: Run Lean checks
id: verify
run: |
set +e
chmod +x scripts/lean-check-all.sh
./scripts/lean-check-all.sh > build.log 2>&1
exit_code=$?
if [ "$exit_code" -eq 0 ]; then
echo "status=success" >> "$GITHUB_OUTPUT"
else
echo "status=failure" >> "$GITHUB_OUTPUT"
fi
tail -n 50 build.log || true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Python dependencies
run: pip install requests
- name: Install GitHub CLI
run: |
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh -y
- name: Run Jules loop
env:
JULES_API_KEY: ${{ secrets.JULES_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LOCAL_LOG_FILE: build.log
LOCAL_BUILD_STATUS: ${{ steps.verify.outputs.status }}
run: python scripts/jules_loop.py