Repository navigation
155 lines (130 loc) · 5.74 KB
/
Copy pathci.yml
File metadata and controls
155 lines (130 loc) · 5.74 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Check and Test
on:
pull_request:
push:
branches:
- master
# Twice a month, so a new toolchain or a dependency's release shows up while nothing is pushed.
schedule:
- cron: "15 2 1,16 * *"
workflow_dispatch:
jobs:
build:
permissions:
contents: read
strategy:
matrix:
os: [ubuntu-26.04, macos-26, windows-2025]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: openssl headers (ubuntu)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libssl-dev
- name: install moon (unix)
if: runner.os != 'Windows'
run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
echo "$HOME/.moon/bin" >> $GITHUB_PATH
- name: install moon (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod https://cli.moonbitlang.com/install/powershell.ps1 | Invoke-Expression
Add-Content -Path $env:GITHUB_PATH -Value "$HOME\.moon\bin" -Encoding utf8
- name: post install
run: |
moon version --all
moon update
- name: moon check
run: moon check --target all --deny-warn
- name: moon build
run: moon build --target all
- name: moon build (native server)
run: moon build --target native
- name: moon test (all backends)
run: moon test --target all
- name: generated verbs are fresh
if: runner.os == 'Linux'
run: |
python3 scripts/gen_verbs.py && moon fmt
git -c core.autocrlf=false diff --ignore-cr-at-eol --exit-code -- src/verbs.mbt src/route/verbs.mbt
- name: generated routes are fresh
shell: bash
run: |
for dir in src/examples/27-annotations integration/src/ann src/examples/guide/ann src/examples/guide/annapi; do
moon run src/cmd/routes --target native -- -C . $dir/routes.mbt -o $dir/routes.g.mbt --check
done
- name: the guide shows the code it runs
if: runner.os == 'Linux'
run: python3 scripts/gen_guide.py --check
- name: the OpenAPI documents pass the official validator
if: runner.os == 'Linux'
run: |
python3 -m venv "$RUNNER_TEMP/oas"
"$RUNNER_TEMP/oas/bin/pip" install --quiet openapi-spec-validator
"$RUNNER_TEMP/oas/bin/python" scripts/check_openapi.py
- name: annotated example runs
run: moon run src/examples/27-annotations | grep -q "PURGE /cache -> 200 purged"
- name: three registrations of the ecosystem example agree
shell: bash
run: |
(cd integration && moon run src/check --target native) > "$RUNNER_TEMP/ecosystem.txt"
grep -q "same: all three registrations answer alike" "$RUNNER_TEMP/ecosystem.txt"
grep -q "POST /tasks -> 201" "$RUNNER_TEMP/ecosystem.txt"
grep -q "POST /tasks -> 422" "$RUNNER_TEMP/ecosystem.txt"
- name: templates example runs
run: moon run src/examples/28-templates | grep -q 'href="/users/8"'
- name: the agent example answers through the mounted service
run: moon run src/examples/29-agents | grep -q '"text":"pet 7"'
- name: the docs example serves four readers
run: moon run src/examples/22-docs-ui | grep -q '/redocly -> 200'
- name: lint (fmt is clean)
run: |
moon fmt && git -c core.autocrlf=false diff --ignore-cr-at-eol --exit-code
- name: interfaces are up to date
run: |
moon info --target all && git -c core.autocrlf=false diff --ignore-cr-at-eol --exit-code
- name: the skills are valid
if: runner.os == 'Linux'
run: |
for dir in docs/skills/*/; do
case "$dir" in *CHANGE-ME*) continue ;; esac
[ -f "$dir/SKILL.md" ] || continue
pipx run --spec skills-ref agentskills validate "$dir"
done
# A reader pastes the blocks of the README and the skills into a project, so they have
# to compile as written, against this commit's source.
- name: the code in the docs compiles
if: runner.os == 'Linux'
run: python3 scripts/check_snippets.py
# The routing rules this framework follows are the ones two mature
# implementations follow: the same routes, the same requests, the same
# answers, compared rather than asserted.
- name: the answers match two mature implementations
if: runner.os == 'Linux'
run: |
python3 -m venv "$RUNNER_TEMP/peers"
"$RUNNER_TEMP/peers/bin/pip" install --quiet fastapi httpx
(cd integration && moon run src/differential --target native) > "$RUNNER_TEMP/ours.jsonl"
"$RUNNER_TEMP/peers/bin/python" scripts/diff_http_semantics.py "$RUNNER_TEMP/ours.jsonl"
# And other people's software reads what a served application says: the
# HTTP client in Python's standard library, its WebSocket client, and the
# reference MCP client, over real sockets.
- name: a served application talks to other clients
if: runner.os == 'Linux'
run: |
python3 -m venv "$RUNNER_TEMP/live"
"$RUNNER_TEMP/live/bin/pip" install --quiet websockets mcp
(cd integration && moon run src/full-example --target native) &
server=$!
for _ in $(seq 1 300); do
if (exec 3<>/dev/tcp/127.0.0.1/12000) 2>/dev/null; then exec 3>&-; break; fi
sleep 1
done
"$RUNNER_TEMP/live/bin/python" scripts/check_live_interop.py
kill "$server" 2>/dev/null || true
pkill -f full-example 2>/dev/null || true