forked from leanprover-community/mathlib4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmk_build_yml.sh
executable file
·84 lines (70 loc) · 1.63 KB
/
mk_build_yml.sh
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
#!/usr/bin/env bash
set -ex
cd $(dirname "$(realpath "$0")")
header() {
cat <<EOF
# DO NOT EDIT THIS FILE!!!
# This file is automatically generated by mk_build_yml.sh
# Edit build.yml.in instead and run mk_build_yml.sh to update.
# Forks of mathlib and other projects should be able to use build_fork.yml directly
EOF
}
build_yml() {
header
cat <<EOF
# The jobs in this file run on self-hosted workers and will not be run from external forks
on:
push:
branches-ignore:
# ignore tmp branches used by bors
- 'staging.tmp*'
- 'trying.tmp*'
- 'staging*.tmp'
- 'nolints'
# ignore staging branch used by bors, this is handled by bors.yml
- 'staging'
merge_group:
name: continuous integration
EOF
include 1 pr == "" ubuntu-latest
}
bors_yml() {
header
cat <<EOF
# The jobs in this file run on self-hosted workers and will not be run from external forks
on:
push:
branches:
- staging
name: continuous integration (staging)
EOF
include 1 bors == "" bors
}
build_fork_yml() {
header
cat <<EOF
# The jobs in this file run on GitHub-hosted workers and will only be run from external forks
on:
push:
branches-ignore:
# ignore tmp branches used by bors
- 'staging.tmp*'
- 'trying.tmp*'
- 'staging*.tmp'
- 'nolints'
name: continuous integration (mathlib forks)
EOF
include 0 ubuntu-latest != " (fork)" ubuntu-latest
}
include() {
sed "
s/IS_SELF_HOSTED/$1/g;
s/RUNS_ON/$2/g;
s/MAIN_OR_FORK/$3/g;
s/JOB_NAME/$4/g;
s/STYLE_LINT_RUNNER/$5/g;
" build.yml.in
}
build_yml > build.yml
bors_yml > bors.yml
build_fork_yml > build_fork.yml