Skip to content

Merge pull request #329 from Yaskawa-Global/dependabot/github_actions… #416

Merge pull request #329 from Yaskawa-Global/dependabot/github_actions…

Merge pull request #329 from Yaskawa-Global/dependabot/github_actions… #416

Workflow file for this run

# SPDX-FileCopyrightText: 2023, Yaskawa America, Inc.
# SPDX-FileCopyrightText: 2023, Delft University of Technology
#
# SPDX-License-Identifier: CC0-1.0
name: "CI: build VS proj"
on:
# MSBuild CI only runs for PRs originating from this repository (due to
# access to secrets). Enable CI runs on pushes to the 'main' branch, to
# make sure MSBuild CI also gets run for contributions from external
# repositories (after the PR has been merged, but it might still catch
# problems that slipped past reviewers)
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
msbuild_filter:
runs-on: ubuntu-latest
outputs:
needs_msbuild: ${{ steps.paths_filter.outputs.vsproj }}
steps:
- name: Checkout MotoROS2
uses: actions/checkout@v4
- name: Check VS proj has changed
id: paths_filter
uses: dorny/paths-filter@v3
with:
filters: |
vsproj:
- 'src/**'
- 'lib/**'
- 'MotoROS2.sln'
msbuild:
runs-on: windows-2022
needs: msbuild_filter
# only run this job if:
# - this is a manually triggered build, or
# - it's a PR and:
# - source files were changed,
# - AND the PR came from a feature branch on the main repository
if: |
github.event_name == 'workflow_dispatch' ||
(
needs.msbuild_filter.outputs.needs_msbuild == 'true' &&
github.event.pull_request.head.repo.full_name == github.repository
)
strategy:
# keep jobs running even if one fails (we want to know on which
# controllers and for which ROS 2 versions builds fail / succeed)
fail-fast: false
matrix:
controller: [dx200, yrc1000, yrc1000u]
# officially matrix doesn't support non-scalar values, but it does
# seem to work, so let's use it.
uros: [
{ release: 20240917, codename: foxy },
{ release: 20240917, codename: galactic },
{ release: 20240917, codename: humble },
]
steps:
- name: Uppercase controller identifier
id: uppercaser
shell: bash
env:
TEMP_VAR: "${{ matrix.controller }}"
run: |
echo "ctrlr=${TEMP_VAR^^}" >> $GITHUB_OUTPUT
- name: Checkout MotoROS2
uses: actions/checkout@v4
with:
path: 'motoros2'
- name: Find MSBuild and add to PATH
uses: microsoft/setup-msbuild@v2
- name: Generate token (micro_ros_motoplus)
id: gen_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.MPLMB_APP_ID }}
private-key: ${{ secrets.MPLMB_APP_PRIVATE_KEY }}
owner: "yaskawa-global"
repositories: "micro_ros_motoplus"
- name: "Download M+ libmicroros (${{ matrix.uros.codename }}-${{ matrix.uros.release }} for ${{ steps.uppercaser.outputs.ctrlr }})"
shell: bash
env:
GITHUB_TOKEN: ${{ steps.gen_token.outputs.token }}
RELEASE_TYPE: ${{ (matrix.uros.prerelease && 'prerelease') || 'release' }}
run: |
gh \
release \
--repo="yaskawa-global/micro_ros_motoplus" \
download \
--pattern="micro_ros_motoplus*.zip" \
--output="micro_ros_motoplus.zip" \
${{ env.RELEASE_TYPE }}-${{ matrix.uros.codename }}-${{ matrix.controller }}-${{ matrix.uros.release }}
- name: Setup MotoROS2 build dir
shell: bash
run: |
mkdir -p /c/build
rm -rf /c/build/*
# we do this to shorten the path. Windows/M+ SDK sometimes does
cp -r "${{ github.workspace }}"/* /c/build/
ls -al /c/build
- name: Extract M+ libmicroros distribution
shell: bash
run: |
unzip -q /c/build/micro_ros_motoplus.zip \
-d /c/build/motoros2/libmicroros_${{ matrix.controller }}_${{ matrix.uros.codename }}
- name: Download and setup M+ SDK (mpBuilder)
shell: cmd
run: |
C:\msys64\usr\bin\wget.exe -q -O C:/build/mpsdk_ci.7z "${{ secrets.MPSDK_DOWNLOAD_URL }}"
"C:\Program Files\7-Zip\7z.exe" x C:/build/mpsdk_ci.7z -oC:/build/
del /q C:\build\mpsdk_ci.7z
- name: Add M+ SDK to PATH
shell: bash
run: echo "C:/build/mpsdk" >> $GITHUB_PATH
- name: "Build MotoROS2 (config: ${{ steps.uppercaser.outputs.ctrlr }}_${{ matrix.uros.codename }})"
shell: cmd
env:
MP_VS_Install: "C:/build/mpsdk/"
WIND_BASE: "C:/"
WIND_HOST_TYPE: "x86-win32"
WIND_USR: "C:/"
run: |
msbuild ^
C:\build\motoros2\MotoROS2.sln ^
-t:Build ^
-nologo ^
-v:minimal ^
-p:Configuration=${{ steps.uppercaser.outputs.ctrlr }}_${{ matrix.uros.codename }}