runcom_rmq: Ed25519 signing + replay protection for server→agent transport #19
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 | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| MIX_ENV: test | |
| # Build sibling packages against the local `runcom/` via path deps | |
| # (see runcom_ecto/mix.exs, runcom_rmq/mix.exs, runcom_web/mix.exs). | |
| RUNCOM_ROOT: ${{ github.workspace }} | |
| jobs: | |
| format: | |
| name: Format ${{ matrix.package }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package: [runcom, runcom_ecto, runcom_rmq, runcom_web, runcom_demo] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: "1.20" | |
| otp-version: "29" | |
| - name: Cache deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ matrix.package }}/deps | |
| ${{ matrix.package }}/_build | |
| key: ${{ runner.os }}-mix-${{ matrix.package }}-${{ hashFiles(format('{0}/mix.lock', matrix.package)) }} | |
| restore-keys: | | |
| ${{ runner.os }}-mix-${{ matrix.package }}- | |
| # `.formatter.exs` imports from deps (e.g. :bash, :ecto, :phoenix, | |
| # :phoenix_live_view) and uses the Bash.Formatter plugin — all need to | |
| # be fetched and compiled before `mix format` can load them. | |
| - name: Install deps | |
| working-directory: ${{ matrix.package }} | |
| run: mix deps.get | |
| - name: Compile deps | |
| working-directory: ${{ matrix.package }} | |
| run: mix deps.compile | |
| - name: Check formatting | |
| working-directory: ${{ matrix.package }} | |
| run: mix format --check-formatted | |
| test-pure: | |
| name: Test ${{ matrix.package }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package: [runcom, runcom_rmq] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: "1.20" | |
| otp-version: "29" | |
| - name: Cache deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ matrix.package }}/deps | |
| ${{ matrix.package }}/_build | |
| key: ${{ runner.os }}-mix-${{ matrix.package }}-${{ hashFiles(format('{0}/mix.lock', matrix.package)) }} | |
| restore-keys: | | |
| ${{ runner.os }}-mix-${{ matrix.package }}- | |
| - name: Install deps | |
| working-directory: ${{ matrix.package }} | |
| run: mix deps.get | |
| - name: Compile (warnings as errors) | |
| working-directory: ${{ matrix.package }} | |
| run: mix compile --warnings-as-errors | |
| - name: Check for compile-time dependency cycles | |
| working-directory: ${{ matrix.package }} | |
| run: mix xref graph --format cycles --label compile-connected --fail-above 0 | |
| - name: Run tests | |
| working-directory: ${{ matrix.package }} | |
| run: mix test | |
| e2e: | |
| name: E2E (runcom_demo) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: "1.20" | |
| otp-version: "29" | |
| - name: Cache deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| runcom_demo/deps | |
| runcom_demo/_build | |
| key: ${{ runner.os }}-mix-runcom_demo-${{ hashFiles('runcom_demo/mix.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-mix-runcom_demo- | |
| - name: Install deps | |
| working-directory: runcom_demo | |
| run: mix deps.get | |
| # Bring up all long-running services and wait for healthchecks. | |
| # `minio-init` is excluded here because it's a one-shot that exits 0 — | |
| # `docker compose --wait` treats that as failure, even on success. | |
| - name: Start docker compose stack | |
| run: | | |
| docker compose up -d --build --wait \ | |
| postgres rabbitmq minio \ | |
| agent-nyc-001 agent-nyc-002 \ | |
| agent-lax-001 agent-lax-002 \ | |
| agent-ams-001 | |
| # Run the MinIO bucket bootstrap; attaches and exits with its status. | |
| - name: Run minio bucket init | |
| run: docker compose up --build minio-init | |
| - name: Show service status | |
| if: always() | |
| run: docker compose ps | |
| - name: Run E2E tests | |
| working-directory: runcom_demo | |
| run: mix test --only integration | |
| - name: Show service status on failure | |
| if: failure() | |
| run: docker compose ps --all | |
| - name: Dump service logs on failure | |
| if: failure() | |
| run: docker compose logs --no-color --timestamps | |
| - name: Stop docker compose stack | |
| if: always() | |
| run: docker compose down -v | |
| test-postgres: | |
| name: Test ${{ matrix.package }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package: [runcom_ecto, runcom_web] | |
| services: | |
| postgres: | |
| image: postgres:17-alpine | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: postgres | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd="pg_isready -U postgres" | |
| --health-interval=5s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: "1.20" | |
| otp-version: "29" | |
| - name: Cache deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ matrix.package }}/deps | |
| ${{ matrix.package }}/_build | |
| key: ${{ runner.os }}-mix-${{ matrix.package }}-${{ hashFiles(format('{0}/mix.lock', matrix.package)) }} | |
| restore-keys: | | |
| ${{ runner.os }}-mix-${{ matrix.package }}- | |
| - name: Install deps | |
| working-directory: ${{ matrix.package }} | |
| run: mix deps.get | |
| - name: Compile (warnings as errors) | |
| working-directory: ${{ matrix.package }} | |
| run: mix compile --warnings-as-errors | |
| - name: Check for compile-time dependency cycles | |
| working-directory: ${{ matrix.package }} | |
| run: mix xref graph --format cycles --label compile-connected --fail-above 0 | |
| - name: Run tests | |
| working-directory: ${{ matrix.package }} | |
| run: mix test |