-
Notifications
You must be signed in to change notification settings - Fork 6
/
CI.lean
33 lines (31 loc) · 1.04 KB
/
CI.lean
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
open System
def ciConfig (branches : String) : String := s!"name: \"LSpec CI\"
on:
pull_request:
push:
branches:{branches}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: install elan
run: |
set -o pipefail
curl -sSfL https://github.com/leanprover/elan/releases/download/v1.4.2/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz
./elan-init -y --default-toolchain none
echo \"$HOME/.elan/bin\" >> $GITHUB_PATH
- uses: actions/checkout@v2
- name: run LSpec binary
run: lake exe lspec
"
def main (branches : List String) : IO Unit := do
let branches := if branches.isEmpty then ["main"] else branches
let branches := .join $ branches.map (s!"\n - {·}")
let wfPath : FilePath := ".github" / "workflows"
let ciPath : FilePath := wfPath / "lspec.yml"
if ← ciPath.pathExists then
IO.println s!"{ciPath} already exists"
else
if !(← wfPath.pathExists) then IO.FS.createDirAll wfPath
IO.FS.writeFile ciPath (ciConfig branches)