ci: add sonar cloud setting #1223
Workflow file for this run
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
name: colcon-test | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
paths: [driving_log_replayer/**, .github/workflows/colcon-test.yaml] | |
schedule: | |
- cron: 0 0 * * 0 | |
workflow_dispatch: | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ros_distribution: | |
- humble | |
include: | |
# Humble Hawksbill (May 2022 - May 2027) | |
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest | |
ros_distribution: humble | |
ros_version: 2 | |
container: | |
image: ${{ matrix.docker_image }} | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Search packages in this repository | |
id: list_packages | |
run: | | |
echo package_list=$(colcon list --names-only | sed -e ':loop; N; $!b loop; s/\n/ /g') >> $GITHUB_OUTPUT | |
- name: Setup ROS environment | |
uses: ros-tooling/setup-ros@0.7.8 | |
with: | |
required-ros-distributions: ${{ matrix.ros_distribution }} | |
- name: build and test | |
uses: ros-tooling/action-ros-ci@0.3.13 | |
with: | |
package-name: ${{ steps.list_packages.outputs.package_list }} | |
target-ros2-distro: ${{ matrix.ros_distribution }} | |
vcs-repo-file-url: dependency.repos | |
import-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: show dir for test coverage | |
run: | | |
pwd | |
echo "Current working directory:" | |
ls -la driving_log_repalyer/ros_ws | |
- name: Execute pytest | |
run: | | |
set -o pipefail | |
source driving_log_replayer/ros_ws/install/setup.bash | |
cd driving_log_replyaer | |
pytest -s --suppress-no-test-exit-code -v \ | |
--junit-xml test-output/results/pytest.xml \ | |
--cov=test --cov-report=term-missing:skip-covered --cov-report=xml:test-output/coverage-reports/coverage.xml test | tee pytest-coverage.txt | |
- name: Upload Unit Test Output | |
uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: main_package | |
path: test-output/**/*.xml # to be updated | |
report-test-result: | |
name: Get and upload Test Result | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
if: ${{ !cancelled() }} | |
needs: | |
- build-and-test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |