From 212571d51b9908fd65a3df60e082c04531513e32 Mon Sep 17 00:00:00 2001 From: Callum Morris Date: Wed, 4 Jun 2025 10:56:18 +1200 Subject: [PATCH 1/3] feat: split up workflow into dev and prod Note: no ECR push for kit, this split is simply for having test coverage report upload once when merged (ie prod) --- .github/workflows/build.yml | 8 +++----- .github/workflows/dev.yml | 14 ++++++++++++++ .github/workflows/prod.yml | 9 +++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/dev.yml create mode 100644 .github/workflows/prod.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9363caf..d74205b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,9 +1,7 @@ -name: kit +name: build on: - push: {} - release: - types: [published] - workflow_dispatch: {} + workflow_call: + inputs: {} permissions: packages: write contents: write diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..f90578d --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,14 @@ +name: kit-dev +on: + pull_request: + types: + - opened + - reopened + - synchronize + - ready_for_review + branches: + - main + workflow_dispatch: {} +jobs: + build: + uses: ./.github/workflows/build.yml \ No newline at end of file diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml new file mode 100644 index 0000000..cafd34b --- /dev/null +++ b/.github/workflows/prod.yml @@ -0,0 +1,9 @@ +name: kit-prod +on: + push: + branches: + - main + workflow_dispatch: {} +jobs: + build: + uses: ./.github/workflows/build.yml \ No newline at end of file From 6db30961c4330231bec92bd888fa0e56b2047b97 Mon Sep 17 00:00:00 2001 From: Callum Morris Date: Wed, 4 Jun 2025 11:02:04 +1200 Subject: [PATCH 2/3] feat: add test coverage upload --- .github/workflows/build.yml | 12 +++++++++++- .github/workflows/prod.yml | 5 ++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d74205b..141e084 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,15 @@ name: build on: workflow_call: - inputs: {} + inputs: + test-coverage-upload-role: + description: role to assume to upload test coverage results to S3. + type: string + required: false + test-coverage-upload-bucket: + description: S3 bucket to upload test coverage results to. + type: string + required: false permissions: packages: write contents: write @@ -22,3 +30,5 @@ jobs: sleep 1s done goTestExtraArgs: -p 1 --tags localstack + test-coverage-upload-role: ${{ inputs.test-coverage-upload-role }} + test-coverage-upload-bucket: ${{ inputs.test-coverage-upload-bucket }} diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index cafd34b..4e5e46b 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -6,4 +6,7 @@ on: workflow_dispatch: {} jobs: build: - uses: ./.github/workflows/build.yml \ No newline at end of file + uses: ./.github/workflows/build.yml + with: + test-coverage-upload-role: arn:aws:iam::615890063537:role/tf-dev-github-actions-geonet-s3-coverage-kit + test-coverage-upload-bucket: dev-geonet-webscan \ No newline at end of file From 8ecf7872ac87ae9f6c6f26d4e038ef14e566b770 Mon Sep 17 00:00:00 2001 From: Callum Morris Date: Wed, 4 Jun 2025 11:04:04 +1200 Subject: [PATCH 3/3] fix: add success step to use as a catch-all branch check --- .github/workflows/dev.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index f90578d..2b5dbd2 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -11,4 +11,10 @@ on: workflow_dispatch: {} jobs: build: - uses: ./.github/workflows/build.yml \ No newline at end of file + uses: ./.github/workflows/build.yml + success: + runs-on: ubuntu-latest + if: success() + needs: [build] + steps: + - run: echo "workflow was successful" \ No newline at end of file