-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
125 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Rust | ||
name: Ubuntu | ||
|
||
on: | ||
push: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
name: Windows | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build-windows: | ||
strategy: | ||
matrix: | ||
ros_distribution: | ||
- foxy | ||
runs-on: windows-2019 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup ROS environment | ||
uses: ros-tooling/setup-ros@v0.3 | ||
with: | ||
required-ros-distributions: ${{ matrix.ros_distribution }} | ||
|
||
- name: Search packages in this repository | ||
id: list_packages | ||
run: | | ||
echo ::set-output name=package_list::$(colcon list --names-only) | ||
shell: bash | ||
|
||
- name: Setup Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
components: clippy, rustfmt | ||
|
||
- name: Install colcon-cargo and colcon-ros-cargo | ||
run: | | ||
pip install git+https://github.com/colcon/colcon-cargo.git | ||
pip install git+https://github.com/colcon/colcon-ros-cargo.git@fix_windows | ||
shell: bash | ||
|
||
- name: Check formatting of Rust packages | ||
run: | | ||
for path in $(colcon list | awk '$3 == "(ament_cargo)" { print $2 }'); do | ||
cd $path | ||
cargo fmt -- --check | ||
cd - | ||
done | ||
shell: bash | ||
|
||
- name: Install cargo-ament-build | ||
run: | | ||
cargo install --debug cargo-ament-build | ||
- name: Add clang path to $LIBCLANG_PATH env var | ||
run: | | ||
Get-ChildItem C:\msys64\mingw64\bin | ||
Test-Path -Path C:\msys64\mingw64\bin\libclang.dll -PathType Leaf | ||
echo "LIBCLANG_PATH=C:/msys64/mingw64/bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
- name: Set LIBCLANG_PATH | ||
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV | ||
|
||
- name: Echo $LIBCLANG_PATH (powershell) | ||
run: | | ||
Get-Item Env:LIBCLANG_PATH | ||
- name: Echo $LIBCLANG_PATH (bash) | ||
shell: bash | ||
run: | | ||
echo $LIBCLANG_PATH | ||
- name: Build and test | ||
id: build | ||
uses: ros-tooling/action-ros-ci@v0.2 | ||
with: | ||
package-name: ${{ steps.list_packages.outputs.package_list }} | ||
target-ros2-distro: ${{ matrix.ros_distribution }} | ||
vcs-repo-file-url: ros2_rust_${{ matrix.ros_distribution }}.repos | ||
|
||
- name: Run clippy on Rust packages | ||
run: | | ||
cd ${{ steps.build.outputs.ros-workspace-directory-name }} | ||
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh | ||
for path in $(colcon list | awk '$3 == "(ament_cargo)" { print $2 }'); do | ||
cd $path | ||
echo "Running clippy in $path" | ||
cargo clippy --all-targets --all-features -- -D warnings | ||
cd - | ||
done | ||
shell: bash | ||
|
||
- name: Run cargo test on Rust packages | ||
run: | | ||
cd ${{ steps.build.outputs.ros-workspace-directory-name }} | ||
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh | ||
for path in $(colcon list | awk '$3 == "(ament_cargo)" && $1 != "examples_rclrs_minimal_pub_sub" && $1 != "examples_rclrs_minimal_client_service" { print $2 }'); do | ||
cd $path | ||
echo "Running cargo test in $path" | ||
cargo test | ||
cd - | ||
done | ||
shell: bash | ||
|
||
- name: Rustdoc check | ||
run: | | ||
cd ${{ steps.build.outputs.ros-workspace-directory-name }} | ||
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh | ||
for path in $(colcon list | awk '$3 == "(ament_cargo)" && $1 != "examples_rclrs_minimal_pub_sub" && $1 != "examples_rclrs_minimal_client_service" { print $2 }'); do | ||
cd $path | ||
echo "Running rustdoc check in $path" | ||
cargo rustdoc -- -D warnings | ||
cd - | ||
done | ||
shell: bash |
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