From 094bee379ef488133390dfaf1ec180fb16669f2d Mon Sep 17 00:00:00 2001 From: Becka Lelew Date: Mon, 25 Jul 2022 10:34:18 +0100 Subject: [PATCH] Add github actions ci config and remove jenkinsfile As per RFC-123 we're moving away from Jenkins for testing and publishing our gems via github actions. --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ Jenkinsfile | 7 ------- 2 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 Jenkinsfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..880a5fb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +on: [push, pull_request] + +jobs: + # This matrix job runs the test suite against multiple Ruby versions + test_matrix: + strategy: + fail-fast: false + matrix: + # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0' + ruby: [ 2.7, '3.0', 3.1 ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - run: bundle exec rake + + # Branch protection rules cannot directly depend on status checks from matrix jobs. + # So instead we define `test` as a dummy job which only runs after the preceding `test_matrix` checks have passed. + # Solution inspired by: https://github.community/t/status-check-for-a-matrix-jobs/127354/3 + test: + needs: test_matrix + runs-on: ubuntu-latest + steps: + - run: echo "All matrix tests have passed 🚀" + + publish: + needs: test + if: ${{ github.ref == 'refs/heads/main' }} + permissions: + contents: write + uses: alphagov/govuk-infrastructure/.github/workflows/publish-rubygem.yaml@main + secrets: + GEM_HOST_API_KEY: ${{ secrets.ALPHAGOV_RUBYGEMS_API_KEY }} diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 915390f..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env groovy - -library("govuk") - -node { - govuk.buildProject() -}