-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (98 loc) · 4.03 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Build and Test
on:
schedule:
- cron: "0 0 * * 1"
# push:
# branches:
# - master
jobs:
build-and-test:
runs-on: ubuntu-22.04
env:
SONAR_SCANNER_VERSION: 4.7.0.2747
SONAR_SERVER_URL: "https://sonarcloud.io"
BUILD_WRAPPER_OUT_DIR: /home/runner/target_ws/
ISOLATION: "shell"
steps:
- uses: ros-tooling/[email protected]
with:
required-ros-distributions: ""
# required-ros-distributions: rolling
- name: creating_folder
run : |
mkdir -p /home/runner/target_ws/src/ || true
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Download and set up sonar-scanner
env:
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
run: |
curl -sSLo /home/runner/target_ws/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
unzip -o /home/runner/target_ws/sonar-scanner.zip -d /home/runner/target_ws/
echo "/home/runner/target_ws/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
- name: Download and set up build-wrapper
env:
BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip
run: |
curl -sSLo /home/runner/target_ws/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
unzip -o /home/runner/target_ws/build-wrapper-linux-x86.zip -d /home/runner/target_ws/
echo "/home/runner/target_ws/build-wrapper-linux-x86" >> $GITHUB_PATH
- name: Checking out
uses: actions/[email protected]
with:
submodules: recursive
- name: Run build-wrapper
run: |
cd /home/runner/target_ws/
wget https://raw.githubusercontent.com/ros2/ros2/rolling/ros2.repos
vcs import src < ros2.repos
vcs import src < /home/runner/work/ros2_sonarcloud/ros2_sonarcloud/extra_repo.repos
rosdep update && rosdep install -y --rosdistro "rolling" --from-paths src --ignore-src || true
./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir . colcon build --executor parallel --continue-on-error || true
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
cd /home/runner/target_ws/
sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \
-Dsonar.projectKey=muttistefano_ros2_sonarcloud \
-Dsonar.organization=muttistefano \
-Dsonar.cfamily.threads=2 \
-Dsonar.projectBaseDir=/home/runner/target_ws/ \
-Dsonar.sources=src
cd /home/runner/target_ws/src/
# - name: cccc action step
# uses: sarnold/cccc-action@main
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# - name: upload metrics report
# uses: actions/upload-artifact@v2
# with:
# name: metrics
# path: ./metrics
# - name: cppcheck
# uses: deep5050/cppcheck-action@main
# with:
# github_token: ${{ secrets.GITHUB_TOKEN}}
- name: execute py script
run: |
cd /home/runner/work/ros2_sonarcloud/ros2_sonarcloud/
ls -al
python3 run.py
ls -al
- name: Commit files
run: |
pwd
ls -al
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add . -A
git commit -m "push README.md"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}