-
Notifications
You must be signed in to change notification settings - Fork 34
131 lines (119 loc) · 3.47 KB
/
build.yml
File metadata and controls
131 lines (119 loc) · 3.47 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
name: build
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
release:
types: [published]
permissions:
contents: write
jobs:
macos:
name: macOS (${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include:
- runner: macos-15
arch: arm64
- runner: macos-15
arch: x86_64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Show toolchain
run: |
clang++ --version
make --version | head -n 1
uname -a
- name: Build (release)
run: make
- name: Smoke test (start server, fetch a file)
run: |
set -euo pipefail
mkdir -p htdocs
echo "hello from CI" > htdocs/index.html
cat > server.config <<EOF
vhost=127.0.0.1
port=8080
diskpath=./htdocs
EOF
./bin/httpserver &
server_pid=$!
trap 'kill $server_pid 2>/dev/null || true' EXIT
for i in $(seq 1 20); do
if curl -fsS -o /dev/null http://127.0.0.1:8080/index.html; then
break
fi
sleep 0.5
done
body=$(curl -fsS http://127.0.0.1:8080/index.html)
test "$body" = "hello from CI"
- uses: actions/upload-artifact@v4
with:
name: httpserver-macos-${{ matrix.arch }}
path: bin/httpserver
if-no-files-found: error
- name: Attach binary to GitHub Release
if: github.event_name == 'release'
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
asset="httpserver-macos-${{ matrix.arch }}"
cp bin/httpserver "$asset"
gh release upload "${{ github.event.release.tag_name }}" "$asset" --clobber
freebsd:
name: FreeBSD 15 (amd64)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and smoke test in FreeBSD VM
uses: vmactions/freebsd-vm@v1
with:
release: "15.0"
usesh: true
prepare: |
pkg install -y gmake curl
run: |
set -eu
clang++ --version
gmake --version | head -n 1
uname -a
gmake
mkdir -p htdocs
echo "hello from CI" > htdocs/index.html
cat > server.config <<EOF
vhost=127.0.0.1
port=8080
diskpath=./htdocs
EOF
./bin/httpserver &
server_pid=$!
trap "kill $server_pid 2>/dev/null || true" EXIT
i=0
while [ $i -lt 20 ]; do
if curl -fsS -o /dev/null http://127.0.0.1:8080/index.html; then
break
fi
sleep 1
i=$((i+1))
done
body=$(curl -fsS http://127.0.0.1:8080/index.html)
test "$body" = "hello from CI"
- uses: actions/upload-artifact@v4
with:
name: httpserver-freebsd-15-amd64
path: bin/httpserver
if-no-files-found: error
- name: Attach binary to GitHub Release
if: github.event_name == 'release'
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
asset="httpserver-freebsd15-amd64"
cp bin/httpserver "$asset"
gh release upload "${{ github.event.release.tag_name }}" "$asset" --clobber