Skip to content

Commit 0f698a7

Browse files
feat: add component-based configuration for Geti CI (#517)
Co-authored-by: Albert van Houten <[email protected]>
1 parent 7348c49 commit 0f698a7

File tree

3 files changed

+81
-1
lines changed

3 files changed

+81
-1
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: 'Read Component Configuration'
2+
description: 'Read component configuration from YAML file'
3+
4+
inputs:
5+
component_dir:
6+
description: 'Component directory from the repo root'
7+
required: true
8+
config_file:
9+
description: 'Path to configuration YAML file'
10+
required: false
11+
default: '.github/components-config.yaml'
12+
13+
outputs:
14+
cleanup_type:
15+
description: 'Type of cleanup to perform'
16+
value: ${{ steps.config.outputs.cleanup_type }}
17+
integration_builder:
18+
description: 'If integration tests should be executed in a builder container'
19+
value: ${{ steps.config.outputs.integration_builder }}
20+
21+
runs:
22+
using: 'composite'
23+
steps:
24+
- name: Read component configuration
25+
id: config
26+
shell: bash
27+
env:
28+
COMPONENT_DIR: ${{ inputs.component_dir }}
29+
CONFIG_FILE: ${{ inputs.config_file }}
30+
run: |
31+
32+
get_config_value() {
33+
COMPONENT="$COMPONENT_DIR" KEY="$1" yq eval -r '
34+
.defaults as $defaults |
35+
(.components[env(COMPONENT)] // {}) as $component |
36+
($defaults * $component)[env(KEY)]
37+
' "$CONFIG_FILE"
38+
}
39+
40+
cleanup_type=$(get_config_value "cleanup_type")
41+
integration_builder=$(get_config_value "integration_builder")
42+
43+
echo "cleanup_type=$cleanup_type" >> $GITHUB_OUTPUT
44+
echo "integration_builder=$integration_builder" >> $GITHUB_OUTPUT
45+
46+
echo "=== Component Configuration ==="
47+
echo "Component: $COMPONENT_DIR"
48+
echo "cleanup_type: $cleanup_type"
49+
echo "integration_builder: $integration_builder"
50+
echo "==============================="

.github/components-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Component Build Configuration
2+
#
3+
# This file optimizes CI/CD builds by configuring settings per component.
4+
# Components not listed here use the 'defaults' section below.
5+
components:
6+
interactive_ai/workflows/otx_domain/trainer/otx_v2/xpu:
7+
# Heavy builds requiring cleanup to fit into default GitHub runner disk space
8+
cleanup_type: all
9+
10+
interactive_ai/workflows/otx_domain/trainer/otx_v2/gpu:
11+
# Heavy builds requiring cleanup to fit into default GitHub runner disk space
12+
cleanup_type: all
13+
14+
interactive_ai/workflows/geti_domain/project_ie:
15+
integration_builder: false
16+
17+
# Default configuration for unlisted components
18+
defaults:
19+
cleanup_type: none
20+
integration_builder: true

.github/workflows/component.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,18 @@ jobs:
6161
persist-credentials: false
6262
ref: ${{ inputs.ref || '' }}
6363

64+
- name: Read component config
65+
id: component-config
66+
uses: ./.github/actions/read-component-config
67+
with:
68+
component_dir: ${{ env.COMPONENT_DIR }}
69+
6470
- name: Initial cleanup
71+
if: steps.component-config.outputs.cleanup_type == 'initial' || steps.component-config.outputs.cleanup_type == 'all'
6572
uses: ./.github/actions/cleanup-runner
6673
with:
6774
type: 'initial'
75+
6876
- name: Configure AWS Credentials
6977
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
7078
with:
@@ -96,13 +104,15 @@ jobs:
96104

97105
- name: Integration testing
98106
run: |
99-
if [[ "${COMPONENT_DIR}" == "interactive_ai/workflows/geti_domain/project_ie" ]]; then
107+
if [[ "${{ steps.component-config.outputs.integration_builder }}" == "false" ]]; then
100108
make -C "${COMPONENT_DIR}" test-integration
101109
else
102110
make builder -C "${COMPONENT_DIR}" test-integration
103111
fi
112+
104113

105114
- name: Pre-build cleanup
115+
if: steps.component-config.outputs.cleanup_type == 'pre-build' || steps.component-config.outputs.cleanup_type == 'all'
106116
uses: ./.github/actions/cleanup-runner
107117
with:
108118
type: 'pre-build'

0 commit comments

Comments
 (0)