Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.scratch/
.git/
build/
build-san/
_build/
deps/moxygen/.git/
deps/moxygen/moxygen/
deps/moxygen/standalone/
install/
119 changes: 74 additions & 45 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ name: ci main
#
# Job graph:
#
# format ─────────────────────────────────────────────┐
# build (linux, asan debug) ── publish ── release ────┼── notify
# │ (always)
# check-format ──────────────────────────────────────────────────────────────────┐
# build (linux, asan debug) ── publish (docker+smoke) ── release ────────────────┼── notify

on:
push:
Expand All @@ -27,7 +26,7 @@ jobs:
# Verify: format + build/test matrix
# ════════════════════════════════════════════════════════════════════════════

format:
check-format:
runs-on: ubuntu-latest
container: debian:trixie
steps:
Expand Down Expand Up @@ -95,17 +94,12 @@ jobs:
fail-on-empty: ${{ job.status == 'success' && 'true' || 'false' }}

# ════════════════════════════════════════════════════════════════════════════
# Publish: build o-rly artifacts + Docker image (needs verify to pass)
# Publish: build o-rly, Docker image + smoke test, push
# ════════════════════════════════════════════════════════════════════════════

publish:
needs: [build]
strategy:
fail-fast: false
matrix:
include:
- name: ubuntu-22.04-amd64
name: publish (${{ matrix.name }})
name: publish
runs-on: ubuntu-22.04
steps:
- name: Generate app token
Expand All @@ -119,55 +113,70 @@ jobs:
with:
submodules: true

- name: Install system dependencies
run: bash deps/moxygen/standalone/install-system-deps.sh

- name: Download moxygen artifacts
- name: Download bookworm moxygen tarball
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
ORLY_PLATFORM: bookworm-amd64
run: bash scripts/setup-deps-tarball.sh

- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: publish-${{ matrix.name }}
max-size: 500M

- name: Configure
- name: Stage tarball for Docker build
run: |
cmake -S . -B _build --preset default \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_PREFIX_PATH="$(cat .scratch/cmake_prefix_path.txt)" \
-DBUILD_TESTING=OFF

- name: Build
run: cmake --build _build -j$(getconf _NPROCESSORS_ONLN)

- name: Install
run: cmake --install _build --prefix "$GITHUB_WORKSPACE/install"
mkdir -p .docker-deps
cp -a .scratch/moxygen-install .docker-deps/moxygen

- name: Log in to GHCR
if: runner.os == 'Linux'
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build and push Docker image
if: runner.os == 'Linux'
- name: Build Docker image
run: |
SHORT="${GITHUB_SHA:0:7}"
IMAGE="ghcr.io/${{ github.repository }}"
docker build -f docker/Dockerfile \
-t "${IMAGE}:${SHORT}" \
-t "${IMAGE}:latest" \
.

- name: Smoke test Docker image
run: |
IMAGE="ghcr.io/${{ github.repository }}:latest"
echo "==> ldd check"
docker run --rm --entrypoint ldd "${IMAGE}" /usr/local/bin/o-rly
if docker run --rm --entrypoint ldd "${IMAGE}" /usr/local/bin/o-rly 2>&1 | grep -q "not found"; then
echo "ERROR: missing shared libraries"; exit 1
fi
echo "==> Start container with test config"
docker run -d --name orly-smoke --network host \
-v "$PWD/tests/test.config.yaml:/etc/o-rly/config.yaml:ro" \
"${IMAGE}" --config=/etc/o-rly/config.yaml
echo "==> Wait for admin /info"
for i in $(seq 1 50); do
if curl -sf http://[::1]:9669/info >/dev/null 2>&1; then break; fi
sleep 0.1
if [ "$i" -eq 50 ]; then
echo "ERROR: admin server did not start"; docker logs orly-smoke; exit 1
fi
done
RESP=$(curl -sf http://[::1]:9669/info)
echo "Response: $RESP"
echo "$RESP" | grep -q '"service":"o-rly"' || { echo "FAIL: bad /info response"; exit 1; }
docker stop orly-smoke && docker rm orly-smoke
echo "==> Smoke test passed"

- name: Push Docker image
run: |
SHORT="${GITHUB_SHA:0:7}"
IMAGE="ghcr.io/${{ github.repository }}"
docker push "${IMAGE}:${SHORT}"
docker push "${IMAGE}:latest"

- name: Package
id: package
run: |
ARTIFACT="${{ github.event.repository.name }}-${{ matrix.name }}.tar.gz"
tar czf "$ARTIFACT" -C "$GITHUB_WORKSPACE/install" .
ARTIFACT="o-rly-bookworm-amd64.tar.gz"
docker cp "$(docker create --name extract ghcr.io/${{ github.repository }}:latest):/usr/local/bin/o-rly" .
docker rm extract
mkdir -p install/bin && mv o-rly install/bin/
tar czf "$ARTIFACT" -C install .
echo "artifact=$ARTIFACT" >> "$GITHUB_OUTPUT"

- name: Upload artifact
Expand All @@ -190,6 +199,7 @@ jobs:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: "*.tar.gz"
path: artifacts/

- name: Publish snapshot
Expand Down Expand Up @@ -222,7 +232,7 @@ jobs:
# ════════════════════════════════════════════════════════════════════════════

notify:
needs: [format, build, publish, release]
needs: [check-format, build, publish, release]
if: always()
runs-on: ubuntu-22.04
steps:
Expand All @@ -244,12 +254,21 @@ jobs:
esac
}

FMT=$(fmt_status "${{ needs.format.result }}")
VER=$(fmt_status "${{ needs.build.result }}")
# verify = worst of check-format + build
if [ "${{ needs.check-format.result }}" = "failure" ] || [ "${{ needs.build.result }}" = "failure" ]; then
VER_RESULT="failure"
elif [ "${{ needs.check-format.result }}" = "cancelled" ] || [ "${{ needs.build.result }}" = "cancelled" ]; then
VER_RESULT="cancelled"
elif [ "${{ needs.check-format.result }}" = "success" ] && [ "${{ needs.build.result }}" = "success" ]; then
VER_RESULT="success"
else
VER_RESULT="skipped"
fi
VER=$(fmt_status "$VER_RESULT")
PUB=$(fmt_status "${{ needs.publish.result }}")
REL=$(fmt_status "${{ needs.release.result }}")

STATUS="format:${FMT} verify:${VER} publish:${PUB} release:${REL}"
STATUS="verify:${VER} publish:${PUB} release:${REL}"

if [ "${{ needs.release.result }}" = "success" ]; then
REL_URL="${{ github.server_url }}/${{ github.repository }}/releases/tag/snapshot-latest"
Expand All @@ -272,12 +291,22 @@ jobs:
SHORT="${GITHUB_SHA:0:7}"
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

FMT="${{ needs.format.result }}"
VER="${{ needs.build.result }}"
# verify = worst of check-format + build
CF="${{ needs.check-format.result }}"
BLD="${{ needs.build.result }}"
if [ "$CF" = "failure" ] || [ "$BLD" = "failure" ]; then
VER="failure"
elif [ "$CF" = "cancelled" ] || [ "$BLD" = "cancelled" ]; then
VER="cancelled"
elif [ "$CF" = "success" ] && [ "$BLD" = "success" ]; then
VER="success"
else
VER="skipped"
fi
PUB="${{ needs.publish.result }}"
REL="${{ needs.release.result }}"

STATUS="format:${FMT} verify:${VER} publish:${PUB} release:${REL}"
STATUS="verify:${VER} publish:${PUB} release:${REL}"

if [ "${{ needs.release.result }}" = "success" ]; then
REL_URL="${{ github.server_url }}/${{ github.repository }}/releases/tag/snapshot-latest"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions:
checks: write

jobs:
format:
check-format:
runs-on: ubuntu-latest
container: debian:trixie
steps:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/update-moxygen-submodule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: update moxygen submodule

on:
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
update:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Update moxygen submodule
run: |
cd deps/moxygen
git fetch origin main
git checkout origin/main
cd ../..
echo "MOXYGEN_SHA=$(cd deps/moxygen && git rev-parse --short HEAD)" >> "$GITHUB_ENV"

- name: Create PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH="update-moxygen-${MOXYGEN_SHA}"
git checkout -b "$BRANCH"
git add deps/moxygen
git commit -m "Update moxygen submodule to ${MOXYGEN_SHA}"
git push -u origin "$BRANCH"
gh pr create \
--title "Update moxygen submodule to ${MOXYGEN_SHA}" \
--body "Updates \`deps/moxygen\` to latest main (\`${MOXYGEN_SHA}\`)."
1 change: 0 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"ORLY_ENABLE_SANITIZERS": "ON",
"CMAKE_FIND_LIBRARY_SUFFIXES": ".a",
"CMAKE_MODULE_PATH": "${sourceDir}/cmake",
"CMAKE_POLICY_VERSION_MINIMUM": "3.5"
}
Expand Down
2 changes: 1 addition & 1 deletion deps/moxygen
Submodule moxygen updated 37 files
+15 −68 .github/workflows/omoq-ci-main.yml
+9 −59 .github/workflows/omoq-ci-pr.yml
+1 −1 build/deps/github_hashes/facebook/folly-rev.txt
+1 −1 build/deps/github_hashes/facebook/mvfst-rev.txt
+1 −1 build/deps/github_hashes/facebook/proxygen-rev.txt
+1 −1 build/deps/github_hashes/facebook/wangle-rev.txt
+1 −1 build/deps/github_hashes/facebookincubator/fizz-rev.txt
+1 −0 build/fbcode_builder/manifests/fboss
+2 −2 build/fbcode_builder/manifests/picoquic
+5 −0 cmake/moxygen-config.cmake.in
+76 −60 moxygen/MoQCodec.cpp
+9 −0 moxygen/MoQCodec.h
+6 −0 moxygen/MoQFilters.h
+35 −82 moxygen/MoQFramer.cpp
+21 −0 moxygen/MoQSession.cpp
+1 −0 moxygen/MoQSession.h
+10 −1 moxygen/MoQTypes.cpp
+23 −22 moxygen/MoQTypes.h
+4 −0 moxygen/moqtest/conformance_test.sh
+2 −0 moxygen/relay/CMakeLists.txt
+53 −0 moxygen/relay/MoQForwarder.cpp
+15 −0 moxygen/relay/MoQForwarder.h
+47 −7 moxygen/relay/MoQRelay.cpp
+5 −0 moxygen/relay/MoQRelay.h
+448 −26 moxygen/relay/test/MoQRelayTest.cpp
+5 −1 moxygen/samples/text-client/PyMoQSimplePublisher.cpp
+5 −1 moxygen/samples/text-client/PyMoQTestClient.cpp
+5 −2 moxygen/samples/text-client/moq_client_pybinding.pyi
+5 −2 moxygen/samples/text-client/moq_simple_publisher_pybinding.pyi
+3 −1 moxygen/samples/text-client/py_moq_client_tester.py
+3 −1 moxygen/samples/text-client/test/PyMoQClientTest.py
+72 −3 moxygen/test/MoQSessionPublishTests.cpp
+6 −0 moxygen/test/MoQSessionTestCommon.cpp
+2 −0 moxygen/test/MoQSessionTestCommon.h
+6 −0 moxygen/test/MockMoQSession.h
+5 −1 moxygen/util/InsecureVerifierDangerousDoNotUseInProduction.h
+34 −19 standalone/CMakeLists.txt
Loading
Loading