From 79282b903558ec815e74ffbe16542c73ba5773b8 Mon Sep 17 00:00:00 2001 From: illuminatus Date: Sat, 2 Sep 2023 18:47:07 -0700 Subject: [PATCH] Matrix strategy based pre-merge testing. (#1680) * Remove individual premerge tests * matrix strategy based premerge tests --- .../{premerge_debian.yml => premerge.yml} | 29 +++++--- .github/workflows/premerge_rockylinux.yml | 74 ------------------- .github/workflows/premerge_ubuntu.yml | 67 ----------------- 3 files changed, 18 insertions(+), 152 deletions(-) rename .github/workflows/{premerge_debian.yml => premerge.yml} (69%) delete mode 100644 .github/workflows/premerge_rockylinux.yml delete mode 100644 .github/workflows/premerge_ubuntu.yml diff --git a/.github/workflows/premerge_debian.yml b/.github/workflows/premerge.yml similarity index 69% rename from .github/workflows/premerge_debian.yml rename to .github/workflows/premerge.yml index 5230f54bb..f75d13387 100644 --- a/.github/workflows/premerge_debian.yml +++ b/.github/workflows/premerge.yml @@ -1,4 +1,4 @@ -name: Pre-merge Debian +name: Pre-merge on: workflow_dispatch: @@ -9,10 +9,13 @@ on: - files/tests/pre-merge/debian-guild-deploy.sh-l.containerfile jobs: - guild-deploy-and-build-debian: + guild-deploy-and-build: + runs-on: ubuntu-latest + strategy: + matrix: + distro: [rockylinux, ubuntu] env: REGISTRY: ghcr.io - runs-on: ubuntu-latest if: github.event.pull_request.draft == false steps: - name: Provide additional free space @@ -45,30 +48,34 @@ jobs: - name: Testing guild-deploy.sh (IO fork of libsodium) run: | docker build . \ - --file files/tests/pre-merge/debian-guild-deploy.sh-l.containerfile \ + --file files/tests/pre-merge/${{ matrix.distro }}-guild-deploy.sh-l.containerfile \ --compress \ --build-arg BRANCH=${{ env.BRANCH }} \ --build-arg COMMIT=${{ env.COMMIT }} \ --build-arg G_ACCOUNT=${{ env.G_ACCOUNT }} \ - --tag ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-debian:guild-deploy-l_${{ env.COMMIT }} - - name: Push pre-merge-debian:guild-deploy-l_${{ env.COMMIT }} + --tag ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:guild-deploy-l_${{ env.COMMIT }} + - name: Push pre-merge-${{ matrix.distro }}:guild-deploy-l_${{ env.COMMIT }} run: | - docker push ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-debian:guild-deploy-l_${{ env.COMMIT }} + docker push ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:guild-deploy-l_${{ env.COMMIT }} - name: Testing cabal-build-all.sh (IO fork of libsodium) run: | echo "Working from PR Branch ${{ env.G_ACCOUNT }}/guild-operators/${{ env.BRANCH }} on Commit ${{ env.COMMIT }}" docker build . \ - --file files/tests/pre-merge/debian-cabal-l.containerfile \ + --file files/tests/pre-merge/${{ matrix.distro }}-cabal-l.containerfile \ --compress \ --build-arg BRANCH=${{ env.BRANCH }} \ --build-arg COMMIT=${{ env.COMMIT }} \ --build-arg G_ACCOUNT=${{ env.G_ACCOUNT }} \ - --tag ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-debian:cabal-l_${{ env.COMMIT }} + --tag ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT }} + - name: Push pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT }} + run: | + docker push ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT }} - name: Add summary details if: always() run: | echo "## Summary Details" >> $GITHUB_STEP_SUMMARY - echo "* Docker Image: ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:$${{ env.COMMIT }}" >> $GITHUB_STEP_SUMMARY + echo "* Pre-Merge Guild Deploy Image: ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:guild-deploy-l_${{ env.COMMIT }}" >> $GITHUB_STEP_SUMMARY + echo "* Pre-Merge Cabal Build Image: ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT }}" >> $GITHUB_STEP_SUMMARY echo "* BRANCH: ${{ env.BRANCH }}" >> $GITHUB_STEP_SUMMARY - echo "* G_ACCOUNT: ${GITHUB_REPOSITORY_OWNER}" >> $GITHUB_STEP_SUMMARY + echo "* G_ACCOUNT: ${{ env.G_ACCOUNT }}" >> $GITHUB_STEP_SUMMARY echo "* COMMIT: ${{ env.COMMIT }}" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/premerge_rockylinux.yml b/.github/workflows/premerge_rockylinux.yml deleted file mode 100644 index a528f772a..000000000 --- a/.github/workflows/premerge_rockylinux.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Pre-merge RockyLinux - -on: - workflow_dispatch: - pull_request: - paths: - - scripts/cnode-helper-scripts/guild-deploy.sh - - scripts/cnode-helper-scripts/cabal-build-all.sh - - files/tests/pre-merge/rockylinux-guild-deploy.sh-l.containerfile - -jobs: - guild-deploy-and-build-rockylinux: - env: - REGISTRY: ghcr.io - runs-on: ubuntu-latest - if: github.event.pull_request.draft == false - steps: - - name: Provide additional free space - run: | - # Workaround to provide additional free space for builds. - # https://github.com/actions/virtual-environments/issues/2840 - sudo apt-get update -y - sudo apt-get remove -y '^dotnet-.*' - sudo apt-get remove -y 'php.*' - sudo apt-get remove -y azure-cli google-cloud-sdk google-chrome-stable firefox powershell mono-devel - sudo apt-get autoremove -y - sudo apt-get clean - sudo rm -rf "/usr/share/dotnet" - sudo rm -rf "/usr/local/lib/android" - sudo rm -rf "/opt/ghc" - sudo rm -rf "/usr/local/share/boost" - sudo rm -rf "$AGENT_TOOLSDIRECTORY" - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/checkout@v3 - - name: Define BRANCH, COMMIT and G_ACCOUNT in environment - run: | - echo "BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV - echo "G_ACCOUNT=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV - echo "COMMIT=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV - - name: Testing guild-deploy.sh (IO fork of libsodium) - run: | - docker build . \ - --file files/tests/pre-merge/rockylinux-guild-deploy.sh-l.containerfile \ - --compress \ - --build-arg BRANCH=${{ env.BRANCH }} \ - --build-arg COMMIT=${{ env.COMMIT }} \ - --build-arg G_ACCOUNT=${{ env.G_ACCOUNT }} \ - --tag ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-rockylinux:guild-deploy-l_${{ env.COMMIT }} - - name: Push pre-merge-rockylinux:guild-deploy-l_${{ env.COMMIT }} - run: | - docker push ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-rockylinux:guild-deploy-l_${{ env.COMMIT }} - - name: Testing cabal-build-all.sh (IO fork of libsodium) - run: | - echo "Working from PR Branch ${{ env.G_ACCOUNT }}/guild-operators/${{ env.BRANCH }} on Commit ${{ env.COMMIT }}" - docker build . \ - --file files/tests/pre-merge/rockylinux-cabal-l.containerfile \ - --compress \ - --build-arg BRANCH=${{ env.BRANCH }} \ - --build-arg COMMIT=${{ env.COMMIT }} \ - --build-arg G_ACCOUNT=${{ env.G_ACCOUNT }} \ - --tag ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-rockylinux:cabal-l_${{ env.COMMIT }} - - name: Add summary details - if: always() - run: | - echo "## Summary Details" >> $GITHUB_STEP_SUMMARY - echo "* Docker Image: ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:$CNVERSION" >> $GITHUB_STEP_SUMMARY - echo "* BRANCH: ${{ env.BRANCH }}" >> $GITHUB_STEP_SUMMARY - echo "* G_ACCOUNT: ${GITHUB_REPOSITORY_OWNER}" >> $GITHUB_STEP_SUMMARY - echo "* COMMIT: ${{ env.COMMIT }}" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/premerge_ubuntu.yml b/.github/workflows/premerge_ubuntu.yml deleted file mode 100644 index e48a762ad..000000000 --- a/.github/workflows/premerge_ubuntu.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Pre-merge Ubuntu - -on: - workflow_dispatch: - pull_request: - paths: - - scripts/cnode-helper-scripts/guild-deploy.sh - - scripts/cnode-helper-scripts/cabal-build-all.sh - - files/tests/pre-merge/ubuntu-guild-deploy.sh-l.containerfile - -jobs: - guild-deploy-and-build-ubuntu: - env: - REGISTRY: ghcr.io - runs-on: ubuntu-latest - if: github.event.pull_request.draft == false - steps: - - name: Provide additional free space - run: | - # Workaround to provide additional free space for builds. - # https://github.com/actions/virtual-environments/issues/2840 - sudo apt-get update -y - sudo apt-get remove -y '^dotnet-.*' - sudo apt-get remove -y 'php.*' - sudo apt-get remove -y azure-cli google-cloud-sdk google-chrome-stable firefox powershell mono-devel - sudo apt-get autoremove -y - sudo apt-get clean - sudo rm -rf "/usr/share/dotnet" - sudo rm -rf "/usr/local/lib/android" - sudo rm -rf "/opt/ghc" - sudo rm -rf "/usr/local/share/boost" - sudo rm -rf "$AGENT_TOOLSDIRECTORY" - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/checkout@v3 - - name: Define BRANCH, COMMIT and G_ACCOUNT in environment - run: | - echo "BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV - echo "G_ACCOUNT=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV - echo "COMMIT=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV - - name: Testing guild-deploy.sh (IO fork of libsodium) - run: | - docker build . \ - --file files/tests/pre-merge/ubuntu-guild-deploy.sh-l.containerfile \ - --compress \ - --build-arg BRANCH=${{ env.BRANCH }} \ - --build-arg COMMIT=${{ env.COMMIT }} \ - --build-arg G_ACCOUNT=${{ env.G_ACCOUNT }} \ - --tag ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-ubuntu:guild-deploy-l_${{ env.COMMIT }} - - name: Push pre-merge-ubuntu:guild-deploy-l_${{ env.COMMIT }} - run: | - export COMMIT=$(git rev-parse --short "$GITHUB_SHA") - docker push ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-ubuntu:guild-deploy-l_${{ env.COMMIT }} - - name: Testing cabal-build-all.sh (IO fork of libsodium) - run: | - echo "Working from PR Branch ${{ env.G_ACCOUNT }}/guild-operators/${{ env.BRANCH }} on Commit ${{ env.COMMIT }}" - docker build . \ - --file files/tests/pre-merge/ubuntu-cabal-l.containerfile \ - --compress \ - --build-arg BRANCH=${{ env.BRANCH }} \ - --build-arg COMMIT=${{ env.COMMIT }} \ - --build-arg G_ACCOUNT=${{ env.G_ACCOUNT }} \ - --tag ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-ubuntu:cabal-l_${{ env.COMMIT }}