Skip to content

Commit 2b06fd5

Browse files
committed
refactor: Change default branch from master to main and add tests
Ref: #44 (review)
1 parent aae39be commit 2b06fd5

9 files changed

+21
-11
lines changed

.github/workflows/build-cartographer-ws.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build Docker Image for cartographer-ws
33
on:
44
push:
55
branches:
6-
- "master"
6+
- "main"
77
paths:
88
- .github/workflows/build-cartographer-ws.yaml
99
- cartographer_ws/docker/Dockerfile

.github/workflows/build-husky-ws.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build Docker Image for husky-ws
33
on:
44
push:
55
branches:
6-
- "master"
6+
- "main"
77
paths:
88
- .github/workflows/build-husky-ws.yaml
99
- husky_ws/docker/Dockerfile

.github/workflows/build-kobuki-ws.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build Docker Image for kobuki-ws
33
on:
44
push:
55
branches:
6-
- "master"
6+
- "main"
77
paths:
88
- .github/workflows/build-kobuki-ws.yaml
99
- kobuki_ws/docker/Dockerfile

.github/workflows/build-orbslam3-ws.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build Docker Image for orbslam3-ws
33
on:
44
push:
55
branches:
6-
- "master"
6+
- "main"
77
paths:
88
- .github/workflows/build-orbslam3-ws.yaml
99
- orbslam3_ws/docker/Dockerfile

.github/workflows/build-ros1-bridge-ws.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build Docker Image for ros1-bridge-ws
33
on:
44
push:
55
branches:
6-
- "master"
6+
- "main"
77
paths:
88
- .github/workflows/build-ros1-bridge-ws.yaml
99
- ros1_bridge_ws/docker/Dockerfile

.github/workflows/build-rtabmap-ws.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build Docker Image for rtabmap-ws
33
on:
44
push:
55
branches:
6-
- "master"
6+
- "main"
77
paths:
88
- .github/workflows/build-rtabmap-ws.yaml
99
- rtabmap_ws/docker/Dockerfile

.github/workflows/build-template-ws.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build Docker Image for template-ws
33
on:
44
push:
55
branches:
6-
- "master"
6+
- "main"
77
paths:
88
- .github/workflows/build-template-ws.yaml
99
- template_ws/docker/Dockerfile

.github/workflows/build-vlp-ws.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build Docker Image for vlp-ws
33
on:
44
push:
55
branches:
6-
- "master"
6+
- "main"
77
paths:
88
- .github/workflows/build-vlp-ws.yaml
99
- vlp_ws/docker/Dockerfile

tests/lint_filenames.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import os
22
import glob
33

4+
current_dir = os.path.dirname(os.path.realpath(__file__))
5+
repo_dir = os.path.realpath(f"{current_dir}/..")
6+
47
# Check if all default files exist
58
DEFAULT_FILES = [
69
".gitignore",
@@ -11,8 +14,6 @@
1114
"docker/Dockerfile",
1215
".devcontainer/devcontainer.json",
1316
]
14-
current_dir = os.path.dirname(os.path.realpath(__file__))
15-
repo_dir = os.path.realpath(f"{current_dir}/..")
1617
for filename in DEFAULT_FILES:
1718
print(f"Checking existence of: '{filename}'...")
1819
for workspace_path in glob.glob(f"{repo_dir}/*_ws"):
@@ -31,6 +32,15 @@
3132
content = f.read()
3233
if "version:" in content:
3334
# Ref: https://docs.docker.com/compose/compose-file/04-version-and-name/#version-top-level-element-optional
34-
raise ValueError(f"version should not exist since it's obsolete: '{filename}'")
35+
raise ValueError(f"`version` should not exist since it's obsolete: '{filename}'")
36+
37+
# Check if `master` branch is accidentally used
38+
for filename in glob.glob(f"{repo_dir}/.github/workflows/*.yaml", recursive=True):
39+
print(f"Checking: '{filename[len(repo_dir)+1:]}'...")
40+
with open(filename, "r") as f:
41+
content = f.read()
42+
if "master" in content:
43+
# Ref: https://github.com/j3soon/ros2-essentials/pull/44#pullrequestreview-2251404984
44+
raise ValueError(f"`master` should not exist since it's obsolete: '{filename}'")
3545

3646
print("All checks passed!")

0 commit comments

Comments
 (0)