From b94d84dc45a2f76837e4723f9815a5f5c9dd8c60 Mon Sep 17 00:00:00 2001 From: sciencewhiz Date: Mon, 3 Jun 2024 07:10:50 -0700 Subject: [PATCH 1/7] [ci] Add workflow to build java tools for PRs This can catch breaking changes earlier Builds linux only for speed Builds and publishes artifacts in this file as it was actually faster then reusing the artifacts from the gradle file as those need the combiner run on them. It uploads the artifacts to Actions with a 1 day retention, because that allows the tools to be built in parallel, which overall sped things up. This also only allows relevant tasks in wpilib to be run The tool builds are uploaded with a shorter retention time in case someone wants to do more extensive tests. --- .github/workflows/tools.yml | 144 ++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 .github/workflows/tools.yml diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml new file mode 100644 index 00000000000..a0d1d2479ca --- /dev/null +++ b/.github/workflows/tools.yml @@ -0,0 +1,144 @@ +name: Tools + +on: [pull_request, push] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +env: + YEAR: 2024 + +jobs: + build-artifacts: + name: "Build - WPILib" + runs-on: ubuntu-22.04 + env: + DISPLAY: ':10' + steps: + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + android: true + dotnet: true + haskell: true + large-packages: false + docker-images: false + swap-storage: false + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Build WPILib with Gradle + uses: addnab/docker-run-action@v3 + with: + image: wpilib/roborio-cross-ubuntu:2024-22.04 + options: -v ${{ github.workspace }}:/work -w /work -e GITHUB_REF -e CI -e DISPLAY + run: df . && rm -f semicolon_delimited_script && ./gradlew :wpilibc:publish :wpilibj:publish :wpilibNewCommands:publish :hal:publish :cameraserver:publish :ntcore:publish :cscore:publish :wpimath:publish :wpinet:publish :wpiutil:publish :apriltag:publish :wpiunits:publish :simulation:halsim_gui:publish :simulation:halsim_ds_socket:publish -x test -x Javadoc -x doxygen --build-cache && cp -r /root/releases/maven/development /work + - uses: actions/upload-artifact@v4 + with: + name: MavenArtifacts + path: | + development + retention-days: 1 + + Robotbuilder: + name: "Build - RobotBuilder" + needs: [build-artifacts] + runs-on: ubuntu-22.04 + env: + DISPLAY: ':10' + steps: + - uses: actions/checkout@v4 + with: + repository: wpilibsuite/robotbuilder + fetch-depth: 0 + - uses: actions/download-artifact@v4 + with: + name: MavenArtifacts + - name: Patch RobotBuilder to use local development + run: cd src/main/resources/export && echo "wpi.maven.useLocal = false" >> java/build.gradle && echo "wpi.maven.useFrcMavenLocalDevelopment = true" >> java/build.gradle && echo "wpi.versions.wpilibVersion = '$YEAR.424242.+'" >> java/build.gradle && echo "wpi.versions.wpimathVersion = '$YEAR.424242.+'" >> java/build.gradle && echo "wpi.maven.useLocal = false" >> cpp/build.gradle && echo "wpi.maven.useFrcMavenLocalDevelopment = true" >> cpp/build.gradle && echo "wpi.versions.wpilibVersion = '$YEAR.424242.+'" >> cpp/build.gradle && echo "wpi.versions.wpimathVersion = '$YEAR.424242.+'" >> cpp/build.gradle + - name: Install and runn xvfb + run: sudo apt-get update && sudo apt-get install -y xvfb && Xvfb :10 & + - name: Move artifacts + run: mkdir -p ~/releases/maven/development && cp -r edu ~/releases/maven/development + - uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + - name: Build RobotBuilder with Gradle + run: ./gradlew build test --tests 'robotbuilder.exporters.*' -x htmlSanityCheck -PbuildServer -PreleaseMode ; cd build/test-results/test ; cat TEST-robotbuilder.exporters.JavaExportTest.xml ; cat TEST-robotbuilder.exporters.CppExportTest.xml + - name: Summarize RobotBuilder Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + files: | + build/test-results/test/TEST*.xml + - uses: actions/upload-artifact@v4 + if: always() + with: + name: TestResults + path: | + build/reports/ + - uses: actions/upload-artifact@v4 + with: + name: RobotBuilder Build + path: | + build/libs/ + retention-days: 7 + + Shuffleboard: + name: "Build - Shuffleboard" + needs: [build-artifacts] + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + repository: wpilibsuite/shuffleboard + fetch-depth: 0 + - uses: actions/download-artifact@v4 + with: + name: MavenArtifacts + - uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + - name: Move artifacts + run: mkdir -p ~/releases/maven/development && cp -r edu ~/releases/maven/development + - name: Install dependencies + run: sudo apt-get install -y libgtk2.0-0 + - name: Build with Gradle + run: ./gradlew build -x Javadoc + - uses: actions/upload-artifact@v4 + with: + name: Shuffleboard Build + path: | + build/allOutputs/ + retention-days: 7 + + Pathweaver: + name: "Build - Pathweaver" + needs: [build-artifacts] + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + repository: wpilibsuite/Pathweaver + fetch-depth: 0 + - uses: actions/download-artifact@v4 + with: + name: MavenArtifacts + - uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + - name: Move artifacts + run: mkdir -p ~/releases/maven/development && cp -r edu ~/releases/maven/development + - name: Build with Gradle + run: ./gradlew build + - uses: actions/upload-artifact@v4 + with: + name: Pathweaver Build + path: | + build/allOutputs/ + retention-days: 7 From f763690f644cee45fd735d9523f72faaea785144 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sun, 2 Jun 2024 15:52:12 -0700 Subject: [PATCH 2/7] [upstream_utils] Fix gcem min and max compilation (#6689) --- ...001-Call-std-functions-if-not-constant-evaluated.patch | 8 ++++---- .../main/native/thirdparty/gcem/include/gcem_incl/max.hpp | 2 +- .../main/native/thirdparty/gcem/include/gcem_incl/min.hpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/upstream_utils/gcem_patches/0001-Call-std-functions-if-not-constant-evaluated.patch b/upstream_utils/gcem_patches/0001-Call-std-functions-if-not-constant-evaluated.patch index b7742f0e2b8..207359f6771 100644 --- a/upstream_utils/gcem_patches/0001-Call-std-functions-if-not-constant-evaluated.patch +++ b/upstream_utils/gcem_patches/0001-Call-std-functions-if-not-constant-evaluated.patch @@ -1454,14 +1454,14 @@ index af23ea21d247327fa224370544e5f4410eac214b..4c95110d627568577440e5e662e72fde + #endif diff --git a/include/gcem_incl/max.hpp b/include/gcem_incl/max.hpp -index ddc3e4e6caff1a781e662a3ded8909cb703729ab..9f3901b4b19eb35331cd22be16c5b3a1ab5f65d6 100644 +index ddc3e4e6caff1a781e662a3ded8909cb703729ab..258031508ec490b49c71dbf60f3c5669f4c7c380 100644 --- a/include/gcem_incl/max.hpp +++ b/include/gcem_incl/max.hpp @@ -21,6 +21,12 @@ #ifndef _gcem_max_HPP #define _gcem_max_HPP -+#include ++#include +#include + +namespace gcem @@ -1485,14 +1485,14 @@ index ddc3e4e6caff1a781e662a3ded8909cb703729ab..9f3901b4b19eb35331cd22be16c5b3a1 #endif diff --git a/include/gcem_incl/min.hpp b/include/gcem_incl/min.hpp -index 5ce70b38e6d243267a053ec33fae31e59f6a359f..a35bcf6e2cb65f8712b873d3ef2827aca2d4d0f0 100644 +index 5ce70b38e6d243267a053ec33fae31e59f6a359f..af1be618776413f8de8bcce5d56fc838ee5c968a 100644 --- a/include/gcem_incl/min.hpp +++ b/include/gcem_incl/min.hpp @@ -21,6 +21,12 @@ #ifndef _gcem_min_HPP #define _gcem_min_HPP -+#include ++#include +#include + +namespace gcem diff --git a/wpimath/src/main/native/thirdparty/gcem/include/gcem_incl/max.hpp b/wpimath/src/main/native/thirdparty/gcem/include/gcem_incl/max.hpp index 9f3901b4b19..258031508ec 100644 --- a/wpimath/src/main/native/thirdparty/gcem/include/gcem_incl/max.hpp +++ b/wpimath/src/main/native/thirdparty/gcem/include/gcem_incl/max.hpp @@ -21,7 +21,7 @@ #ifndef _gcem_max_HPP #define _gcem_max_HPP -#include +#include #include namespace gcem diff --git a/wpimath/src/main/native/thirdparty/gcem/include/gcem_incl/min.hpp b/wpimath/src/main/native/thirdparty/gcem/include/gcem_incl/min.hpp index a35bcf6e2cb..af1be618776 100644 --- a/wpimath/src/main/native/thirdparty/gcem/include/gcem_incl/min.hpp +++ b/wpimath/src/main/native/thirdparty/gcem/include/gcem_incl/min.hpp @@ -21,7 +21,7 @@ #ifndef _gcem_min_HPP #define _gcem_min_HPP -#include +#include #include namespace gcem From 4e2ec7d7025cc6db2c2a82bc6cf6db8d203d1851 Mon Sep 17 00:00:00 2001 From: sciencewhiz Date: Sun, 2 Jun 2024 21:00:43 -0700 Subject: [PATCH 3/7] [ci] Update cmake actions to node 20 versions (#6692) --- .github/workflows/cmake.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index e0e56438f49..f85b73b2041 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -45,7 +45,7 @@ jobs: python-version: '3.10' - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.3 + uses: mozilla-actions/sccache-action@v0.0.4 - name: Install jinja run: python -m pip install jinja2 @@ -74,10 +74,10 @@ jobs: - uses: ilammy/msvc-dev-cmd@v1 - name: Install CMake - uses: lukka/get-cmake@v3.27.6 + uses: lukka/get-cmake@v3.29.3 - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.3 + uses: mozilla-actions/sccache-action@v0.0.4 - name: Install jinja run: python -m pip install jinja2 @@ -85,7 +85,7 @@ jobs: - uses: actions/checkout@v4 - name: Run vcpkg - uses: lukka/run-vcpkg@v11.1 + uses: lukka/run-vcpkg@v11.5 with: vcpkgDirectory: ${{ runner.workspace }}/vcpkg vcpkgGitCommitId: 37c3e63a1306562f7f59c4c3c8892ddd50fdf992 # HEAD on 2024-02-24 From 0910a85d0cbfc627113139eb061f1dc1032cfbcb Mon Sep 17 00:00:00 2001 From: sciencewhiz Date: Sun, 2 Jun 2024 21:44:39 -0700 Subject: [PATCH 4/7] [fieldImages] Move Java fields to edu.wpi.first.fields (#6694) Doesn't make sense in edu.wpi.fields, and resources are already in edu.wpi.first.fields This will require changes in Shuffleboard and Pathweaver --- .../src/main/java/edu/wpi/{ => first}/fields/FieldConfig.java | 2 +- .../src/main/java/edu/wpi/{ => first}/fields/Fields.java | 2 +- .../test/java/edu/wpi/{ => first}/fields/LoadConfigTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename fieldImages/src/main/java/edu/wpi/{ => first}/fields/FieldConfig.java (98%) rename fieldImages/src/main/java/edu/wpi/{ => first}/fields/Fields.java (97%) rename fieldImages/src/test/java/edu/wpi/{ => first}/fields/LoadConfigTest.java (95%) diff --git a/fieldImages/src/main/java/edu/wpi/fields/FieldConfig.java b/fieldImages/src/main/java/edu/wpi/first/fields/FieldConfig.java similarity index 98% rename from fieldImages/src/main/java/edu/wpi/fields/FieldConfig.java rename to fieldImages/src/main/java/edu/wpi/first/fields/FieldConfig.java index d8752c64b98..0fc32b8b7ce 100644 --- a/fieldImages/src/main/java/edu/wpi/fields/FieldConfig.java +++ b/fieldImages/src/main/java/edu/wpi/first/fields/FieldConfig.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package edu.wpi.fields; +package edu.wpi.first.fields; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/fieldImages/src/main/java/edu/wpi/fields/Fields.java b/fieldImages/src/main/java/edu/wpi/first/fields/Fields.java similarity index 97% rename from fieldImages/src/main/java/edu/wpi/fields/Fields.java rename to fieldImages/src/main/java/edu/wpi/first/fields/Fields.java index a92cfb0f5c3..b282bffd546 100644 --- a/fieldImages/src/main/java/edu/wpi/fields/Fields.java +++ b/fieldImages/src/main/java/edu/wpi/first/fields/Fields.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package edu.wpi.fields; +package edu.wpi.first.fields; public enum Fields { k2018PowerUp("2018-powerup.json"), diff --git a/fieldImages/src/test/java/edu/wpi/fields/LoadConfigTest.java b/fieldImages/src/test/java/edu/wpi/first/fields/LoadConfigTest.java similarity index 95% rename from fieldImages/src/test/java/edu/wpi/fields/LoadConfigTest.java rename to fieldImages/src/test/java/edu/wpi/first/fields/LoadConfigTest.java index f4f162175b4..bb01d9f55ac 100644 --- a/fieldImages/src/test/java/edu/wpi/fields/LoadConfigTest.java +++ b/fieldImages/src/test/java/edu/wpi/first/fields/LoadConfigTest.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package edu.wpi.fields; +package edu.wpi.first.fields; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; From ce33faa7abf1b5fb12ec8fa7c0444e5f9f142dad Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sun, 2 Jun 2024 21:45:02 -0700 Subject: [PATCH 5/7] [wpimath] Make unit max and min constexpr (#6690) --- wpimath/src/main/native/include/units/base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wpimath/src/main/native/include/units/base.h b/wpimath/src/main/native/include/units/base.h index e7333a91ee4..0e9ae23768e 100644 --- a/wpimath/src/main/native/include/units/base.h +++ b/wpimath/src/main/native/include/units/base.h @@ -3408,7 +3408,7 @@ namespace units { // the "_min" user-defined literal in time.h. template - UnitTypeLhs (min)(const UnitTypeLhs& lhs, const UnitTypeRhs& rhs) + constexpr UnitTypeLhs (min)(const UnitTypeLhs& lhs, const UnitTypeRhs& rhs) { static_assert(traits::is_convertible_unit_t::value, "Unit types are not compatible."); UnitTypeLhs r(rhs); @@ -3416,7 +3416,7 @@ namespace units { } template - UnitTypeLhs (max)(const UnitTypeLhs& lhs, const UnitTypeRhs& rhs) + constexpr UnitTypeLhs (max)(const UnitTypeLhs& lhs, const UnitTypeRhs& rhs) { static_assert(traits::is_convertible_unit_t::value, "Unit types are not compatible."); UnitTypeLhs r(rhs); From 28b93100ee3d6aebf47564fc4396836c8ce07178 Mon Sep 17 00:00:00 2001 From: Wispy <101812473+WispySparks@users.noreply.github.com> Date: Mon, 3 Jun 2024 09:47:17 -0500 Subject: [PATCH 6/7] [wpilib] Compressor: Add more Sendable data (#6687) --- wpilibc/src/main/native/cpp/Compressor.cpp | 15 ++++++++++++++- wpilibc/src/main/native/include/frc/Compressor.h | 1 + .../java/edu/wpi/first/wpilibj/Compressor.java | 7 +++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/wpilibc/src/main/native/cpp/Compressor.cpp b/wpilibc/src/main/native/cpp/Compressor.cpp index 1f6c906820f..1306561fcba 100644 --- a/wpilibc/src/main/native/cpp/Compressor.cpp +++ b/wpilibc/src/main/native/cpp/Compressor.cpp @@ -4,6 +4,8 @@ #include "frc/Compressor.h" +#include + #include #include #include @@ -14,7 +16,8 @@ using namespace frc; Compressor::Compressor(int module, PneumaticsModuleType moduleType) - : m_module{PneumaticsBase::GetForType(module, moduleType)} { + : m_module{PneumaticsBase::GetForType(module, moduleType)}, + m_moduleType{moduleType} { if (!m_module->ReserveCompressor()) { throw FRC_MakeError(err::ResourceAlreadyAllocated, "{}", module); } @@ -82,4 +85,14 @@ void Compressor::InitSendable(wpi::SendableBuilder& builder) { "Enabled", [this] { return IsEnabled(); }, nullptr); builder.AddBooleanProperty( "Pressure switch", [this] { return GetPressureSwitchValue(); }, nullptr); + builder.AddDoubleProperty( + "Current (A)", [this] { return GetCurrent().value(); }, nullptr); + // These are not supported by the CTRE PCM + if (m_moduleType == PneumaticsModuleType::REVPH) { + builder.AddDoubleProperty( + "Analog Voltage", [this] { return GetAnalogVoltage().value(); }, + nullptr); + builder.AddDoubleProperty( + "Pressure (PSI)", [this] { return GetPressure().value(); }, nullptr); + } } diff --git a/wpilibc/src/main/native/include/frc/Compressor.h b/wpilibc/src/main/native/include/frc/Compressor.h index ed1b3b986ce..d9bff841001 100644 --- a/wpilibc/src/main/native/include/frc/Compressor.h +++ b/wpilibc/src/main/native/include/frc/Compressor.h @@ -175,6 +175,7 @@ class Compressor : public wpi::Sendable, private: std::shared_ptr m_module; + PneumaticsModuleType m_moduleType; }; } // namespace frc diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Compressor.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Compressor.java index e7a14bd659a..38dee091285 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Compressor.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Compressor.java @@ -24,6 +24,7 @@ */ public class Compressor implements Sendable, AutoCloseable { private PneumaticsBase m_module; + private PneumaticsModuleType m_moduleType; /** * Constructs a compressor for a specified module and type. @@ -34,6 +35,7 @@ public class Compressor implements Sendable, AutoCloseable { @SuppressWarnings("this-escape") public Compressor(int module, PneumaticsModuleType moduleType) { m_module = PneumaticsBase.getForType(module, moduleType); + m_moduleType = moduleType; if (!m_module.reserveCompressor()) { m_module.close(); @@ -194,5 +196,10 @@ public void initSendable(SendableBuilder builder) { builder.setSmartDashboardType("Compressor"); builder.addBooleanProperty("Enabled", this::isEnabled, null); builder.addBooleanProperty("Pressure switch", this::getPressureSwitchValue, null); + builder.addDoubleProperty("Current (A)", this::getCurrent, null); + if (m_moduleType == PneumaticsModuleType.REVPH) { // These are not supported by the CTRE PCM + builder.addDoubleProperty("Analog Voltage", this::getAnalogVoltage, null); + builder.addDoubleProperty("Pressure (PSI)", this::getPressure, null); + } } } From d8cba5345eaa53bd36d3c1ed17cd58ddea343ee4 Mon Sep 17 00:00:00 2001 From: sciencewhiz Date: Tue, 4 Jun 2024 11:19:05 -0700 Subject: [PATCH 7/7] Fix review comments --- .github/workflows/tools.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index a0d1d2479ca..94a3d70c5ac 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -58,8 +58,8 @@ jobs: name: MavenArtifacts - name: Patch RobotBuilder to use local development run: cd src/main/resources/export && echo "wpi.maven.useLocal = false" >> java/build.gradle && echo "wpi.maven.useFrcMavenLocalDevelopment = true" >> java/build.gradle && echo "wpi.versions.wpilibVersion = '$YEAR.424242.+'" >> java/build.gradle && echo "wpi.versions.wpimathVersion = '$YEAR.424242.+'" >> java/build.gradle && echo "wpi.maven.useLocal = false" >> cpp/build.gradle && echo "wpi.maven.useFrcMavenLocalDevelopment = true" >> cpp/build.gradle && echo "wpi.versions.wpilibVersion = '$YEAR.424242.+'" >> cpp/build.gradle && echo "wpi.versions.wpimathVersion = '$YEAR.424242.+'" >> cpp/build.gradle - - name: Install and runn xvfb - run: sudo apt-get update && sudo apt-get install -y xvfb && Xvfb :10 & + - name: Install and run xvfb + run: sudo apt-get update && sudo apt-get install -y xvfb && Xvfb $DISPLAY & - name: Move artifacts run: mkdir -p ~/releases/maven/development && cp -r edu ~/releases/maven/development - uses: actions/setup-java@v4 @@ -67,7 +67,7 @@ jobs: java-version: 17 distribution: 'temurin' - name: Build RobotBuilder with Gradle - run: ./gradlew build test --tests 'robotbuilder.exporters.*' -x htmlSanityCheck -PbuildServer -PreleaseMode ; cd build/test-results/test ; cat TEST-robotbuilder.exporters.JavaExportTest.xml ; cat TEST-robotbuilder.exporters.CppExportTest.xml + run: ./gradlew build test --tests 'robotbuilder.exporters.*' -x htmlSanityCheck -PbuildServer -PreleaseMode ; cat build/test-results/test/TEST-robotbuilder.exporters.*.xml ; - name: Summarize RobotBuilder Test Results uses: EnricoMi/publish-unit-test-result-action@v2 if: always()