Skip to content

Commit

Permalink
refactor: Change default branch from master to main and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
j3soon committed Aug 21, 2024
1 parent aae39be commit 7bf287e
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-cartographer-ws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Docker Image for cartographer-ws
on:
push:
branches:
- "master"
- "main"
paths:
- .github/workflows/build-cartographer-ws.yaml
- cartographer_ws/docker/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-husky-ws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Docker Image for husky-ws
on:
push:
branches:
- "master"
- "main"
paths:
- .github/workflows/build-husky-ws.yaml
- husky_ws/docker/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-kobuki-ws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Docker Image for kobuki-ws
on:
push:
branches:
- "master"
- "main"
paths:
- .github/workflows/build-kobuki-ws.yaml
- kobuki_ws/docker/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-orbslam3-ws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Docker Image for orbslam3-ws
on:
push:
branches:
- "master"
- "main"
paths:
- .github/workflows/build-orbslam3-ws.yaml
- orbslam3_ws/docker/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-ros1-bridge-ws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Docker Image for ros1-bridge-ws
on:
push:
branches:
- "master"
- "main"
paths:
- .github/workflows/build-ros1-bridge-ws.yaml
- ros1_bridge_ws/docker/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-rtabmap-ws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Docker Image for rtabmap-ws
on:
push:
branches:
- "master"
- "main"
paths:
- .github/workflows/build-rtabmap-ws.yaml
- rtabmap_ws/docker/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-template-ws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Docker Image for template-ws
on:
push:
branches:
- "master"
- "main"
paths:
- .github/workflows/build-template-ws.yaml
- template_ws/docker/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-vlp-ws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Docker Image for vlp-ws
on:
push:
branches:
- "master"
- "main"
paths:
- .github/workflows/build-vlp-ws.yaml
- vlp_ws/docker/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion husky_ws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ To maintain reproducibility, we have frozen the following packages at specific c
* [clearpathrobotics/clearpath_computer_installer](https://github.com/clearpathrobotics/clearpath_computer_installer) (at commit 7e7f415) is released under the [BSD-3-Clause License](https://github.com/clearpathrobotics/clearpath_computer_installer/blob/main/LICENSE).
* [clearpathrobotics/clearpath_robot/clearpath_robot/debian/udev](https://github.com/clearpathrobotics/clearpath_robot/blob/17d55f1b27d3fe19fb82e7df64dca96dbd345837/clearpath_robot/debian/udev) (at commit 17d55f1) is released under the [BSD 3-Clause License](https://github.com/clearpathrobotics/clearpath_robot/blob/17d55f1b27d3fe19fb82e7df64dca96dbd345837/LICENSE).

Further changes based on the packages above are release under the [Apache-2.0 License](https://github.com/j3soon/ros2-essentials/blob/master/LICENSE), as stated in the repository.
Further changes based on the packages above are release under the [Apache-2.0 License](https://github.com/j3soon/ros2-essentials/blob/main/LICENSE), as stated in the repository.
16 changes: 13 additions & 3 deletions tests/lint_filenames.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os
import glob

current_dir = os.path.dirname(os.path.realpath(__file__))
repo_dir = os.path.realpath(f"{current_dir}/..")

# Check if all default files exist
DEFAULT_FILES = [
".gitignore",
Expand All @@ -11,8 +14,6 @@
"docker/Dockerfile",
".devcontainer/devcontainer.json",
]
current_dir = os.path.dirname(os.path.realpath(__file__))
repo_dir = os.path.realpath(f"{current_dir}/..")
for filename in DEFAULT_FILES:
print(f"Checking existence of: '{filename}'...")
for workspace_path in glob.glob(f"{repo_dir}/*_ws"):
Expand All @@ -31,6 +32,15 @@
content = f.read()
if "version:" in content:
# Ref: https://docs.docker.com/compose/compose-file/04-version-and-name/#version-top-level-element-optional
raise ValueError(f"version should not exist since it's obsolete: '{filename}'")
raise ValueError(f"`version` should not exist since it's obsolete: '{filename}'")

# Check if `master` branch is accidentally used
for filename in glob.glob(f"{repo_dir}/.github/workflows/*.yaml", recursive=True):
print(f"Checking: '{filename[len(repo_dir)+1:]}'...")
with open(filename, "r") as f:
content = f.read()
if "master" in content:
# Ref: https://github.com/j3soon/ros2-essentials/pull/44#pullrequestreview-2251404984
raise ValueError(f"`master` should not exist since it's obsolete: '{filename}'")

print("All checks passed!")

0 comments on commit 7bf287e

Please sign in to comment.