test(rate_checker): add unit tests (#269) #1800
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: build-and-test | |
on: | |
push: | |
schedule: | |
- cron: 0 0 * * * | |
workflow_dispatch: | |
jobs: | |
build-and-test: | |
if: ${{ github.event_name != 'push' || github.ref_name == github.event.repository.default_branch }} | |
runs-on: ubuntu-latest | |
container: ${{ matrix.container }} | |
strategy: | |
fail-fast: false | |
matrix: | |
rosdistro: | |
- humble | |
include: | |
- rosdistro: humble | |
container: ros:humble | |
build-depends-repos: build_depends.repos | |
env: | |
CCACHE_DIR: /root/.ccache | |
CCACHE_SIZE: 1G # The GitHub cache action allows for 10G but the runners' disk space is limited | |
CC: /usr/lib/ccache/gcc | |
CXX: /usr/lib/ccache/g++ | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Free disk space (Ubuntu) | |
uses: jlumbroso/free-disk-space@v1.2.0 | |
with: | |
tool-cache: false | |
dotnet: false | |
swap-storage: false | |
large-packages: false | |
- 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: Install ccache | |
run: sudo apt-get update && sudo apt-get install -y ccache | |
shell: bash | |
- name: Create ccache directory | |
run: | | |
mkdir -p ${CCACHE_DIR} | |
du -sh ${CCACHE_DIR} && ccache -s | |
shell: bash | |
- name: Limit ccache size | |
run: | | |
rm -f "${CCACHE_DIR}/ccache.conf" | |
echo -e "max_size = ${CCACHE_SIZE}" > "${CCACHE_DIR}/ccache.conf" | |
shell: bash | |
- name: Attempt to restore ccache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ccache-${{ runner.arch }}-${{ matrix.rosdistro }}-${{ github.run_id }}-${{ github.run_attempt }} | |
restore-keys: | | |
ccache-${{ runner.arch }}-${{ matrix.rosdistro }}- | |
- 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: ${{ matrix.rosdistro }} | |
target-packages: ${{ steps.get-self-packages.outputs.self-packages }} | |
build-depends-repos: ${{ matrix.build-depends-repos }} | |
- name: Show ccache stats after build | |
run: | | |
du -sh ${CCACHE_DIR} && ccache -s | |
shell: bash | |
- name: Upload ccache to cache | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ccache-${{ runner.arch }}-${{ matrix.rosdistro }}-${{ github.run_id }}-${{ github.run_attempt }} | |
- name: Test | |
if: ${{ steps.get-self-packages.outputs.self-packages != '' }} | |
id: test | |
uses: autowarefoundation/autoware-github-actions/colcon-test@v1 | |
with: | |
rosdistro: ${{ matrix.rosdistro }} | |
target-packages: ${{ steps.get-self-packages.outputs.self-packages }} | |
build-depends-repos: ${{ matrix.build-depends-repos }} | |
- 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 }} | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: false | |
verbose: true | |
flags: total |