From a4a1ebbd08eccfd392e6aa4539832b594a9012f7 Mon Sep 17 00:00:00 2001 From: meyric Date: Fri, 5 Apr 2024 15:26:30 +0100 Subject: [PATCH] Update integration GitHub Action We added the new sending integration tests so we want to runs those. Because we know the previewing and the sending are the two main features, we want them to show up in GitHub separately so we break the build and test jobs up passing the built image between via uploading as an artifact. There is nothing secret in the built image as we only have on secret and that is passed into the running container not the image. Until v2 is released, we expect the preview tests to FAIL but the sending should work as this reflects the current state of the gem. --- .github/workflows/rails-integration-tests.yml | 160 ++++++++++++++++-- 1 file changed, 147 insertions(+), 13 deletions(-) diff --git a/.github/workflows/rails-integration-tests.yml b/.github/workflows/rails-integration-tests.yml index b7d3629..d2a67be 100644 --- a/.github/workflows/rails-integration-tests.yml +++ b/.github/workflows/rails-integration-tests.yml @@ -1,4 +1,4 @@ -name: Integration tests +name: Rails integration tests on: pull_request: @@ -7,8 +7,8 @@ on: - v2 jobs: - rails-5: - name: Rails 5 mailer previews + build-rails-5: + name: Build Rails 5 runs-on: ubuntu-latest steps: - @@ -27,17 +27,63 @@ jobs: RAILS_VERSION=5.2.8.1 MAIL_NOTIFY_BRANCH=${{ github.ref }} push: false - load: true tags: mail-notify-integration-rails-5:latest + outputs: type=docker, dest=/tmp/rails-5-image.tar cache-from: type=gha cache-to: type=gha,mode=min + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: rails-5-image + path: /tmp/rails-5-image.tar + + rails-5-previews: + name: Rails 5 mailer previews + runs-on: ubuntu-latest + needs: build-rails-5 + steps: + - + name: Download image + uses: actions/download-artifact@v4 + with: + name: rails-5-image + path: /tmp + - + name: Load image + run: docker load --input /tmp/rails-5-image.tar - name: Run integration tests env: NOTIFY_API_KEY: ${{ secrets.NOTIFY_API_KEY }} - run: docker run --rm -e "NOTIFY_API_KEY=$NOTIFY_API_KEY" mail-notify-integration-rails-5:latest - rails-6: - name: Rails 6 mailer previews + run: | + docker run --rm -e "NOTIFY_API_KEY=$NOTIFY_API_KEY" \ + mail-notify-integration-rails-5:latest bin/rails test:system + + + rails-5-sending: + name: Rails 5 sending + runs-on: ubuntu-latest + needs: build-rails-5 + steps: + - + name: Download image + uses: actions/download-artifact@v4 + with: + name: rails-5-image + path: /tmp + - + name: Load image + run: docker load --input /tmp/rails-5-image.tar + - + name: Run integration tests + env: + NOTIFY_API_KEY: ${{ secrets.NOTIFY_API_KEY }} + run: | + docker run --rm -e "NOTIFY_API_KEY=$NOTIFY_API_KEY" \ + mail-notify-integration-rails-5:latest bin/rails test + + build-rails-6: + name: Build Rails 6 runs-on: ubuntu-latest steps: - @@ -56,18 +102,62 @@ jobs: RAILS_VERSION=6.1.7.6 MAIL_NOTIFY_BRANCH=${{ github.ref }} push: false - load: true tags: mail-notify-integration-rails-6:latest + outputs: type=docker, dest=/tmp/rails-6-image.tar cache-from: type=gha cache-to: type=gha,mode=min + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: rails-6-image + path: /tmp/rails-6-image.tar + + rails-6-previews: + name: Rails 6 mailer previews + runs-on: ubuntu-latest + needs: build-rails-6 + steps: + - + name: Download image + uses: actions/download-artifact@v4 + with: + name: rails-6-image + path: /tmp + - + name: Load image + run: docker load --input /tmp/rails-6-image.tar - name: Run integration tests env: NOTIFY_API_KEY: ${{ secrets.NOTIFY_API_KEY }} - run: docker run --rm -e "NOTIFY_API_KEY=$NOTIFY_API_KEY" mail-notify-integration-rails-6:latest + run: | + docker run --rm -e "NOTIFY_API_KEY=$NOTIFY_API_KEY" \ + mail-notify-integration-rails-6:latest bin/rails test:system - rails-7: - name: Rails 7 mailer previews + rails-6-sending: + name: Rails 6 sending + runs-on: ubuntu-latest + needs: build-rails-6 + steps: + - + name: Download image + uses: actions/download-artifact@v4 + with: + name: rails-6-image + path: /tmp + - + name: Load image + run: docker load --input /tmp/rails-6-image.tar + - + name: Run integration tests + env: + NOTIFY_API_KEY: ${{ secrets.NOTIFY_API_KEY }} + run: | + docker run --rm -e "NOTIFY_API_KEY=$NOTIFY_API_KEY" \ + mail-notify-integration-rails-6:latest bin/rails test + + build-rails-7: + name: Build Rails 7 runs-on: ubuntu-latest steps: - @@ -86,12 +176,56 @@ jobs: RAILS_VERSION=7.1.3.2 MAIL_NOTIFY_BRANCH=${{ github.ref }} push: false - load: true tags: mail-notify-integration-rails-7:latest + outputs: type=docker, dest=/tmp/rails-7-image.tar cache-from: type=gha cache-to: type=gha,mode=min + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: rails-7-image + path: /tmp/rails-7-image.tar + + rails-7-previews: + name: Rails 7 mailer previews + runs-on: ubuntu-latest + needs: build-rails-7 + steps: + - + name: Download image + uses: actions/download-artifact@v4 + with: + name: rails-7-image + path: /tmp + - + name: Load image + run: docker load --input /tmp/rails-7-image.tar + - + name: Run integration tests + env: + NOTIFY_API_KEY: ${{ secrets.NOTIFY_API_KEY }} + run: | + docker run --rm -e "NOTIFY_API_KEY=$NOTIFY_API_KEY" \ + mail-notify-integration-rails-7:latest bin/rails test:system + + rails-7-sending: + name: Rails 7 sending + runs-on: ubuntu-latest + needs: build-rails-7 + steps: + - + name: Download image + uses: actions/download-artifact@v4 + with: + name: rails-7-image + path: /tmp + - + name: Load image + run: docker load --input /tmp/rails-7-image.tar - name: Run integration tests env: NOTIFY_API_KEY: ${{ secrets.NOTIFY_API_KEY }} - run: docker run --rm -e "NOTIFY_API_KEY=$NOTIFY_API_KEY" mail-notify-integration-rails-7:latest + run: | + docker run --rm -e "NOTIFY_API_KEY=$NOTIFY_API_KEY" \ + mail-notify-integration-rails-7:latest bin/rails test