-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1175 from alphagov/switch-to-github-actions
CI Approach with GitHub Actions
- Loading branch information
Showing
3 changed files
with
129 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
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 | ||
env: | ||
GOVUK_CONTENT_SCHEMAS_PATH: vendor/publishing-api/content_schemas | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Checkout Publishing API for content schemas | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: alphagov/publishing-api | ||
ref: deployed-to-production | ||
path: vendor/publishing-api | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby }} | ||
bundler-cache: true | ||
- run: bundle exec rake | ||
|
||
# This job is needed to work around the fact that matrix jobs spawn multiple status checks – i.e. one job per variant. | ||
# The branch protection rules depend on this as a composite job to ensure that all preceding test_matrix checks passed. | ||
# Solution taken from: https://github.saobby.my.eu.orgmunity/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 🚀" | ||
|
||
generate_and_publish_pacts: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
env: | ||
PACT_TARGET_BRANCH: branch-${{ github.ref_name }} | ||
PACT_BROKER_BASE_URL: https://pact-broker.cloudapps.digital | ||
PACT_BROKER_USERNAME: ${{ secrets.GOVUK_PACT_BROKER_USERNAME }} | ||
PACT_BROKER_PASSWORD: ${{ secrets.GOVUK_PACT_BROKER_PASSWORD }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
- run: bundle exec rake pact_test | ||
- run: bundle exec rake pact:publish:branch | ||
|
||
account_api_pact: | ||
needs: generate_and_publish_pacts | ||
uses: alphagov/account-api/.github/workflows/pact-verify.yml@main | ||
with: | ||
pact_consumer_version: branch-${{ github.ref_name }} | ||
|
||
asset_manager_pact: | ||
needs: generate_and_publish_pacts | ||
uses: alphagov/asset-manager/.github/workflows/pact-verify.yml@main | ||
with: | ||
pact_consumer_version: branch-${{ github.ref_name }} | ||
|
||
collections_pact: | ||
needs: generate_and_publish_pacts | ||
uses: alphagov/collections/.github/workflows/pact-verify.yml@main | ||
with: | ||
pact_consumer_version: branch-${{ github.ref_name }} | ||
|
||
email_alert_api_pact: | ||
needs: generate_and_publish_pacts | ||
uses: alphagov/email-alert-api/.github/workflows/pact-verify.yml@main | ||
with: | ||
pact_consumer_version: branch-${{ github.ref_name }} | ||
|
||
imminence_pact: | ||
needs: generate_and_publish_pacts | ||
uses: alphagov/imminence/.github/workflows/pact-verify.yml@main | ||
with: | ||
pact_consumer_version: branch-${{ github.ref_name }} | ||
|
||
link_checker_api_pact: | ||
needs: generate_and_publish_pacts | ||
uses: alphagov/link-checker-api/.github/workflows/pact-verify.yml@main | ||
with: | ||
pact_consumer_version: branch-${{ github.ref_name }} | ||
|
||
locations_api_pact: | ||
needs: generate_and_publish_pacts | ||
uses: alphagov/locations-api/.github/workflows/pact-verify.yml@main | ||
with: | ||
pact_consumer_version: branch-${{ github.ref_name }} | ||
|
||
publishing_api_pact: | ||
needs: generate_and_publish_pacts | ||
uses: alphagov/publishing-api/.github/workflows/pact-verify.yml@main | ||
with: | ||
pact_consumer_version: branch-${{ github.ref_name }} | ||
|
||
whitehall_pact: | ||
needs: generate_and_publish_pacts | ||
uses: alphagov/whitehall/.github/workflows/pact-verify.yml@main | ||
with: | ||
pact_consumer_version: branch-${{ github.ref_name }} | ||
|
||
publish_gem: | ||
needs: | ||
- account_api_pact | ||
- asset_manager_pact | ||
- collections_pact | ||
- email_alert_api_pact | ||
- imminence_pact | ||
- link_checker_api_pact | ||
- locations_api_pact | ||
- publishing_api_pact | ||
- whitehall_pact | ||
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 }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters