-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (62 loc) · 1.87 KB
/
Copy pathci.yml
File metadata and controls
75 lines (62 loc) · 1.87 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
name: CI
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Check formatting
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "These files are not gofmt-formatted:"
echo "$unformatted"
exit 1
fi
- name: Vet
run: go vet ./...
- name: Build
run: go build ./...
- name: Test
run: go test -short ./...
docker:
name: Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build -t timelock-capsule:ci .
# Starting the container proves more than the build does: it catches a
# missing web/ directory, absent CA certificates, and binding to localhost
# instead of all interfaces -- none of which fail at build time.
- name: Start container
run: docker run -d --name tlc -p 8080:8080 timelock-capsule:ci
- name: Wait for health
run: |
for i in $(seq 1 30); do
if curl -sf http://localhost:8080/api/health > /dev/null; then
echo "healthy after ${i}s"
exit 0
fi
sleep 1
done
echo "container did not become healthy"
docker logs tlc
exit 1
- name: Check the UI and its assets are served
run: |
curl -sf http://localhost:8080/ > /dev/null
curl -sf http://localhost:8080/static/css/style.css > /dev/null
curl -sf http://localhost:8080/static/js/app.js > /dev/null
- name: Stop container
if: always()
run: docker rm -f tlc