-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (154 loc) · 5.2 KB
/
Copy pathci.yml
File metadata and controls
179 lines (154 loc) · 5.2 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
178
179
name: Check and Test
on:
pull_request:
push:
branches:
- master
jobs:
build:
permissions:
contents: read
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: install-unix
if: ${{ matrix.os != 'windows-latest' }}
run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
echo "$HOME/.moon/bin" >> $GITHUB_PATH
- name: install-windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser; irm https://cli.moonbitlang.com/install/powershell.ps1 | iex
"C:\Users\runneradmin\.moon\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
- 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 test (all backends)
run: moon test --target all
- name: lint (fmt is clean)
run: |
moon fmt && git diff --exit-code
# The discovery drivers' real round trips run against live backends. redis speaks
# RESP over a socket; the native discov tests register, resolve, keep-alive, and
# deregister against it, gated on MOON_REDIS_TEST so the normal suite skips them.
discovery:
name: discovery drivers (native, live redis)
runs-on: ubuntu-latest
permissions:
contents: read
services:
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: install
run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
echo "$HOME/.moon/bin" >> $GITHUB_PATH
- name: post install
run: |
moon version --all
moon update
- name: discovery round trip against live redis
env:
MOON_REDIS_TEST: "1"
MOON_REDIS_HOST: "127.0.0.1"
run: moon test --target native
# consul's agent needs `agent -dev` arguments, so it is started with docker run
# rather than a service container; the native discov tests register a service with a
# TTL check, pass it, resolve the healthy set, and deregister, gated on
# MOON_CONSUL_TEST.
discovery-consul:
name: discovery drivers (native, live consul)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: install
run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
echo "$HOME/.moon/bin" >> $GITHUB_PATH
- name: post install
run: |
moon version --all
moon update
- name: start consul (dev agent)
run: |
docker run -d --name consul -p 8500:8500 hashicorp/consul:1.19 agent -dev -client 0.0.0.0
- name: wait for consul
run: |
for i in $(seq 1 30); do
if curl -sf http://127.0.0.1:8500/v1/status/leader | grep -qE '[0-9]'; then
echo "consul is up"; break
fi
echo "waiting for consul... ($i)"; sleep 2
done
curl -sf http://127.0.0.1:8500/v1/agent/self | head -c 200
- name: discovery round trip against live consul
env:
MOON_CONSUL_TEST: "1"
MOON_CONSUL_HOST: "127.0.0.1"
run: moon test --target native
# etcd serves plaintext gRPC (h2c) on 2379; the native discov client drives real
# KV/Lease calls over moonrpc's socket channel to register, resolve, and deregister,
# gated on MOON_ETCD_TEST.
discovery-etcd:
name: discovery drivers (native, live etcd)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: install
run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
echo "$HOME/.moon/bin" >> $GITHUB_PATH
- name: post install
run: |
moon version --all
moon update
- name: start etcd
run: |
docker run -d --name etcd -p 2379:2379 quay.io/coreos/etcd:v3.5.16 \
/usr/local/bin/etcd --name node1 \
--advertise-client-urls http://0.0.0.0:2379 \
--listen-client-urls http://0.0.0.0:2379
- name: wait for etcd
run: |
for i in $(seq 1 30); do
if curl -sf http://127.0.0.1:2379/health | grep -q '"health":"true"'; then
echo "etcd is up"; break
fi
echo "waiting for etcd... ($i)"; sleep 2
done
curl -sf http://127.0.0.1:2379/health
- name: discovery round trip against live etcd
env:
MOON_ETCD_TEST: "1"
MOON_ETCD_HOST: "127.0.0.1"
run: moon test --target native