-
Notifications
You must be signed in to change notification settings - Fork 67
62 lines (50 loc) · 2.15 KB
/
sdf_parser.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
name: SDF Parsing
on:
push:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install packages
id: install-packages
run: |
sudo apt install -y build-essential cmake python3-pip wget lsb-release gnupg curl
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt install libsdformat14-dev libsdformat14
- name: Build check_sdf
id: build-check-sdf
run: |
cd ./sdf_parsing
mkdir build
cd build/
cmake .. -Wno-dev
make
- name: Get latest commit hash
id: latest_commit
run: echo "hash=$(git log --format="%H" -n 1 | tail -n 1)" >> $GITHUB_OUTPUT
- name: Get second-to-last commit hash
id: second_to_last_commit
run: echo "hash=$(git log --format="%H" -n 2 | tail -n 1)" >> $GITHUB_OUTPUT
- name: Get changed files
id: changed-files
run: echo "changed_files=$(git diff --name-only ${{ steps.second_to_last_commit.outputs.hash }} ${{ steps.latest_commit.outputs.hash }})" >> $GITHUB_OUTPUT
- name: Iterate, find and check .sdf files
run: |
for file in ${{ steps.changed-files.outputs.changed_files }}; do
if [[ $file == *.sdf ]]; then
echo "Checking $file"
# Run sdf parser
./sdf_parsing/build/check_sdf $file
exit_code=$?
# Exit if exit code not equal 0
if [ $exit_code -ne 0 ]; then
echo "sdf parsing error in $file, exit code: $exit_code"
fi
fi
done