From 9102b544cdab485d48bc77bdf289e48a866d9368 Mon Sep 17 00:00:00 2001 From: Hongli Lai Date: Sun, 13 Oct 2024 08:44:58 +0000 Subject: [PATCH] Cache RPM packaging CI --- .github/workflows/rpm.yml | 66 ++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rpm.yml b/.github/workflows/rpm.yml index 8ea6cc27d3..aac0f59c2d 100644 --- a/.github/workflows/rpm.yml +++ b/.github/workflows/rpm.yml @@ -35,20 +35,70 @@ jobs: docker_arch: arm64 runner: passenger-ubuntu-24.04-arm64-4cpu runs-on: ${{ matrix.arch.runner }} - env: - WORKSPACE: ${{ github.workspace }} - RPM_ARCH: ${{ matrix.arch.rpm_arch }} - DOCKER_ARCH: ${{ matrix.arch.docker_arch }} - CACHE_DIR: ${{ github.workspace }}/cache/rpm-test/${{ matrix.distro }}-${{ matrix.arch.rpm_arch }} - DISTRIBUTION: ${{ matrix.distro }} steps: - uses: actions/checkout@v4 with: submodules: true - - run: ./dev/ci/tests/rpm/run + - run: mkdir work cache output + working-directory: packaging/rpm + + - name: Determine test distribution name + id: determine_test_distro + run: | + source packaging/rpm/internal/lib/distro_info.sh + TEST_DISTRO_NAME=$(el_name_to_distro_name "$DISTRIBUTION") + echo "name=$TEST_DISTRO_NAME" >> "$GITHUB_OUTPUT" + env: + DISTRIBUTION: ${{ matrix.distro }} + + - name: Fetch cache + run: ./dev/ci/fetch-cache-az-blob-storage + env: + AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_CI_STORAGE_CONNECTION_STRING }} + CONTAINER_NAME: ${{ vars.SCCACHE_AZURE_BLOB_CONTAINER }} + BLOB_NAME: "binaries/rpm-cache-${{ matrix.distro }}-${{ matrix.arch.rpm_arch }}.tar.zstd" + CACHE_PATH: packaging/rpm/cache + SUDO: true + + - name: Build + run: ./build -w work -c cache -o output -p "$WORKSPACE" -d "$DISTRIBUTION" -a "$RPM_ARCH" -A "$DOCKER_ARCH" -R rpm:all + env: + WORKSPACE: ${{ github.workspace }} + DISTRIBUTION: ${{ matrix.distro }} + RPM_ARCH: ${{ matrix.arch.rpm_arch }} + DOCKER_ARCH: ${{ matrix.arch.docker_arch }} + working-directory: packaging/rpm + + - name: Test + run: > + ./test + -p "$WORKSPACE" + -d "output/$DISTRIBUTION" + -c cache + -x "$TEST_DISTRO_NAME" + -a "$RPM_ARCH" + -A "$DOCKER_ARCH" + -j + env: + WORKSPACE: ${{ github.workspace }} + DISTRIBUTION: ${{ matrix.distro }} + TEST_DISTRO_NAME: ${{ steps.determine_test_distro.outputs.name }} + RPM_ARCH: ${{ matrix.arch.rpm_arch }} + DOCKER_ARCH: ${{ matrix.arch.docker_arch }} + working-directory: packaging/rpm + + - name: Update cache + run: ./dev/ci/update-cache-az-blob-storage + env: + AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_CI_STORAGE_CONNECTION_STRING }} + CONTAINER_NAME: ${{ vars.SCCACHE_AZURE_BLOB_CONTAINER }} + BLOB_NAME: "binaries/rpm-cache-${{ matrix.distro }}-${{ matrix.arch.rpm_arch }}.tar.zstd" + CACHE_PATH: packaging/rpm/cache + SUDO: true + if: always() - uses: actions/upload-artifact@v4 with: name: rpm-${{ matrix.distro }}-${{ matrix.arch.rpm_arch }} - path: 'output/${{ matrix.distro }}/*' + path: 'packaging/rpm/output/${{ matrix.distro }}/*'