Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functionality for running CI unit tests on modified modules only #72

Merged
merged 149 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 107 commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
df37d4d
trying tj-actions for github workflows
Feb 6, 2024
b586fab
fixed syntax error line 4
Feb 6, 2024
a817dc3
syntax error again
Feb 6, 2024
20f80cc
test tj-actions
Feb 6, 2024
f300c91
on: changes
Feb 6, 2024
64e9398
on: changes 2
Feb 6, 2024
8c6c4ed
test glob patterning to check src files
Feb 6, 2024
985c420
test glob patterning to check src files 2
Feb 6, 2024
d0abc65
test glob patterning to check src files 3
Feb 6, 2024
e95b008
test glob patterning to check src files 4
Feb 6, 2024
16138ab
testing tj actions to store directory changes in env var
Feb 7, 2024
23cb1bf
changed id
Feb 7, 2024
7896468
typo in src
Feb 7, 2024
ea5ede8
workflow changes
Feb 7, 2024
9720a9c
workflow changes
Feb 7, 2024
b9de52d
workflow changes
Feb 7, 2024
152f7ce
checkign
Feb 7, 2024
904b491
im going insane
Feb 7, 2024
d2b2850
im going insane
Feb 7, 2024
b67d2d6
ggs
Feb 7, 2024
870af8d
added branches main to see if tj-actions can read main
Feb 7, 2024
49631e7
changed txt
Feb 7, 2024
50f2bd2
changed txt
Feb 7, 2024
6378a52
changed txt
Feb 7, 2024
4fe43d9
changed txt
Feb 7, 2024
b44f89e
changed txt
Feb 7, 2024
58416b9
changed txt
Feb 7, 2024
8ac46c4
changed txt
Feb 7, 2024
f3a0727
changed txt
Feb 7, 2024
2663104
changed txt
Feb 7, 2024
e0c8bd6
modifying variables between steps
Feb 7, 2024
31b783c
modifying variables between steps
Feb 7, 2024
6ae470f
modifying variables between steps
Feb 7, 2024
b900bf1
Added rest of modules to check
Feb 7, 2024
4b4a777
sus
Feb 7, 2024
7a7cb7c
Added module logic to docker_context.sh
Feb 7, 2024
e3c47b0
fixed typo
Feb 7, 2024
cc6daa2
fixed typo
Feb 7, 2024
dfe1255
test ci
Feb 7, 2024
74d950e
test ci
Feb 7, 2024
7234eb0
test ci
Feb 7, 2024
4050606
changed txt
Feb 7, 2024
c7a72db
test ci
Feb 7, 2024
0faed3c
test ci
Feb 7, 2024
390ab99
test ci
Feb 7, 2024
ecb51e5
test ci
Feb 7, 2024
459e979
test ci
Feb 7, 2024
0fae80f
test ci
Feb 7, 2024
5c09f58
test ci
Feb 7, 2024
3d968e6
test ci
Feb 7, 2024
8e162c2
test ci
Feb 7, 2024
2de32fc
insanity?
Feb 7, 2024
eae470d
insanity?
Feb 7, 2024
4fd444c
insanity?
Feb 7, 2024
cf81f79
insanity?
Feb 7, 2024
e2ae061
insanity?
Feb 7, 2024
4ad430c
insanitys?
Feb 7, 2024
f048da3
fixed typo
Feb 7, 2024
764f3b0
fixed typo
Feb 7, 2024
ba1d2bd
testing output variables
Feb 7, 2024
459db52
testing output variables
Feb 7, 2024
b801fd6
testing output variables
Feb 7, 2024
ba46f3f
testing output variables
Feb 8, 2024
68705de
testing output variables
Feb 8, 2024
66364d9
Testing entire unit test pipeline with specific module testing only
Feb 8, 2024
f23357d
Testing entire unit test pipeline with specific module testing only
Feb 8, 2024
6bf4f1f
Handle no src file changes
Feb 8, 2024
546d3c4
Compare changes to main branch
Feb 8, 2024
73d8b60
Compare changes to main branch
Feb 8, 2024
fb02414
Environment variable naming changes
Feb 8, 2024
b459a55
Environment variable naming changes
Feb 8, 2024
f07412f
Clean for PR
Feb 8, 2024
05897f9
Clean for PR
Feb 8, 2024
c55c138
job renaming for PR
Feb 8, 2024
a049def
workflow changes
Feb 8, 2024
4d5218b
workflow changes
Feb 8, 2024
89b3650
workflow changes
Feb 8, 2024
433ac65
condensing workflows
Feb 9, 2024
f1cdb7d
condensing workflows
Feb 10, 2024
8a7c3fc
Merged main
Feb 10, 2024
82590c0
typo in workflow
Feb 10, 2024
ce7d8cc
typo in workflow
Feb 10, 2024
e47f9f4
workflow changes
Feb 10, 2024
3f8ec55
workflow changes
Feb 10, 2024
d85c91f
workflow changes
Feb 10, 2024
748bea7
workflow changes
Feb 10, 2024
d5c5cc4
workflow changes
Feb 10, 2024
2884aad
workflow changes
Feb 10, 2024
881feec
workflow changes
Feb 10, 2024
1361185
workflow changes
Feb 10, 2024
178be8a
workflow changes
Feb 10, 2024
3465f9a
workflow changes
Feb 10, 2024
97585a4
workflow changes
Feb 10, 2024
22ca059
workflow changes
Feb 10, 2024
4687bec
workflow changes
Feb 10, 2024
26db2a2
workflow changes
Feb 10, 2024
fbe38a5
workflow changes
Feb 10, 2024
d0ed0a9
workflow changes
Feb 10, 2024
b3212b7
workflow changes
Feb 10, 2024
86b0768
workflow changes
Feb 10, 2024
3b92051
workflow changes
Feb 10, 2024
56f336b
workflow changes
Feb 10, 2024
8976fe2
workflow changes
Feb 10, 2024
41ac51f
workflow changes
Feb 10, 2024
254574d
Ending job added
Feb 10, 2024
947e7de
Ending job added
Feb 10, 2024
be1ee79
Ending job added
Feb 10, 2024
283172f
Created check_src_changes.sh
Feb 10, 2024
3f9f2a4
Workflow typo
Feb 10, 2024
834d010
Enable permission to run new .sh file
Feb 10, 2024
a59a0cd
Workflow .sh changes
Feb 10, 2024
3cb6ed6
checking pipeline
Feb 10, 2024
afe3ec4
checking pipeline
Feb 10, 2024
f9add13
Testing workflow
Feb 11, 2024
a5fd026
Testing workflow
Feb 11, 2024
e23dc90
Testing workflow
Feb 11, 2024
3853ad8
Testing workflow
Feb 11, 2024
2fdab6a
Testing workflow
Feb 11, 2024
7c374eb
Testing workflow
Feb 11, 2024
115367b
Testing workflow
Feb 11, 2024
a0a743d
Testing workflow
Feb 11, 2024
29101f1
Update docker_context.sh
Feb 11, 2024
c129364
Update docker_context.sh
Feb 11, 2024
384b061
Added notice to echo last job
Feb 11, 2024
5aeee25
Added notice to echo last job
Feb 11, 2024
4fb211a
Removed accidental watod-config changes
Feb 11, 2024
3d7572e
Workflow typo
Feb 12, 2024
a049c15
Added notice to final workflow step
Feb 12, 2024
b431849
removed testing txt files
Feb 13, 2024
b6eabc9
Merge branch 'main' into ci-specific-modules
Feb 13, 2024
e0269b6
added infra checks
Feb 13, 2024
92b483a
fixed typo
Feb 13, 2024
f9adddd
added infra checks
Feb 13, 2024
860cbfa
txt add to wato_msgs
Feb 13, 2024
be9d3c7
typos
Feb 13, 2024
5700242
bash moment
Feb 13, 2024
a372d7f
bash moment
Feb 13, 2024
4627c9f
naming convention changes
Feb 13, 2024
553d552
naming convention changes
Feb 13, 2024
66d6a7f
typo
Feb 13, 2024
ff92af4
typo
Feb 13, 2024
ce6208e
typo
Feb 13, 2024
c40cacc
typo
Feb 13, 2024
3539d1b
testing pipeline
Feb 13, 2024
96329d3
testing pipeline
Feb 13, 2024
dee29a8
Cleaning up workflow logic
Feb 14, 2024
ae0397e
testing workflow
Feb 14, 2024
1412ad0
Fully tested GitHub CI pipeline for module-specific unit tests
Feb 14, 2024
89d7960
Fully tested GitHub CI pipeline for module-specific unit tests
Feb 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/templates/check_src_changes/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Check source file changes

outputs:
modified_modules:
description: "Space deliminated list of modified modules"
value: ${{ steps.output-changes.outputs.modified_modules }}

runs:
using: "composite"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Find changed files inside action folder
id: changed-files-action
uses: tj-actions/changed-files@v42
with:
files: src/action/**

- name: Get changed files inside interfacing folder
id: changed-files-interfacing
uses: tj-actions/changed-files@v42
with:
files: src/interfacing/**

- name: Get changed files inside perception folder
id: changed-files-perception
uses: tj-actions/changed-files@v42
with:
files: src/perception/**

- name: Get changed files inside samples folder
id: changed-files-samples
uses: tj-actions/changed-files@v42
with:
files: src/samples/**

- name: Get changed files inside simulation folder
id: changed-files-simulation
uses: tj-actions/changed-files@v42
with:
files: src/simulation/**

- name: Get changed files inside world_modeling folder
id: changed-files-world-modeling
uses: tj-actions/changed-files@v42
with:
files: src/world_modeling/**

- name: Create list of changed modules
env:
CHANGED_MODULES: ""
run: |
if [ ${{ steps.changed-files-action.outputs.any_changed }} == 'true' ]; then
echo "Detected action changes"
CHANGED_MODULES+="action "
fi

if [ ${{ steps.changed-files-interfacing.outputs.any_changed }} == 'true' ]; then
echo "Detected interfacing changes"
CHANGED_MODULES+="interfacing "
fi

if [ ${{ steps.changed-files-perception.outputs.any_changed }} == 'true' ]; then
echo "Detected perception changes"
CHANGED_MODULES+="perception "
fi

if [ ${{ steps.changed-files-samples.outputs.any_changed }} == 'true' ]; then
echo "Detected samples changes"
CHANGED_MODULES+="samples "
fi

if [ ${{ steps.changed-files-simulation.outputs.any_changed }} == 'true' ]; then
echo "Detected simulation changes"
CHANGED_MODULES+="simulation "
fi

if [ ${{ steps.changed-files-world-modeling.outputs.any_changed }} == 'true' ]; then
echo "Detected world_modeling changes"
CHANGED_MODULES+="world_modeling"
fi

echo "CHANGED_MODULES=$CHANGED_MODULES" >> $GITHUB_ENV
shell: bash

- name: Output list of changed modules
id: output-changes
run: |
echo "The changed modules are: $CHANGED_MODULES"
echo "modified_modules=$CHANGED_MODULES" >> $GITHUB_OUTPUT
Edwardius marked this conversation as resolved.
Show resolved Hide resolved
shell: bash
10 changes: 9 additions & 1 deletion .github/templates/docker_context/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Generate Docker Environment

inputs:
modified_modules:
description: "Space deliminated list of modified modules"
required: true
default: ''

outputs:
docker_matrix:
description: "list of docker compose services"
Expand All @@ -15,5 +21,7 @@ runs:
using: "composite"
steps:
- id: environment-generator
run: ${{ github.action_path }}/docker_context.sh
env:
MODIFIED_MODULES: ${{ inputs.modified_modules }}
run: ${{ github.action_path }}/docker_context.sh "$MODIFIED_MODULES"
Edwardius marked this conversation as resolved.
Show resolved Hide resolved
shell: bash
12 changes: 12 additions & 0 deletions .github/templates/docker_context/docker_context.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,24 @@ modules=$(find modules -maxdepth 1 -name "docker-compose*")
# Initialize an empty array for JSON objects
json_objects=()

echo "::notice:: Incoming modified modules are $1"
Edwardius marked this conversation as resolved.
Show resolved Hide resolved

# Loop through each module
while read -r module; do

# Retrieve docker compose service names
services=$(docker-compose -f "$module" config --services)
module_out=$(echo "$module" | sed -n 's/modules\/docker-compose\.\(.*\)\.yaml/\1/p')

# Only work with modules that are modified
if [[ $1 != *$module_out* ]]; then
if [[ "$1" = "" || $1 = " " ]]; then
echo "::notice:: No source code modified, testing all modules for possible infra changes"
else
continue
fi
fi

# Loop through each service
while read -r service_out; do
# Construct JSON object for each service with module and service name
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/build_and_unitest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,22 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Get Module Changes
id: get-module-changes
uses: "./.github/templates/check_src_changes"

- name: Setup Watod Environment
run: ./watod_scripts/watod-setup-env.sh
shell: bash

- name: Generate Docker Environment
id: docker-environment
env:
MODIFIED_MODULES: ${{ steps.get-module-changes.outputs.modified_modules }}
Edwardius marked this conversation as resolved.
Show resolved Hide resolved
uses: "./.github/templates/docker_context"

with:
modified_modules: ${{ env.MODIFIED_MODULES }}

- name: Generate GitHub Environment
id: github-environment
uses: "./.github/templates/github_context"
Expand Down Expand Up @@ -133,3 +141,13 @@ jobs:
with:
image: ${{ steps.construct-registry-url.outputs.url }}
tag: build_${{ env.SOURCE_BRANCH }}

confirm-build-and-unittest-complete:
name: Confirm Build and Unit Tests Completed
needs: build-and-unittest
runs-on: ubuntu-latest
steps:
- name: Ending
run:
echo "All builds and unit tests completed!"

1 change: 1 addition & 0 deletions src/interfacing/test2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4
1 change: 1 addition & 0 deletions src/world_modeling/test3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
Loading