Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
chore: Run Full CI/CD on release tag and release branch creation (#417)
Browse files Browse the repository at this point in the history
* chore: Run Full CI/CD on release tag and release branch creation

* chore: Run Full CI/CD on release tag and release branch creation

* chore: Run Full CI/CD on release tag and release branch creation

---------

Co-authored-by: Rupeekshan Maheswaran <63111541+Rupeekshan@users.noreply.github.com>
  • Loading branch information
Sivakajan-tech and Rupeekshan authored Sep 3, 2024
1 parent a10ae6e commit 3c2046d
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 4 deletions.
46 changes: 42 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,59 @@ on:
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]

jobs:
code_quality_check:
uses: ./.github/workflows/code-quality-check.yml
secrets: inherit
changed_files:
runs-on: ubuntu-latest
outputs:
modified: ${{ steps.changes.outputs.src }}
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
src:
- .github/workflows/**
- aws-lambda-scorer/**
- aws-sagemaker-hosted-scorer/**
- aws-sagemaker-hosted-scorer-cpp/**
- common/**
- config/**
- gcp-cloud-run/**
- gcp-vertex-ai-mojo-scorer/**
- gradle/**
- hive-mojo-scorer/**
- kdb-mojo-scorer/**
- local-rest-scorer/**
- sql-jdbc-scorer/**
- build.gradle
- gradlew
setup_env:
uses: ./.github/workflows/setup-environment.yml

code_quality_check:
needs:
- changed_files
- setup_env
uses: ./.github/workflows/code-quality-check.yml
secrets: inherit
with:
if: ${{ needs.setup_env.outputs.bypass_changed_files == 'true' || needs.changed_files.outputs.modified == 'true' }}

build_image:
uses: ./.github/workflows/image-build.yml
needs:
- changed_files
- setup_env
- code_quality_check
uses: ./.github/workflows/image-build.yml
secrets: inherit
with:
component_version: ${{ needs.setup_env.outputs.component_version }}
if: ${{ needs.setup_env.outputs.bypass_changed_files == 'true' || needs.changed_files.outputs.modified == 'true' }}
# The `! failure()` condition runs when the parent jobs completed successfully or were skipped.
if: ${{ ! failure() }}

publish_latest_from_dev_branch:
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/code-quality-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ name: Code Analysis

on:
workflow_call:
inputs:
if:
description: Whether to run the workflow (workaround for required status checks issue)
type: boolean
default: true

jobs:
code_quality_check:
name: Linters
if: ${{ inputs.if }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Build Images
on:
workflow_call:
inputs:
if:
description: Whether to run the workflow (workaround for required status checks issue)
type: boolean
default: true
component_version:
description: Gradle component version
type: string
Expand All @@ -11,6 +15,7 @@ on:
jobs:
build:
name: Build Image
if: ${{ inputs.if }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/setup-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
component_version:
description: "Gradle component version, such as 1.2.3"
value: ${{ jobs.setup_env.outputs.component_version }}
bypass_changed_files:
description: "True whether we should run all jobs regardless of changed files output"
value: ${{ jobs.setup_env.outputs.bypass_changed_files }}
sanitized_branch_name:
description: "Branch name where / is replaced by -"
value: ${{ jobs.setup_env.outputs.sanitized_branch_name }}
Expand All @@ -29,6 +32,7 @@ jobs:
release_version: ${{ steps.release_version.outputs.version }}
component_version: ${{ steps.component_version.outputs.version }}
sanitized_branch_name: ${{ steps.sanitized_branch_name.outputs.name }}
bypass_changed_files: ${{ steps.bypass_changed_files.outputs.bypass }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -53,6 +57,20 @@ jobs:
github_ref="${{ github.ref }}"
echo "version=${github_ref#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Check if we should by pass changed files
id: bypass_changed_files
run: |
if [[ "${{ github.event.created }}" == "true" && "$GITHUB_REF" == refs/heads/release/* ]]; then
echo "Release branch has been created, by-passing changed files ..."
bypass='true'
elif [[ "$GITHUB_REF" == refs/tags/v* ]]; then
echo "Release tag has been pushed, by-passing changed files ..."
bypass='true'
else
bypass='false'
fi
echo "bypass=$bypass" >> $GITHUB_OUTPUT
- name: Save Component Version
id: component_version
run: |
Expand Down

0 comments on commit 3c2046d

Please sign in to comment.