From 7cbbdbd7837fc47554468dbc7ce20d3504c43ac3 Mon Sep 17 00:00:00 2001 From: Daniel Morris Date: Sat, 11 Jan 2025 14:45:39 +0000 Subject: [PATCH] chore: Split workflows and simplify testing (#67) The CI workflow has been split into separate CI and PR workflows, and the number of Terraform versions that are tested whenever changes are made to the module has been reduced, Terraform uses semantic versioning so we will only test against the latest major.minor versions. --- .github/workflows/ci.yaml | 32 +++----------------------------- .github/workflows/pr.yaml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/pr.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b19640a..793eab8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,15 +1,6 @@ name: CI on: - pull_request: - branches: - - main - paths-ignore: - - .editorconfig - - .gitignore - - CHANGELOG.md - - LICENSE.md - - README.md push: branches: - main @@ -18,6 +9,7 @@ on: - .gitignore - CHANGELOG.md - LICENSE.md + - Makefile - README.md jobs: @@ -30,35 +22,17 @@ jobs: - name: Setup Terraform uses: hashicorp/setup-terraform@v3 with: - terraform_version: ${{ matrix.terraform_version }} + terraform_version: "1.10" - name: Initialise with no backend run: terraform init -backend=false - name: Check formatting run: terraform fmt -check -recursive - name: Validate the configuration run: terraform validate - strategy: - matrix: - terraform_version: [ "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6" ] - - caller-identity: - if: ${{ github.event_name == 'push' }} - name: Return the IAM user - permissions: - contents: read - id-token: write - runs-on: ubuntu-latest - steps: - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - aws-region: ${{ secrets.AWS_REGION }} - role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github - - run: aws sts get-caller-identity release: name: Release? - needs: [ caller-identity ] + needs: [ verify ] permissions: contents: write pull-requests: write diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..5795ea6 --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,31 @@ +name: PR + +on: + pull_request: + branches: + - main + paths-ignore: + - .editorconfig + - .gitignore + - CHANGELOG.md + - LICENSE.md + - Makefile + - README.md + +jobs: + verify: + name: Verify + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Setup Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: "1.10" + - name: Initialise with no backend + run: terraform init -backend=false + - name: Check formatting + run: terraform fmt -check -recursive + - name: Validate the configuration + run: terraform validate