|
| 1 | +name: DuckDB R2 mirror |
| 2 | + |
| 3 | +# If we have an archive for a commit or a tag in R2, return it. |
| 4 | +# Otherwise, if it's a tag, download release archive from Duckdb Github |
| 5 | +# page and upload it to R2. |
| 6 | +# If it's a commit, build Duckdb from source and upload it to R2. |
| 7 | +on: |
| 8 | + workflow_call: { } |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: duckdb-r2-${{ github.event.pull_request.number || github.ref }} |
| 12 | + cancel-in-progress: false |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +env: |
| 18 | + PUBLIC_BASE_URL: "https://ci-builds.vortex.dev" |
| 19 | + R2_BUCKET: "duckdb-builds" |
| 20 | + R2_ENDPOINT_URL: "https://52bdeab5651e1584747feefd051fd566.r2.cloudflarestorage.com" |
| 21 | + |
| 22 | +jobs: |
| 23 | + check: |
| 24 | + name: "Resolve DuckDB version and check R2" |
| 25 | + runs-on: ubuntu-latest |
| 26 | + timeout-minutes: 10 |
| 27 | + outputs: |
| 28 | + version: ${{ steps.resolve.outputs.version }} |
| 29 | + ref_dir: ${{ steps.resolve.outputs.ref_dir }} |
| 30 | + release: ${{ steps.resolve.outputs.release }} |
| 31 | + matrix: ${{ steps.resolve.outputs.matrix }} |
| 32 | + any_missing: ${{ steps.resolve.outputs.any_missing }} |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 |
| 35 | + - name: Resolve version and check R2 |
| 36 | + id: resolve |
| 37 | + run: sh scripts/duckdb-r2-resolve.sh |
| 38 | + |
| 39 | + mirror: |
| 40 | + name: "Mirror DuckDB ${{ matrix.archive }} to R2" |
| 41 | + needs: check |
| 42 | + if: >- |
| 43 | + needs.check.outputs.any_missing == 'true' && |
| 44 | + github.repository == 'vortex-data/vortex' && |
| 45 | + github.event.pull_request.head.repo.full_name == github.repository |
| 46 | + environment: duckdb-build |
| 47 | + timeout-minutes: 120 |
| 48 | + strategy: |
| 49 | + fail-fast: false |
| 50 | + matrix: ${{ fromJSON(needs.check.outputs.matrix) }} |
| 51 | + runs-on: ${{ matrix.runner }} |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 |
| 54 | + |
| 55 | + - name: Install build dependencies (Linux) |
| 56 | + if: needs.check.outputs.release != 'true' && runner.os == 'Linux' |
| 57 | + run: | |
| 58 | + sudo apt-get update |
| 59 | + sudo apt-get install -y ninja-build libcurl4-openssl-dev zip unzip |
| 60 | +
|
| 61 | + # MacOS already has ninja and p7zip |
| 62 | + |
| 63 | + - name: Prepare ${{ matrix.archive }} |
| 64 | + env: |
| 65 | + ARCHIVE: ${{ matrix.archive }} |
| 66 | + REF_DIR: ${{ needs.check.outputs.ref_dir }} |
| 67 | + RELEASE: ${{ needs.check.outputs.release }} |
| 68 | + PLATFORM_OS: ${{ matrix.os }} |
| 69 | + run: sh scripts/duckdb-r2-prepare.sh |
| 70 | + |
| 71 | + - name: Upload to R2 |
| 72 | + env: |
| 73 | + AWS_ACCESS_KEY_ID: ${{ secrets.DUCKDB_R2_ACCESS_KEY_ID }} |
| 74 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.DUCKDB_R2_SECRET_ACCESS_KEY }} |
| 75 | + AWS_REGION: "us-east-1" |
| 76 | + AWS_ENDPOINT_URL: ${{ env.R2_ENDPOINT_URL }} |
| 77 | + run: | |
| 78 | + set -Eeuo pipefail |
| 79 | + python3 scripts/s3-upload.py \ |
| 80 | + --bucket "$R2_BUCKET" \ |
| 81 | + --key "${{ needs.check.outputs.ref_dir }}/${{ matrix.archive }}" \ |
| 82 | + --body "${{ matrix.archive }}" \ |
| 83 | + --checksum-algorithm CRC32 |
0 commit comments