Repository navigation
177 lines (152 loc) · 6.32 KB
/
Copy pathci.yml
File metadata and controls
177 lines (152 loc) · 6.32 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# Everything that can be checked without a device.
#
# The job body is `make ci` rather than a list of steps, so this file and a
# person checking before a commit run exactly the same thing. Adding a check
# here without adding it to the Makefile would give CI a coverage the
# developer cannot reproduce, which is how a green build starts meaning less
# than it should.
#
# What this deliberately does NOT cover is in docs/RELEASE-CHECKLIST.md.
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
# A newer push to the same branch makes an in-flight run irrelevant.
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: Build, vet and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
# Read from go.mod so the version is stated once. Both modules
# declare the same one; the root is the source of truth.
go-version-file: go.mod
# Two modules, so both lock files matter to the cache key.
cache-dependency-path: |
go.sum
clients/go/go.sum
- uses: actions/setup-node@v7
with:
node-version: '22'
# The Java client builds through its Maven wrapper, which fetches a
# pinned, checksum-verified Maven and the pinned plugins; the client
# itself has no dependencies. The cache keeps those downloads between
# runs.
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: '17'
cache: maven
cache-dependency-path: clients/java/pom.xml
# The .NET client targets netstandard2.0 and its tests run on the
# SDK's own runtime, so the SDK is all that is needed -- no NuGet
# restore, because the client has no dependencies.
- uses: actions/setup-dotnet@v6
with:
dotnet-version: '10.0.x'
# Pinned and checksum-verified by the Makefile, so CI and a developer's
# machine run the same linter at the same version.
- name: Install golangci-lint
run: make lint-install
- name: make ci
run: make ci
- name: Build the binary
run: make build
# A smoke test that the thing that just built actually runs. `--help`
# exercises the whole cobra command tree, which has caught a duplicate
# command registration before it reached anyone.
- name: Smoke test
run: |
./bin/mobium --version
./bin/mobium --help > /dev/null
test "$(./bin/mobium --help | grep -cE '^ [a-z-]+ ')" -ge 20
# The .NET client on Windows, where it is most likely to be used and where
# the command line it hand-quotes is parsed by CommandLineToArgvW. Its tests
# start a fake `mobium pipe` (the test program itself), so no mobium binary
# is needed -- which is why this can run before the daemon supports Windows.
dotnet-windows:
name: .NET client on Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v6
with:
dotnet-version: '10.0.x'
- name: make dotnet
shell: bash
run: make dotnet
# Everything Windows can be checked on without a device: the Go tests of
# both modules -- internal/daemon's start a real daemon over the named pipe,
# check it is owner-only while it runs and gone after -- and then the built
# binary, which the tests do not cover. docs/WINDOWS.md, "Doing the work".
# Passing here is not G7: nothing below drives a device.
go-windows:
name: Go and the daemon on Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache-dependency-path: |
go.sum
clients/go/go.sum
# docs/WINDOWS.md's acceptance criteria for the transport, first and on
# their own, so they report even while the rest of the suite does not
# pass on Windows. A hang here is a shutdown that never finishes. Five
# times over, because a shutdown on Windows has overrun once in three.
- name: Daemon transport tests
shell: bash
run: go test -timeout 5m -count 5 ./internal/daemon/ ./internal/paths/
# Not `make build`: its output has no .exe, and Windows will not run it.
- name: Build mobium.exe
if: success() || failure()
shell: bash
run: go build -o bin/mobium.exe ./cmd/mobium
- name: Smoke test
if: success() || failure()
shell: bash
run: |
set -euo pipefail
m=./bin/mobium.exe
$m --version
$m --help > /dev/null
# doctor runs in-process and must work with nothing installed; its
# verdict on this runner is not the point, finishing is.
$m doctor || echo "doctor exited $?"
# mcp runs the tool layer in-process on stdio and never touches the
# daemon, so it is claimed to work here already. Check the claim.
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"ci","version":"0"}}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
| timeout 60 $m mcp > mcp.out
grep -q '"id":2' mcp.out
grep -q '"app_map"' mcp.out
echo "mcp: tools/list answered"
# The daemon through the CLI: auto-start goes through setDetached
# and a real child process, which no test reaches. Read the state
# back each time rather than trusting an exit code.
$m daemon status | tee status.out
grep -q 'not running' status.out
timeout 120 $m devices || echo "devices exited $?"
$m daemon status | tee status.out
grep -q 'Daemon running' status.out
$m daemon stop
$m daemon status | tee status.out
grep -q 'not running' status.out
# Everything else. Much of it is not yet written for Windows -- fakes
# that are shell scripts, executable bits -- and this is what says so.
- name: make test
if: success() || failure()
shell: bash
run: make test