-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub actions workflows to replace Circle CI (#211)
<!-- Thanks for the contribution, this is awesome. --> # PR Details This PR is to add GitHub actions CI workflow to build and run sonar scan analysis and removed Circle CI configuration as we are migrating all of our CI/CD builds to GitHub actions. ## Description Reasons for Migration: Circle CI builds are consuming more credits per build and price of credits/min is doubles for each resource class Build time is reduced by GitHub actions compare to Circle CI. GitHub actions runners price is less and its included in our monthly GitHub Organization payment with free 3000mins. This PR is to add GitHub actions workflow to build and run sonar scanner <!--- Describe your changes in detail --> ## Related GitHub Issue <!--- This project only accepts pull requests related to open GitHub issues or Jira Keys --> <!--- If suggesting a new feature or change, please discuss it in an issue first --> <!--- If fixing a bug, there should be an issue describing it with steps to reproduce --> <!--- Please DO NOT name partially fixed issues, instead open an issue specific to this fix --> <!--- Please link to the issue here: --> ## Related Jira Key <!-- e.g. CAR-123 --> ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> ## How Has This Been Tested? <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Defect fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that cause existing functionality to change) ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [ ] I have added any new packages to the sonar-scanner.properties file - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I have read the [**CONTRIBUTING**](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md) document. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed.
- Loading branch information
Showing
6 changed files
with
181 additions
and
102 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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,78 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
- "develop" | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
build: | ||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: "/opt/carma/" | ||
runs-on: ubuntu-latest | ||
container: | ||
image: usdotfhwastoldev/carma-base: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 }} | ||
uses: actions/[email protected] | ||
with: | ||
path: src/${{ github.event.repository.name }} | ||
fetch-depth: 0 | ||
- name: Move source code | ||
run: mv $GITHUB_WORKSPACE/src /opt/carma/ | ||
- name: Checkout dependencies | ||
run: | | ||
./src/${{ github.event.repository.name }}/carma-messenger-core/docker/checkout.bash -r /opt/carma/ | ||
- name: Build Ros1 | ||
run: | | ||
source "$INIT_ENV" | ||
PACKAGES=$(find . -maxdepth 2 -type f -name package.xml | sed 's/\.\///' | cut -d/ -f1) | ||
sed -i '/colcon build/ s/$/ --parallel-workers 4 --packages-up-to $PACKAGES/' /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 | ||
continue-on-error: true | ||
run: | | ||
source "$INIT_ENV" | ||
sed -i '/colcon test/ s/$/ --parallel-workers 4 --packages-above $PACKAGES/' /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 | ||
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 | ||
run: | | ||
source "$INIT_ENV" | ||
source "$ROS_2_ENV" | ||
PACKAGES=$(find . -maxdepth 2 -type f -name package.xml | sed 's/\.\///' | cut -d/ -f1) | ||
sed -i '/colcon build/ s/$/ --parallel-workers 4 --packages-up-to $PACKAGES/' /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 Ros2 C++ Tests | ||
continue-on-error: true | ||
run: | | ||
source "$INIT_ENV" | ||
source "$ROS_2_ENV" | ||
sed -i '/colcon test/ s/$/ --parallel-workers 4 --packages-above $PACKAGES/' /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: Combine ROS1 and ROS2 compile_commands.json files | ||
continue-on-error: true | ||
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 | ||
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- "develop" | ||
- "master" | ||
- "release/*" | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and Push carma-messenger-ui Docker Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./carma-messenger-ui/ | ||
push: true | ||
tags: usdotfhwastoldev/carma-messenger-ui:${{ github.ref_name }}-carma-messenger-ui | ||
|
||
- name: Build and Push carma-messenger-core Docker Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./carma-messenger-core/ | ||
push: true | ||
tags: usdotfhwastoldev/carma-messenger-core:${{ github.ref_name }}-carma-messenger-core | ||
|
||
- name: Build and Push chevrolet_tahoe_2018 Docker Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./carma-messenger-config/chevrolet_tahoe_2018/ | ||
push: true | ||
tags: usdotfhwastoldev/carma-messenger-config:${{ github.ref_name }}-chevrolet_tahoe_2018 | ||
|
||
- name: Build and Push development Docker Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./carma-messenger-config/development/ | ||
push: true | ||
tags: usdotfhwastoldev/carma-messenger-config:${{ github.ref_name }}-development | ||
|
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,51 @@ | ||
name: DockerHub | ||
|
||
on: | ||
push: | ||
branches: | ||
- "develop" | ||
- "master" | ||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and Push carma-messenger-ui Docker Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./carma-messenger-ui/ | ||
push: true | ||
tags: usdotfhwastoldev/carma-messenger-ui:${{ github.ref_name }}-carma-messenger-ui | ||
|
||
- name: Build and Push carma-messenger-core Docker Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./carma-messenger-core/ | ||
push: true | ||
tags: usdotfhwastoldev/carma-messenger-core:${{ github.ref_name }}-carma-messenger-core | ||
|
||
- name: Build and Push chevrolet_tahoe_2018 Docker Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./carma-messenger-config/chevrolet_tahoe_2018/ | ||
push: true | ||
tags: usdotfhwastoldev/carma-messenger-config:${{ github.ref_name }}-chevrolet_tahoe_2018 | ||
|
||
- name: Build and Push development Docker Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./carma-messenger-config/development/ | ||
push: true | ||
tags: usdotfhwastoldev/carma-messenger-config:${{ github.ref_name }}-development | ||
|
||
|
||
|
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