-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (129 loc) · 4.43 KB
/
Copy pathci.yml
File metadata and controls
142 lines (129 loc) · 4.43 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions:
contents: read
jobs:
build:
name: Build project
runs-on: ubuntu-latest
needs: mk-all-check
steps:
- uses: actions/checkout@v7
- name: Setup elan
run: |
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --default-toolchain none
echo "$HOME/.elan/bin" >> "$GITHUB_PATH"
# Restore project cache
- name: Get Mathlib cache
run: lake exe cache get
- name: Restore cache
id: cache-restore
uses: actions/cache/restore@v6
with:
path: .lake/ProvabilityLogic-x86_64-unknown-linux-gnu.tar.gz
# NOTE: including github branch name and SHA for avoding cache key reserving problem
key: lake-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
lake-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}-${{ github.ref_name }}
lake-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}
- name: Unpack project cache
if: hashFiles('.lake/ProvabilityLogic-x86_64-unknown-linux-gnu.tar.gz') != ''
run: lake unpack
- name: Build ProvabilityLogic
run: lake build ProvabilityLogic
- name: Pack project cache
run: lake pack
- name: Save project cache
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
id: cache-save
uses: actions/cache/save@v6
with:
path: .lake/ProvabilityLogic-x86_64-unknown-linux-gnu.tar.gz
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
- uses: ts-graphviz/setup-graphviz@v2
- uses: extractions/setup-just@v3
- name: Generate import graph
run: just import-graph
- name: Upload lean artifacts
uses: actions/upload-artifact@v7
with:
name: lean-artifacts
path: |
import_graph.png
import_graph.pdf
import_graph.html
retention-days: 1
include-hidden-files: true
check-references:
name: Check references.bib format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: extractions/setup-just@v3
- name: Install bibtool
run: |
sudo apt-get update
sudo apt-get install -y bibtool
- name: Check references.bib is formatted
run: |
just format-bib
if [ -n "$(git diff)" ]; then
echo "references.bib is not formatted. Please run 'just format-bib' and commit the changes."
exit 1
fi
mk-all-check:
name: Check mk_all executed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: extractions/setup-just@v3
- name: Setup elan
run: |
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y
echo "$HOME/.elan/bin" >> "$GITHUB_PATH"
- name: Check mk_all executed
run: |
just mk-all
if [ -n "$(git diff)" ]; then
echo "Files were modified by mk_all. Please run 'just mk-all' and commit the changes."
exit 1
fi
deploy:
name: Generate page
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs:
- build
- check-references
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download lean artifacts
uses: actions/download-artifact@v8
with:
name: lean-artifacts
- name: Copy from artifacts to pages
run: |
mkdir -p pages
cp "$GITHUB_WORKSPACE/import_graph.png" \
"$GITHUB_WORKSPACE/import_graph.pdf" \
"$GITHUB_WORKSPACE/import_graph.html" \
pages/
- uses: actions/upload-pages-artifact@v5
with:
path: pages
- uses: actions/deploy-pages@v5
id: deployment