Skip to content

Commit

Permalink
Refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
carlpartridge committed Feb 6, 2025
1 parent 7d4256f commit e7232a7
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 78 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/build-and-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ permissions:
contents: read

jobs:
quality_checks:
uses: ./.github/workflows/quality-checks.yml
ci_checks:
uses: ./.github/workflows/ci-checks.yml
with:
# release_version: ${{ inputs.release_version }}
release_version: carl/BCDA-8633-build-bcda-on-ami
Expand All @@ -35,7 +35,7 @@ jobs:

post_build:
name: Build and package
needs: [quality_checks, build_and_package]
needs: [ci_checks, build_and_package]
runs-on: self-hosted
steps:
# - name: Clear working dir
Expand Down Expand Up @@ -64,9 +64,14 @@ jobs:
# TODO: Do we need all/any of the following 3 steps (create docker version, upload, clean up)?
- name: Log created docker images as build artifacts
run: |
DATE_TAG = date +"%Y%m%d%H%M"
VERSION_TAG = "build-rls-${DATE_TAG}-${{ github.run_id }}"
DOCKER_ECR = "${{ secrets.ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com"
export DATE_TAG=`date +"%Y%m%d%H%M"`
export VERSION_TAG="build-rls-${DATE_TAG}-${{ github.run_id }}"
export DOCKER_ECR="${{ secrets.ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com"
export SLIM_VERSION=`echo ${{ inputs.release_version }} | sed 's/.*\///'`
echo $DATE_TAG
echo $VERSION_TAG
echo $DOCKER_ECR
echo $SLIM_VERSION
mkdir -p output
docker images --filter=reference='${DOCKER_ECR}/*:${VERSION_TAG}' --format \"{{.Repository}}:{{.Tag}}\" > output/docker-images-created-${VERSION_TAG}.txt
docker images --filter=reference='${DOCKER_ECR}/*:${SLIM_VERSION}' --format \"{{.Repository}}:{{.Tag}}\" >> output/docker-images-created-${VERSION_TAG}.txt
Expand All @@ -77,6 +82,10 @@ jobs:
path: output/*.txt
- name: Cleanup Docker Images
run: |
echo $DATE_TAG
echo $VERSION_TAG
echo $DOCKER_ECR
echo $SLIM_VERSION
docker images -qa --filter=reference='${DOCKER_ECR}/*:${VERSION_TAG}'
docker images -qa --filter=reference='${DOCKER_ECR}/*:${SLIM_VERSION}'
docker rmi \$(docker images --filter=reference='${DOCKER_ECR}/*:${VERSION_TAG}' --format \"{{.Repository}}:{{.Tag}}\")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
name: "SSAS CI Workflow"

on: [push]
on:
push:
workflow_call:
inputs:
release_version:
description: 'Release version (or branch name)'
required: true
type: string
workflow_dispatch:
inputs:
release_version:
description: 'Release version (or branch name)'
required: true
type: string

env:
RELEASE_VERSION: ${{ inputs.release_version || github.sha }}

jobs:
lint:
go_mod_tidy:
name: Modules Lint
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ env.RELEASE_VERSION }}
- name: Tidy modules
run: |
go mod tidy -v
Expand All @@ -19,18 +37,18 @@ jobs:
exit 1
fi
build:
name: "Build and Test"
runs-on: ubuntu-latest
lint_and_test:
name: Lint and Test
runs-on: self-hosted
steps:
- name: "Checkout code"
uses: actions/checkout@v1
uses: actions/checkout@v4
with:
ref: ${{ env.RELEASE_VERSION }}
- name: "Build the stack"
run: |
make docker-bootstrap
run: make docker-bootstrap
- name: "Run all tests"
run: |
make test
run: make test
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
Expand All @@ -39,7 +57,7 @@ jobs:

sonar-quality-gate:
name: Sonarqube Quality Gate
needs: build
needs: lint_and_test
runs-on: self-hosted
steps:
- name: Download code coverage
Expand All @@ -57,7 +75,11 @@ jobs:
- name: Run quality gate scan
uses: sonarsource/sonarqube-scan-action@master
with:
args: -Dsonar.projectKey=bcda-ssas-api
-Dsonar.sources=. -Dsonar.go.coverage.reportPaths=./test_results/latest/testcoverage.out
-Dsonar.coverage.exclusions=**/*test.go,**/test/**/*,**/testUtils/*,**/scripts/*,**/ops/*,**/mock*.go
-Dsonar.branch.name=${{ github.event.pull_request.head.ref }} -Dsonar.projectVersion=${{ github.event.pull_request.head.sha }}
args: |
-Dsonar.projectKey=bcda-ssas-api
-Dsonar.sources=.
-Dsonar.go.coverage.reportPaths=./test_results/latest/testcoverage.out
-Dsonar.coverage.exclusions=**/*test.go,**/test/**/*,**/testUtils/*,**/scripts/*,**/ops/*,**/mock*.go,**/mock/**/*
-Dsonar.branch.name=${{ github.event.pull_request.head.ref }}
-Dsonar.projectVersion=${{ github.event.pull_request.head.sha }}
-Dsonar.qualitygate.wait=true
55 changes: 0 additions & 55 deletions .github/workflows/quality-checks.yml

This file was deleted.

0 comments on commit e7232a7

Please sign in to comment.