-
Notifications
You must be signed in to change notification settings - Fork 2
104 lines (99 loc) · 3.24 KB
/
lean4.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Lean 4 Playground
on:
# Triggers the workflow on push or pull request events but only for the "main" branch and "v4*" branches
push:
branches:
- main
- 'v4*'
pull_request:
branches:
- main
- 'v4*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
# This workflow contains a single job called "lean4"
lean4:
name: Lean 4 Examples
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
steps:
- name: install elan on Ubuntu and macOS
if: matrix.os != 'windows-latest'
run: |
set -o pipefail
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | bash -s -- -y
echo "$HOME/.elan/bin" >> $GITHUB_PATH
- name: install elan on Windows
if: matrix.os == 'windows-latest'
run: |
curl -O --location https://raw.githubusercontent.com/leanprover/elan/master/elan-init.ps1
.\elan-init.ps1 -NoPrompt 1 -DefaultToolchain none
echo "$HOME\.elan\bin" >> $env:GITHUB_PATH
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
# cache: 'pip' # caching pip dependencies
- name: check examples
run: |
cd lean4
lake exe cache get
lake script run check_examples
- name: annotate examples
# annotation is enabled for Github Pages deployment or for commits with '[annotate]' in the message
if: >-
matrix.os == 'ubuntu-latest' && (
startsWith(github.ref, 'refs/heads/v4') ||
contains(github.event.head_commit.message, '[annotate]')
)
run: |
cd lean4
./install_deps.sh
./annotate_all.sh
# lake env leanInk analyze examples/Help.lean
- name: Upload artifact
# For now, disable the deployment job for the main branch
# and enable for v4* branches
if: >-
matrix.os == 'ubuntu-latest' && (
(github.ref == 'main' && contains(github.event.head_commit.message, '[annotate]')) ||
startsWith(github.ref, 'refs/heads/v4')
)
uses: actions/upload-pages-artifact@v3
with:
path: ./lean4/dist
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
fail-fast: false
needs: lean4
steps:
- name: Deploy to GitHub Pages
id: deployment
# For now, disable the deployment job for the main branch
# and enable for v4* branches
if: >-
matrix.os == 'ubuntu-latest' && (
(github.ref == 'main' && contains(github.event.head_commit.message, '[annotate]')) ||
startsWith(github.ref, 'refs/heads/v4')
)
uses: actions/deploy-pages@v4