Replace Jenkins with Azure agent (#1914)

This commit is contained in:
Austin Shalit
2019-11-26 01:00:35 -05:00
committed by Peter Johnson
parent b67d049ac2
commit e49494830f
4 changed files with 63 additions and 28 deletions

View File

@@ -1,19 +1,46 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'
- script: |
echo Add other tasks to build, test, and deploy your project.
echo See https://aka.ms/yaml
displayName: 'Run a multi-line script'
# Testing steps for real hardware
trigger:
batch: true
branches:
include:
- master
jobs:
- job: TestBench
pool: RoboRioConnections
timeoutInMinutes: 60
workspace:
clean: all
steps:
- task: Gradle@2
condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v')))
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
publishJUnitResults: false
testResultsFiles: '**/TEST-*.xml'
tasks: 'copyWpilibJIntegrationTestJarToOutput copyWpilibCTestLibrariesToOutput'
options: '-Ponlylinuxathena -PbuildServer'
- task: ShellScript@2
displayName: Run Tests & Get Results
inputs:
scriptPath: test-scripts/jenkins-run-tests-get-results.sh
- task: PublishTestResults@2
displayName: Publish C++ Test Results
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'cpp*.xml'
testRunTitle: 'C++ Test Report'
searchFolder: '$(System.DefaultWorkingDirectory)/test-reports'
- task: PublishTestResults@2
displayName: Publish Java Test Results
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'java*.xml'
testRunTitle: 'Java Test Report'
searchFolder: '$(System.DefaultWorkingDirectory)/test-reports'

View File

@@ -31,7 +31,7 @@ DEFAULT_DESTINATION_CPP_TEST_RESULTS=${DEFAULT_DESTINATION_TEST_RESULTS_DIR}/${C
DEFAULT_JAVA_TEST_NAME=FRCUserProgram.jar
DEFAULT_JAVA_TEST_ARGS=""
DEFAULT_LOCAL_JAVA_TEST_FILE=../build/integrationTestFiles/java/wpilibjIntegrationTests.jar
DEFAULT_LOCAL_JAVA_TEST_FILE=../build/integrationTestFiles/java/wpilibjIntegrationTests-all.jar
JAVA_REPORT=javareport.xml
DEFAULT_LIBRARY_NATIVE_FILES=../build/integrationTestFiles/libs

View File

@@ -5,6 +5,8 @@
/* the project. */
/*----------------------------------------------------------------------------*/
#include <algorithm>
#include "TestBench.h"
#include "frc/Encoder.h"
#include "frc/Jaguar.h"
@@ -146,7 +148,8 @@ TEST_P(MotorEncoderTest, PositionPIDController) {
/* 10 seconds should be plenty time to get to the reference */
frc::Notifier pidRunner{[this, &pidController] {
m_speedController->Set(pidController.Calculate(m_encoder->GetDistance()));
auto speed = pidController.Calculate(m_encoder->GetDistance());
m_speedController->Set(std::clamp(speed, -0.2, 0.2));
}};
pidRunner.StartPeriodic(pidController.GetPeriod());
Wait(10.0);
@@ -171,9 +174,9 @@ TEST_P(MotorEncoderTest, VelocityPIDController) {
/* 10 seconds should be plenty time to get to the reference */
frc::Notifier pidRunner{[this, &pidController] {
m_speedController->Set(
pidController.Calculate(m_filter->Calculate(m_encoder->GetRate())) +
8e-5);
auto speed =
pidController.Calculate(m_filter->Calculate(m_encoder->GetRate()));
m_speedController->Set(std::clamp(speed, -0.3, 0.3));
}};
pidRunner.StartPeriodic(pidController.GetPeriod());
Wait(10.0);

View File

@@ -23,6 +23,7 @@ import edu.wpi.first.wpilibj.controller.PIDController;
import edu.wpi.first.wpilibj.fixtures.MotorEncoderFixture;
import edu.wpi.first.wpilibj.test.AbstractComsSetup;
import edu.wpi.first.wpilibj.test.TestBench;
import edu.wpi.first.wpiutil.math.MathUtils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -181,8 +182,10 @@ public class MotorEncoderTest extends AbstractComsSetup {
pidController.setIntegratorRange(-0.2, 0.2);
pidController.setSetpoint(1000);
Notifier pidRunner = new Notifier(
() -> me.getMotor().set(pidController.calculate(me.getEncoder().getDistance())));
Notifier pidRunner = new Notifier(() -> {
var speed = pidController.calculate(me.getEncoder().getDistance());
me.getMotor().set(MathUtils.clamp(speed, -0.2, 0.2));
});
pidRunner.startPeriodic(pidController.getPeriod());
Timer.delay(10.0);
@@ -202,8 +205,10 @@ public class MotorEncoderTest extends AbstractComsSetup {
pidController.setTolerance(200);
pidController.setSetpoint(600);
Notifier pidRunner =
new Notifier(() -> me.getMotor().set(filter.calculate(me.getEncoder().getRate()) + 8e-5));
Notifier pidRunner = new Notifier(() -> {
var speed = filter.calculate(me.getEncoder().getRate());
me.getMotor().set(MathUtils.clamp(speed, -0.3, 0.3));
});
pidRunner.startPeriodic(pidController.getPeriod());
Timer.delay(10.0);