Repository navigation
Build deb packages #31
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: Build deb packages | |
| concurrency: | |
| group: build-packages-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - 'main' | |
| - 'release/**' | |
| paths-ignore: | |
| - 'docs/**' | |
| - '.devcontainer/**' | |
| - '*.md' | |
| pull_request: | |
| types: [opened, reopened, synchronize, ready_for_review] | |
| permissions: | |
| packages: write | |
| contents: read | |
| id-token: write | |
| jobs: | |
| # Build DocumentDB packages (per OS, arch, PG version) | |
| build-documentdb: | |
| runs-on: ${{ matrix.runner }} | |
| name: DEB ${{ matrix.os }}-${{ matrix.arch }}-pg${{ matrix.pg_version }} | |
| if: github.event.pull_request.draft == false | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ${{ fromJson( | |
| github.event_name == 'pull_request' && | |
| '{"include":[{"os":"deb12","arch":"amd64","runner":"ubuntu-24.04","pg_version":"17"},{"os":"ubuntu22.04","arch":"arm64","runner":"ubuntu-24.04-arm","pg_version":"18"}]}' || | |
| '{"os":["deb11","deb12","deb13","ubuntu22.04","ubuntu24.04"],"arch":["amd64","arm64"],"include":[{"arch":"amd64","runner":"ubuntu-24.04"},{"arch":"arm64","runner":"ubuntu-24.04-arm"}],"pg_version":["16","17","18"]}' | |
| ) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Extract version | |
| id: version | |
| run: | | |
| VERSION=$(grep -E "^default_version" pg_documentdb_core/documentdb_core.control | sed -E "s/.*'([0-9]+\.[0-9]+-[0-9]+)'.*/\1/" | sed "s/-/./g") | |
| echo "documentdb_version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Build Debian Package | |
| run: | | |
| ./packaging/build_packages.sh --os ${{ matrix.os }} --pg ${{ matrix.pg_version }} --version ${{ steps.version.outputs.documentdb_version }} | |
| - name: Upload Debian Package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: documentdb-${{ steps.version.outputs.documentdb_version }}-${{ matrix.os }}-pg${{ matrix.pg_version }}-${{ matrix.arch }} | |
| path: packaging/*postgresql*.deb | |
| retention-days: 90 | |
| if-no-files-found: error | |
| compression-level: 0 | |
| # Build Gateway package (once per arch - distro and PG agnostic) | |
| build-documentdb-gateway: | |
| runs-on: ${{ matrix.runner }} | |
| name: Gateway ${{ matrix.arch }} | |
| if: github.event.pull_request.draft == false | |
| needs: build-documentdb | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # For PRs: only build amd64 (matches deb12-amd64-pg17 from build-documentdb) | |
| # For full builds: build both architectures | |
| ${{ fromJson( | |
| github.event_name == 'pull_request' && | |
| '{"include":[{"arch":"amd64","runner":"ubuntu-24.04","test_os":"deb12","test_pg":"17"}]}' || | |
| '{"include":[{"arch":"amd64","runner":"ubuntu-24.04","test_os":"deb12","test_pg":"17"},{"arch":"arm64","runner":"ubuntu-24.04-arm","test_os":"deb12","test_pg":"17"}]}' | |
| ) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Extract version | |
| id: version | |
| run: | | |
| GATEWAY_VERSION=$(grep '^version' pg_documentdb_gw/Cargo.toml | head -n1 | sed 's/version *= *"\(.*\)"/\1/') | |
| echo "gateway_version=$GATEWAY_VERSION" >> $GITHUB_OUTPUT | |
| DOCUMENTDB_VERSION=$(grep -E "^default_version" pg_documentdb_core/documentdb_core.control | sed -E "s/.*'([0-9]+\.[0-9]+-[0-9]+)'.*/\1/" | sed "s/-/./g") | |
| echo "documentdb_version=$DOCUMENTDB_VERSION" >> $GITHUB_OUTPUT | |
| - name: Download a DocumentDB package for testing | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: documentdb-${{ steps.version.outputs.documentdb_version }}-${{ matrix.test_os }}-pg${{ matrix.test_pg }}-${{ matrix.arch }} | |
| path: packaging/ | |
| - name: Build Gateway Package | |
| run: | | |
| deb_package=$(ls packaging/ | grep -E "${{ matrix.test_os }}-postgresql-${{ matrix.test_pg }}-documentdb_" | grep -v "dbg" | head -n1) | |
| ./packaging/build_gateway_packages.sh --test-clean-install --documentdb-package "packaging/${deb_package}" | |
| - name: Upload Gateway Package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: documentdb-gateway-${{ steps.version.outputs.gateway_version }}-${{ matrix.arch }} | |
| path: packaging/*gateway*.deb | |
| retention-days: 90 | |
| if-no-files-found: error | |
| compression-level: 0 |