name: Self-host R2 shim # The S3-backed BLOBS Worker for self-hosted workerd (selfhost/r2-shim). Capgo Cloud never runs # it, so this workflow is separate from build_and_deploy.yml and can never block a deploy. The # conformance job runs the pinned workerd's bundled r2.js over the shim against each S3 server # the self-host stack could ship, and checks every R2 call Capgo uses from the S3 side. on: pull_request: paths: - .github/workflows/selfhost_r2_shim.yml - selfhost/r2-shim/** # The shim's dependencies (aws4fetch, vitest, the S3 client) and toolchain. - package.json - bun.lock - scripts/setup-bun.sh concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: {} jobs: unit: name: r2-shim typecheck and unit tests runs-on: ubuntu-latest timeout-minutes: 10 permissions: contents: read steps: - name: Setup Node.js uses: actions/setup-node@v6 with: node-version: 24.x - name: Checkout repository uses: actions/checkout@v6 - name: Setup bun run: bash scripts/setup-bun.sh - name: Install dependencies run: bun install - name: Typecheck run: bun run r2-shim:typecheck - name: Unit tests run: bun run r2-shim:test conformance: name: r2-shim conformance (${{ matrix.candidate }}) runs-on: ubuntu-latest timeout-minutes: 15 permissions: contents: read strategy: fail-fast: false matrix: include: - candidate: rustfs conditional_put: '1' - candidate: seaweedfs conditional_put: '1' - candidate: minio conditional_put: '1' # Garage ignores If-Match / If-None-Match on PUT: R2 compare-and-swap is not fenced there. - candidate: garage conditional_put: '0' steps: - name: Setup Node.js uses: actions/setup-node@v6 with: node-version: 24.x - name: Checkout repository uses: actions/checkout@v6 - name: Setup bun run: bash scripts/setup-bun.sh - name: Install dependencies run: bun install - name: Start ${{ matrix.candidate }} env: CANDIDATE: ${{ matrix.candidate }} run: | selfhost/r2-shim/test/conformance/s3-server.sh start "$CANDIDATE" > s3.env while IFS= read -r line; do case "$line" in S3_SECRET_ACCESS_KEY=*) echo "::add-mask::${line#*=}" ;; esac done < s3.env cat s3.env >> "$GITHUB_ENV" rm s3.env - name: Conformance suite env: R2_SHIM_CONFORMANCE: '1' S3_CONDITIONAL_PUT: ${{ matrix.conditional_put }} run: bun run r2-shim:test -- test/conformance - name: S3 server log if: failure() run: docker logs r2-shim-s3 2>&1 | tail -100 - name: Stop ${{ matrix.candidate }} if: always() run: selfhost/r2-shim/test/conformance/s3-server.sh stop