-
Notifications
You must be signed in to change notification settings - Fork 75
125 lines (107 loc) · 5.15 KB
/
Copy pathci.yml
File metadata and controls
125 lines (107 loc) · 5.15 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events for the main branch or for release branches
push:
branches:
- 'master'
- 'release/*'
tags:
- '*'
pull_request:
branches: [master]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# This workflow builds pull request code, including code from forks, so it holds
# no secrets and only reads. The book HTML leaves here as an artifact, and
# deploy.yml picks it up and publishes it.
permissions:
contents: read
jobs:
build:
name: Build book
runs-on: ubuntu-latest
steps:
- name: Install a C compiler
run: sudo apt-get install -y build-essential
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# The book runs a Python interpreter during the build and shows its
# output, so the version is pinned to keep that output stable.
- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: 3.10.4
- name: Setup elan toolchain on this build
run: |
curl -O --location https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh
chmod u+x elan-init.sh
./elan-init.sh -y --default-toolchain none
- name: Set elan paths
run: |
echo "$HOME/.elan/bin" >> "$GITHUB_PATH"
- name: Install lean toolchain for examples
run: |
cd examples
lean --version
- name: Install lean toolchain for text
run: |
cd book
lean --version
- name: Cache examples/.lake
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: examples/.lake
# The SHA is in the key to get the most recent cache possible, rather than just saving a single one for each Lean/deps version and not touching it.
key: ${{ runner.os }}-${{ hashFiles('examples/lake-manifest.json') }}-${{ hashFiles('examples/lean-toolchain') }}-${{ github.sha }}
# Try to restore cache for same OS/Lean/deps, but don't get less specific, because Lake isn't always happy to get build product version mismatches
restore-keys: |
${{ runner.os }}-${{ hashFiles('examples/lake-manifest.json') }}-${{ hashFiles('examples/lean-toolchain') }}-
- name: Cache book/.lake
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: book/.lake
# The SHA is in the key to get the most recent cache possible, rather than just saving a single one for each Lean/deps version and not touching it.
key: ${{ runner.os }}-${{ hashFiles('book/lake-manifest.json') }}-${{ hashFiles('book/lean-toolchain') }}-${{ github.sha }}
# Try to restore cache for same OS/Lean/deps, but don't get less specific, because Lake isn't always happy to get build product version mismatches
restore-keys: |
${{ runner.os }}-${{ hashFiles('book/lake-manifest.json') }}-${{ hashFiles('book/lean-toolchain') }}-
- name: Build example code
run: |
pushd examples
lake build
lake build subverso-extract-mod
popd
- name: Save examples/.lake
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: examples/.lake
# The SHA is in the key to get the most recent cache possible, rather than just saving a single one for each Lean/deps version and not touching it.
key: ${{ runner.os }}-${{ hashFiles('examples/lake-manifest.json') }}-${{ hashFiles('examples/lean-toolchain') }}-${{ github.sha }}
- name: Build book
run: |
pushd book
lake exe fp-lean --depth 2 --without-html-single --verbose
popd
- name: Save book/.lake
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: book/.lake
# The SHA is in the key to get the most recent cache possible, rather than just saving a single one for each Lean/deps version and not touching it.
key: ${{ runner.os }}-${{ hashFiles('book/lake-manifest.json') }}-${{ hashFiles('book/lean-toolchain') }}-${{ github.sha }}
# This is to get the cached highlight JSON files
- name: Save examples/.lake again
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: examples/.lake
# The SHA is in the key to get the most recent cache possible, rather than just saving a single one for each Lean/deps version and not touching it.
key: ${{ runner.os }}-${{ hashFiles('examples/lake-manifest.json') }}-${{ hashFiles('examples/lean-toolchain') }}-${{ github.sha }}
- name: Upload book HTML
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: book-html
path: book/_out/html-multi
retention-days: 7
if-no-files-found: error