Skip to content

refactor(moonzero): catch up to moonrpc, and read the gRPC framing th… #51

refactor(moonzero): catch up to moonrpc, and read the gRPC framing th…

refactor(moonzero): catch up to moonrpc, and read the gRPC framing th… #51

Workflow file for this run

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