Skip to content

Commit

Permalink
matrix strategy based premerge tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorBenson committed Sep 3, 2023
1 parent 5844551 commit b71eaa3
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/premerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Pre-merge

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/debian-guild-deploy.sh-l.containerfile

jobs:
guild-deploy-and-build:
runs-on: ubuntu-latest
strategy:
matrix:
distro: [rockylinux, ubuntu]
env:
REGISTRY: ghcr.io
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/${{ 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-${{ 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-${{ 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/${{ 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-${{ 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 "* 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: ${{ env.G_ACCOUNT }}" >> $GITHUB_STEP_SUMMARY
echo "* COMMIT: ${{ env.COMMIT }}" >> $GITHUB_STEP_SUMMARY

0 comments on commit b71eaa3

Please sign in to comment.