-
Notifications
You must be signed in to change notification settings - Fork 21
146 lines (133 loc) · 4.7 KB
/
ci_msbuild.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# 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 }}