trying ccache in docker #31
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: 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 |