Skip to content

fix(autoware_test_utils): fix building problem in github CI #297

fix(autoware_test_utils): fix building problem in github CI

fix(autoware_test_utils): fix building problem in github CI #297

Workflow file for this run

name: build-and-test
on:
push:
branches:
- "**"
concurrency:
# Ensures sequential execution of this workflow
group: ${{ github.workflow }}
cancel-in-progress: false
env:
CC: /usr/lib/ccache/gcc
CXX: /usr/lib/ccache/g++
jobs:
build-and-test:
runs-on: ubuntu-24.04
container: ghcr.io/autowarefoundation/autoware:core-devel
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install curl
run: |
sudo apt-get update
sudo apt-get install -y curl
- name: Show disk space before the tasks
run: df -h
- name: Show machine specs
run: lscpu && free -h
- name: Remove exec_depend
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1
- name: Get self packages
id: get-self-packages
uses: autowarefoundation/autoware-github-actions/get-self-packages@v1
- name: Create ccache directory
run: |
mkdir -p ${CCACHE_DIR}
du -sh ${CCACHE_DIR} && ccache -s
shell: bash
- name: Attempt to restore ccache
uses: actions/cache/restore@v4
with:
path: |
/root/.ccache
key: ccache-main-${{ runner.arch }}-humble-${{ github.sha }}
restore-keys: |
ccache-main-${{ runner.arch }}-humble-
- name: Limit ccache size
run: |
rm -f "${CCACHE_DIR}/ccache.conf"
echo -e "# Set maximum cache size\nmax_size = 600MB" >> "${CCACHE_DIR}/ccache.conf"
shell: bash
- name: Show ccache stats before build and reset stats
run: |
du -sh ${CCACHE_DIR} && ccache -s
ccache --zero-stats
shell: bash
- name: Build
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
with:
rosdistro: humble
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
build-depends-repos: build_depends.repos
build-pre-command: taskset --cpu-list 0-6
- name: Show ccache stats after build
run: du -sh ${CCACHE_DIR} && ccache -s
shell: bash
- name: Push the ccache cache
uses: actions/cache/save@v4
with:
path: |
/root/.ccache
key: ccache-main-${{ runner.arch }}-humble-${{ github.sha }}
- name: Test
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
id: test
uses: NorahXiong/autoware-github-actions/colcon-test@main
with:
rosdistro: humble
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
build-depends-repos: build_depends.repos
- name: Upload ws files
uses: actions/upload-artifact@v4
with:
name: ws-files
path: /__w/autoware.core/autoware.core/
- name: Show coverage report files
run: |
cat ${{ steps.test.outputs.coverage-report-files }}
- name: Get gcov settings
id: get-gcov-info
run: |
cd /__w/autoware.core/autoware.core
gcov_ignore_paths_str=`find -type d -name test | xargs -exec realpath`
echo "gcov_ignore_paths_str:$gcov_ignore_paths_str"
echo "gcov_ignore_paths="$gcov_ignore_paths_str"" >> $GITHUB_OUTPUT
gcov_include_paths_str="${{ steps.get-self-packages.outputs.self-packages }}"
gcov_include_paths_str="${gcov_include_paths_str//"autoware"/"/__w/autoware.core/autoware.core/build/autoware"}"
echo "gcov_include_paths_str:$gcov_include_paths_str"
echo "gcov_include_paths="$gcov_include_paths_str"" >> $GITHUB_OUTPUT
rm "/__w/autoware.core/autoware.core/lcov/total_coverage.info.nofilt"
rm -r $gcov_ignore_paths_str
coverage_str="$gcov_include_paths_str""/coverage.info"
coverage_str="${coverage_str//" "/"/coverage.info "}"
coverage_base_str="$gcov_include_paths_str""/coverage_base.info"
coverage_base_str="${coverage_base_str//" "/"/coverage_base.info "}"
echo "coverage_str:$coverage_str"
echo "coverage_base_str:$coverage_base_str"
rm $coverage_str $coverage_base_str
shell: bash
- name: Upload coverage to CodeCov
if: ${{ steps.test.outputs.coverage-report-files != '' }}
uses: codecov/codecov-action@v4
with:
files: ${{ steps.test.outputs.coverage-report-files }}
fail_ci_if_error: false
verbose: true
flags: total
token: ${{ secrets.CODECOV_TOKEN }}
# gcov_args: -r
# gcov_include: ${{ steps.get-gcov-info.outputs.gcov_include_paths }}
# gcov_ignore: ${{ steps.get-gcov-info.outputs.gcov_ignore_paths }}
# working-directory: /__w/autoware.core/autoware.core
plugins: gcov
- name: Show disk space after the tasks
run: df -h
shell: bash