Fix Docker runtime link failures, add smoke test #13
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci pr | |
| # PR verification: format + build/test matrix. | |
| # Main push uses ci-main.yml which adds publish/release/notify. | |
| on: | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| checks: write | |
| jobs: | |
| check-format: | |
| runs-on: ubuntu-latest | |
| container: debian:trixie | |
| steps: | |
| - name: Install tools | |
| run: apt-get update && apt-get install -y --no-install-recommends ca-certificates git clang-format | |
| - uses: actions/checkout@v4 | |
| - name: Check formatting | |
| run: bash scripts/format.sh --check | |
| # TEMPORARY: test Docker multi-stage build in PR CI (remove after validation) | |
| docker-test: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Generate app token | |
| id: app-token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ secrets.OMOQ_APP_ID }} | |
| private-key: ${{ secrets.OMOQ_APP_PRIV_KEY }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - 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: Stage tarball for Docker build | |
| run: | | |
| mkdir -p .docker-deps | |
| cp -a .scratch/moxygen-install .docker-deps/moxygen | |
| - name: Build Docker image | |
| run: docker build -f docker/Dockerfile -t orly-test . | |
| - name: Smoke test | |
| run: | | |
| echo "==> ldd check" | |
| docker run --rm --entrypoint ldd orly-test /usr/local/bin/o-rly | |
| if docker run --rm --entrypoint ldd orly-test /usr/local/bin/o-rly 2>&1 | grep -q "not found"; then | |
| echo "ERROR: missing shared libraries"; exit 1 | |
| fi | |
| echo "==> Start container" | |
| docker run -d --name orly-smoke --network host \ | |
| -v "$PWD/tests/test.config.yaml:/etc/o-rly/config.yaml:ro" \ | |
| orly-test --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" | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: linux | |
| preset: default | |
| build_dir: build | |
| runner: ubuntu-22.04 | |
| - name: asan debug | |
| preset: san | |
| build_dir: build-san | |
| runner: ubuntu-22.04 | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Generate app token | |
| id: app-token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ secrets.OMOQ_APP_ID }} | |
| private-key: ${{ secrets.OMOQ_APP_PRIV_KEY }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Install system dependencies | |
| run: bash deps/moxygen/standalone/install-system-deps.sh | |
| - name: Download moxygen artifacts | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: bash scripts/setup-deps-tarball.sh | |
| - name: Configure | |
| run: bash scripts/configure.sh ${{ matrix.build_dir }} ${{ matrix.preset }} | |
| - name: Build | |
| run: cmake --build ${{ matrix.build_dir }} -j$(getconf _NPROCESSORS_ONLN) | |
| - name: Test | |
| env: | |
| ASAN_OPTIONS: ${{ matrix.name == 'asan debug' && 'detect_leaks=1:abort_on_error=1' || '' }} | |
| run: ctest --test-dir ${{ matrix.build_dir }} --output-on-failure --output-junit test-results.xml | |
| - name: Publish test results | |
| uses: dorny/test-reporter@v1.9.1 | |
| if: success() || failure() | |
| with: | |
| name: "test (${{ matrix.name }})" | |
| path: ${{ matrix.build_dir }}/test-results.xml | |
| reporter: java-junit | |
| fail-on-empty: ${{ job.status == 'success' && 'true' || 'false' }} |