Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add pre-commit and overhaul the ci #28

Merged
merged 5 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: buildtest
name: build-and-test
on:
pull_request_target:
types: [ assigned, opened, synchronize, reopened ]
Expand All @@ -7,7 +7,7 @@ on:
workflow_dispatch:

jobs:
build_test:
build-and-test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/documentation_generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ name: documentation_generation
on:
push:
branches:
- master
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
- run: pip install mkdocs-material
- uses: actions/checkout@v4
- uses: actions/setup-python@v3
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
57 changes: 0 additions & 57 deletions .github/workflows/mirror_repository.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: pre-commit

on:
pull_request:
push:
branches: [ main ]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- uses: pre-commit/[email protected]
- uses: pre-commit-ci/[email protected]
if: always()
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,3 @@ crashlytics-build.properties

# JetBrains
.idea/

23 changes: 23 additions & 0 deletions .pre-commit-config-local.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: local
hooks:
- id: dotnet-format
name: dotnet-format
language: system
entry: dotnet format AWSIM.sln --include
types_or: [ "c#", "vb" ]

# https://github.com/Unity-Technologies/Unity-Robotics-Hub/blob/main/.pre-commit-config.yaml
exclude: >
(?x)^(
.*.css|
.*.meta|
.*.mat|
.*.preset|
.*.lighting|
.*.dae
.*.unity
.*.asset
.*.prefab
.*.controller
)$
41 changes: 41 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
ci:
autofix_commit_msg: "style(pre-commit): autofix"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
- id: mixed-line-ending
args: [ --fix=lf ]
- id: trailing-whitespace
args: [ --markdown-linebreak-ext=md ]
- id: check-yaml
args: [--unsafe]

- repo: local
hooks:
- id: dotnet-format
name: dotnet-format
language: system
entry: dotnet format whitespace
args:
- --folder
- --include
types_or: [ "c#", "vb" ]

# https://github.com/Unity-Technologies/Unity-Robotics-Hub/blob/main/.pre-commit-config.yaml
exclude: >
(?x)^(
.*.css|
.*.meta|
.*.mat|
.*.preset|
.*.lighting|
.*.dae|
.*.unity|
.*.asset|
.*.prefab|
.*.controller
)$
4 changes: 2 additions & 2 deletions .vsconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "1.0",
"components": [
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7162,4 +7162,3 @@
"w": 0.0
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class Configuration
void Awake()
{
// check if time source selector is present
if(timeSourceSelector == null)
if (timeSourceSelector == null)
{
Debug.LogWarning("TimeSource: There is no TimeSourceSelector object assigned in the inspector. The default time source will be used.");
}
Expand Down Expand Up @@ -103,4 +103,4 @@ void Awake()
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using UnityEngine;

namespace AWSIM.PointCloudMapping.Geometry {
namespace AWSIM.PointCloudMapping.Geometry
{
/// <summary>
/// Base class for paths for interpolated iterations along an array of point.
/// </summary>
/// <typeparam name="TPoint"></typeparam>
public abstract class Path<TPoint> {
public abstract class Path<TPoint>
{
/// <summary>
/// Get the length of the path.
/// </summary>
Expand All @@ -16,7 +18,8 @@ public abstract class Path<TPoint> {
/// </summary>
/// <param name="distance"></param>
/// <returns>Position of the point</returns>
public Vector3 this[float distance] {
public Vector3 this[float distance]
{
get => Point(distance);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class LaneletVisualizer
{
[SerializeField]
private Material material;

[SerializeField]
private float width;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private void Start()

var start = Time.realtimeSinceStartup;
capturePoseQueue = new Queue<Pose>(LaneletMapToPoses(laneletMap, captureLocationInterval));
var computeTimeMs = (Time.realtimeSinceStartup - start) * 1000f;
var computeTimeMs = (Time.realtimeSinceStartup - start) * 1000f;
Debug.Log($"Will visit {capturePoseQueue.Count} points; computed in {computeTimeMs} ms");

laneletVisualizer.Initialize(laneletMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void Awake()
}

// Empty function to make enable checkbox appear in the Inspector
public void Start() {}
public void Start() { }

public void Initialize(Vector3 worldOriginROS, string outputPcdFilePath)
{
Expand All @@ -67,11 +67,11 @@ public void Initialize(Vector3 worldOriginROS, string outputPcdFilePath)

// Create and connect subgraph
Matrix4x4 worldTransform = ROS2.Transformations.Unity2RosMatrix4x4();
worldTransform.SetColumn(3, worldTransform.GetColumn(3) + (Vector4) worldOriginROS);
worldTransform.SetColumn(3, worldTransform.GetColumn(3) + (Vector4)worldOriginROS);
rglSubgraphMapping = new RGLNodeSequence()
.AddNodePointsTransform(rosWorldTransformNodeId, worldTransform)
.AddNodePointsDownsample(downsampleNodeId, new Vector3(leafSize, leafSize, leafSize))
.AddNodePointsTemporalMerge(temporalMergeNodeId, new RGLField[1] {RGLField.XYZ_VEC3_F32});
.AddNodePointsTemporalMerge(temporalMergeNodeId, new RGLField[1] { RGLField.XYZ_VEC3_F32 });

rglSubgraphMapping.SetActive(downsampleNodeId, enableDownsampling);

Expand Down
Loading
Loading