-
-
Notifications
You must be signed in to change notification settings - Fork 7
66 lines (63 loc) · 2.65 KB
/
main.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
name: main
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Cache SonarQube packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y valgrind cmake pkg-config
- name: Run build-wrapper
run: |
cd test
mkdir debug
cmake -DCMAKE_BUILD_TYPE=Debug -S . -B debug
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build debug/ --config Debug
cd debug
make test
make coverage
- name: Upload sonar results
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="./test/${{ env.BUILD_WRAPPER_OUT_DIR }}"
- name: Build examples
run: |
export IDF_TARGET=$(echo "esp32" | tr '[:upper:]' '[:lower:]' | tr -d '_-')
export CCACHE_DIR="~/ccache"
mkdir -p ${CCACHE_DIR}
docker run -t -e IDF_TARGET="${IDF_TARGET}" -e CCACHE_DIR=/ccache -v ${CCACHE_DIR}:/ccache -v "${GITHUB_WORKSPACE}:/app/${{ github.repository }}" \
-w "/app/${{ github.repository }}/examples/receive_fsk" espressif/idf:v5.1.2 \
/bin/bash -c 'git config --global --add safe.directory "*" && idf.py build'
docker run -t -e IDF_TARGET="${IDF_TARGET}" -e CCACHE_DIR=/ccache -v ${CCACHE_DIR}:/ccache -v "${GITHUB_WORKSPACE}:/app/${{ github.repository }}" \
-w "/app/${{ github.repository }}/examples/receive_fsk_beacon" espressif/idf:v5.1.2 \
/bin/bash -c 'git config --global --add safe.directory "*" && idf.py build'
docker run -t -e IDF_TARGET="${IDF_TARGET}" -e CCACHE_DIR=/ccache -v ${CCACHE_DIR}:/ccache -v "${GITHUB_WORKSPACE}:/app/${{ github.repository }}" \
-w "/app/${{ github.repository }}/examples/receive_fsk_filtered" espressif/idf:v5.1.2 \
/bin/bash -c 'git config --global --add safe.directory "*" && idf.py build'
shell: bash
- name: Cache ccache
uses: actions/cache@v3
with:
path: ~/ccache
key: ${{ runner.os }}-ccache
restore-keys: ${{ runner.os }}-ccache