-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Feature github actions CI/CD (#2229)
* add CI workflow * comment sed -i * update sed -i command * Update the gh-action triggerlogic to avoid duplicate builds * Address PR comments & add dlib lib * run multiple_object_tracking deps install script * Update Ci.yml * move multiple_object_tracking deps install to checkout.sh * fix install deps path * move install_deps to CI build step * Update Ci.yml * Update Ci.yml * fix dep path * update dep path * fix path * add packages to unit tests ignore * remove dlib dep and add more packages to unit test ignore * add source autoware before ros2 build * fix autoware source * remove cmake args ros2 test run * remove sed ros2 unit test * update base directory path for sonar * comment mpc_follower_wrapper temp change on 8 core runners * remove 8 cores runners * tweak sonar properties * remove 16 core runners * Skip ros2 packages * Address PR comments * update comment and check PR build * add back sed -i command to skip few ros1 packages * Remove the ros1 packages from skip command --------- Co-authored-by: Anish <[email protected]>
- Loading branch information
1 parent
f2c60cc
commit 9d92822
Showing
6 changed files
with
157 additions
and
200 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# GitHub Actions triggers based on the PR's and each commits on develop and master | ||
name: "CI: Run tests" | ||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
push: | ||
branches: [develop, master] | ||
jobs: | ||
build: | ||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: "/opt/carma/" | ||
|
||
# Specify the runner environment | ||
runs-on: ubuntu-latest | ||
|
||
# Set up a Docker container for the job | ||
container: | ||
image: usdotfhwastoldev/autoware.ai:develop | ||
env: | ||
INIT_ENV: "/home/carma/.base-image/init-env.sh" | ||
ROS_2_ENV: "/opt/ros/foxy/setup.bash" | ||
TERM: xterm | ||
options: "--user root" | ||
|
||
steps: | ||
- name: Checkout ${{ github.event.repository.name }} | ||
# Check out the repository code | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
path: src/${{ github.event.repository.name }} | ||
|
||
- name: Move source code | ||
# Move the source code to the desired location | ||
run: mv $GITHUB_WORKSPACE/src /opt/carma/ | ||
|
||
- name: Checkout dependencies | ||
# Checkout project dependencies | ||
run: | | ||
source "$INIT_ENV" | ||
./src/${{ github.event.repository.name }}/docker/checkout.bash -r /opt/carma/ | ||
- name: Install external dependencies | ||
# Install the multiple object tracking deps | ||
run: sudo bash /opt/carma/src/multiple_object_tracking/scripts/install_dependencies.sh | ||
|
||
- name: Build ROS1 | ||
# Build ROS1 packages | ||
# The skipped ROS 1 packages here should match the ROS 1 packages that are skipped during the build in docker/install.sh | ||
run: | | ||
source "$INIT_ENV" | ||
PACKAGES=$(find . -maxdepth 2 -type f -name package.xml | sed 's/\.\///' | cut -d/ -f1) # maxdepth 2 Limits the search of package.xml to current directory and one level of subdirectories beneath it. find will not search beyond two levels deep from the starting point. Without this option, find would search the starting directory and all subdirectories recursively. | ||
sed -i 's/colcon build /colcon build --packages-skip novatel_oem7_msgs tracetools tracetools_test /' /home/carma/.ci-image/engineering_tools/code_coverage/make_with_coverage.bash | ||
make_with_coverage.bash -m -e /opt/carma/ -o ./coverage_reports/gcov | ||
- name: Run ROS1 C++ Tests | ||
# Run ROS1 C++ tests | ||
# The skipped ROS 1 packages here should match the ROS 1 packages that are skipped during the build in docker/install.sh" | ||
run: | | ||
source "$INIT_ENV" | ||
sed -i 's/colcon test /colcon test --packages-skip novatel_oem7_msgs tracetools tracetools_test /' /home/carma/.ci-image/engineering_tools/code_coverage/make_with_coverage.bash | ||
make_with_coverage.bash -t -e /opt/carma/ -o ./coverage_reports/gcov | ||
- name: Backup ROS1 compile_commands.json | ||
# Backup the ROS1 compile_commands.json file for sonarcloud | ||
run: | | ||
mv /opt/carma/build/compile_commands.json /opt/carma/compile_commands.ros1.json | ||
- name: Cleanup before ROS 2 build | ||
# Clear the build and install folders before building ROS 2 | ||
run: | | ||
rm -rf /opt/carma/install | ||
rm -rf /opt/carma/build | ||
- name: Build ROS2 | ||
# Build ROS2 packages | ||
run: | | ||
source "$INIT_ENV" | ||
source "$ROS_2_ENV" | ||
source /opt/autoware.ai/ros/install_ros2/setup.bash | ||
make_with_coverage.bash -m -e /opt/carma/ -o ./coverage_reports/gcov | ||
- name: Run ROS2 C++ Tests | ||
# Run ROS2 C++ tests | ||
run: | | ||
source "$INIT_ENV" | ||
source "$ROS_2_ENV" | ||
source /opt/autoware.ai/ros/install_ros2/setup.bash | ||
make_with_coverage.bash -t -e /opt/carma/ -o ./coverage_reports/gcov | ||
- name: Combine ROS1 and ROS2 compile_commands.json files | ||
# Combine the ROS1 and ROS2 compile_commands.json files for sonarscan | ||
run: | | ||
mv /opt/carma/build/compile_commands.json /opt/carma/compile_commands.ros2.json | ||
jq -s add /opt/carma/compile_commands.ros1.json /opt/carma/compile_commands.ros2.json > /opt/carma/build/compile_commands.json | ||
- name: Run SonarScanner | ||
# Run SonarScanner for code analysis | ||
uses: usdot-fhwa-stol/actions/sonar-scanner@main | ||
with: | ||
sonar-token: ${{ secrets.SONAR_TOKEN }} | ||
working-dir: "/opt/carma/src/${{ github.event.repository.name }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
# This workflow will only build for Pull Requests which are opened, changed , merged | ||
name: Docker build | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- "develop" | ||
- "master" | ||
- "release/*" | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
docker: | ||
uses: usdot-fhwa-stol/actions/.github/workflows/docker.yml@main | ||
uses: usdot-fhwa-stol/actions/.github/workflows/docker.yml@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
|
||
|
||
# This workflow will build and push official docker images when new push occurs to develop, master, release branches but doesn't run any unit test or sonar scanner | ||
name: Docker Hub build | ||
|
||
on: | ||
push: | ||
branches: | ||
- "develop" | ||
- "master" | ||
- "release/*" | ||
|
||
jobs: | ||
dockerhub: | ||
uses: usdot-fhwa-stol/actions/.github/workflows/dockerhub.yml@main | ||
secrets: | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} |
Oops, something went wrong.