/
web-init.sh
executable file
·165 lines (134 loc) · 3.5 KB
/
web-init.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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/usr/bin/env bash
#
# Usage:
# soil/web-init.sh <function name>
#
# Examples:
# soil/web-init.sh deploy-data # CSS, JS, etc.
# soil/web-init.sh deploy-code # web.py and its dependencies
set -o nounset
set -o pipefail
set -o errexit
source soil/common.sh # for SOIL_USER and SOIL_HOST
# Notes on setting up travis-ci.oilshell.org
#
# - Create the domain and user with dreamhost
# - Set it up to serve out of .wwz files (in dreamhost repo)
# - Deploy public key. (Private key is encrypted and included in the repo.)
#
# Run inside the Travis build
#
home-page() {
### travis-ci.oilshell.org home page
local domain=${1:-'travis-ci.oilshell.org'}
local title="Soil on $domain"
soil-html-head "$title"
cat <<EOF
<body class="width40">
<p id="home-link">
<a href="//oilshell.org/">oilshell.org</a>
</p>
<h1>$title</h1>
<p>This server receives results from cloud build services.
See <a href="https://github.com/oilshell/oil/wiki/Soil">Soil</a> for details.
</p>
<table>
<thead>
<tr>
<td>Recent Jobs</td>
<td>Service Home</td>
<td>Config</td>
</tr>
</thead>
<tr>
<td>
<a href="srht-jobs/">sr.ht</a>
</td>
<td>
<a href="https://builds.sr.ht/~andyc">builds.sr.ht</a>
</td>
<td></td>
</tr>
<tr>
<td>
<a href="github-jobs/">Github Actions</a>
</td>
<td>
<a href="https://github.com/oilshell/oil/actions/workflows/all-builds.yml">github.com</a>
</td>
<td></td>
</tr>
<tr>
<td>
<a href="circle-jobs/">Circle CI</a>
</td>
<td>
<a href="https://app.circleci.com/pipelines/github/oilshell/oil">app.circleci.com</a>
</td>
<td></td>
</tr>
<tr>
<td>
<a href="cirrus-jobs/">Cirrus</a>
</td>
<td>
<a href="https://cirrus-ci.com/github/oilshell/oil">cirrus-ci.com</a>
</td>
<td></td>
</tr>
<tr>
<td>
<a href="travis-jobs/">Travis CI</a> (obsolete)
</td>
<td>
<a href="https://app.travis-ci.com/github/oilshell/oil">app.travis-ci.com</a>
</td>
<td></td>
</tr>
</table>
<h1>Links</h1>
<ul>
<li>
<a href="status-api/github/">static-api/github/</a>
</li>
</ul>
</body>
</html>
EOF
}
deploy-data() {
local user=${1:-$SOIL_USER}
local host=${2:-$SOIL_HOST}
ssh $user@$host mkdir -v -p \
$host/{travis-jobs,srht-jobs,github-jobs,circle-jobs,cirrus-jobs,web,status-api/github} \
$host/web/table
home-page "$host" > _tmp/index.html
# note: duplicating CSS
scp _tmp/index.html $user@$host:$host/
scp web/{base.css,soil.css,ajax.js} $user@$host:$host/web
scp web/table/*.{js,css} $user@$host:$host/web/table
}
soil-web-manifest() {
PYTHONPATH=. /usr/bin/env python2 \
build/dynamic_deps.py py-manifest soil.web \
| grep oilshell/oil # only stuff in the repo
# Add a shell script
echo $PWD/soil/web.sh soil/web.sh
echo $PWD/soil/common.sh soil/common.sh
}
# Also used in test/wild.sh
multi() { ~/git/tree-tools/bin/multi "$@"; }
deploy-code() {
soil-web-manifest | multi cp _tmp/soil-web
tree _tmp/soil-web
rsync --archive --verbose _tmp/soil-web/ $SOIL_USER_HOST:soil-web/
}
deploy() {
deploy-data
deploy-code
}
remote-test() {
ssh $SOIL_USER_HOST \
soil-web/soil/web.sh smoke-test '~/travis-ci.oilshell.org/jobs'
}
"$@"