米子練習会の変更の差分監視 #1510
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 test | |
on: | |
workflow_dispatch: | |
pull_request: | |
merge_group: | |
jobs: | |
job: | |
name: BuildAndRun | |
runs-on: >- | |
${{ | |
(contains(github.event.pull_request.labels.*.name, 'SelfHostedRunner')) | |
&& fromJSON('[ "self-hosted"]') | |
|| fromJSON('[ "ubuntu-latest" ]') | |
}} | |
timeout-minutes: 30 | |
container: ghcr.io/ibis-ssl/crane:base | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
strategy: | |
fail-fast: false | |
matrix: | |
rosdistro: [humble] | |
steps: | |
- name: suppress warnings | |
run: | | |
git config --global --add safe.directory '*' | |
- name: Set PR fetch depth | |
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}" | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: ${{ env.PR_FETCH_DEPTH }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Problem Matchers for GCC | |
run: echo "::add-matcher::.github/matchers/gcc.json" | |
- name: Setup Problem Matchers for clang-format | |
if: steps.get-modified-packages.outputs.modified-packages != '' | |
run: echo "::add-matcher::.github/matchers/clang-format.json" | |
- name: Get modified packages | |
id: get-modified-packages | |
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1 | |
- name: Set git config | |
uses: autowarefoundation/autoware-github-actions/set-git-config@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clone dependency packages | |
run: | | |
mkdir -p dependency_ws | |
vcs import dependency_ws < dependency_${{ matrix.rosdistro }}.repos | |
shell: bash | |
- name: Run rosdep install | |
run: | | |
package_paths=$(colcon list -p --packages-above-and-dependencies ${{ steps.get-modified-packages.outputs.modified-packages }} --base-paths . dependency_ws) | |
sudo apt-get -yqq update | |
rosdep update | |
DEBIAN_FRONTEND=noninteractive rosdep install -yqq --from-paths ${package_paths} --ignore-src --rosdistro ${{ matrix.rosdistro }} | |
shell: bash | |
- name: Set up colcon-mixin | |
run: | | |
colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml || true | |
colcon mixin update default | |
shell: bash | |
- name: Build | |
run: | | |
. /opt/ros/${{ matrix.rosdistro }}/setup.sh | |
colcon build --event-handlers console_cohesion+ \ | |
--packages-above-and-dependencies ${{ steps.get-modified-packages.outputs.modified-packages }} \ | |
--cmake-args -DCMAKE_BUILD_TYPE=Release \ | |
--mixin coverage-gcc coverage-pytest compile-commands | |
shell: bash | |
- name: Cache build artifacts | |
uses: actions/cache@v4 | |
with: | |
path: | | |
./build | |
./install | |
key: build-${{ matrix.rosdistro }}-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }} | |
- name: Test | |
id: test | |
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }} | |
uses: autowarefoundation/autoware-github-actions/colcon-test@v1 | |
with: | |
rosdistro: ${{ matrix.rosdistro }} | |
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }} | |
build-depends-repos: dependency_${{ matrix.rosdistro }}.repos |