Skip to content

Commit 9f595a8

Browse files
committed
Merge branch 'beta/v0.37' into sync-upstream
Signed-off-by: Hayato Mizushima <hayato-m126@users.noreply.github.com>
2 parents 2be4572 + a074c38 commit 9f595a8

8 files changed

+337
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: beta-to-tier4-main-sync
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
source_branch:
7+
description: Source branch
8+
required: true
9+
type: string
10+
11+
jobs:
12+
sync-beta-branch:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Generate token
16+
id: generate-token
17+
uses: tibdex/github-app-token@v1
18+
with:
19+
app_id: ${{ secrets.APP_ID }}
20+
private_key: ${{ secrets.PRIVATE_KEY }}
21+
22+
- name: Run sync-branches
23+
uses: autowarefoundation/autoware-github-actions/sync-branches@v1
24+
with:
25+
token: ${{ steps.generate-token.outputs.token }}
26+
base-branch: tier4/main
27+
sync-pr-branch: beta-to-tier4-main-sync
28+
sync-target-repository: https://github.com/tier4/autoware.universe.git
29+
sync-target-branch: ${{ inputs.source_branch }}
30+
pr-title: "chore: sync beta branch ${{ inputs.source_branch }} with tier4/main"
31+
pr-labels: |
32+
bot
33+
sync-beta-branch
34+
auto-merge-method: merge

.github/workflows/comment-on-pr.yaml

+18-16
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
name: comment-on-pr
2+
23
on:
3-
pull_request_target:
4+
pull_request:
5+
types:
6+
- opened
7+
branches:
8+
- beta/v0.[0-9]+.[1-9]+
49

510
jobs:
611
comment-on-pr:
712
runs-on: ubuntu-22.04
813
permissions:
914
pull-requests: write
1015
steps:
11-
- name: Check out repository
12-
uses: actions/checkout@v4
13-
14-
- name: Initial PR comment
15-
uses: marocchino/sticky-pull-request-comment@v2
16-
with:
17-
message: |
18-
Thank you for contributing to the Autoware project!
19-
20-
🚧 If your pull request is in progress, [switch it to draft mode](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request#converting-a-pull-request-to-a-draft).
21-
22-
Please ensure:
23-
- You've checked our [contribution guidelines](https://autowarefoundation.github.io/autoware-documentation/main/contributing/).
24-
- Your PR follows our [pull request guidelines](https://autowarefoundation.github.io/autoware-documentation/main/contributing/pull-request-guidelines/).
25-
- All required CI checks pass before [marking the PR ready for review](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request#marking-a-pull-request-as-ready-for-review).
16+
- name: Create comments
17+
run: |
18+
cat << EOF > comments
19+
### Merging guidelines for the beta branch
20+
Please use `Squash and merge` as the default.
21+
However, when incorporating multiple changes with cherry-pick, use a `Create a merge commit` to preserve the changes in the history.
22+
EOF
23+
- name: Post comments
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
URL: ${{ github.event.pull_request.html_url }}
27+
run: gh pr comment -F ./comments "${URL}"
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: dispatch-push-event
2+
on:
3+
push:
4+
5+
jobs:
6+
search-dispatch-repo:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
include:
11+
- { version: beta/v0.3.**, dispatch-repo: pilot-auto.x1.eve }
12+
outputs:
13+
dispatch-repo: ${{ steps.search-dispatch-repo.outputs.value }}
14+
steps:
15+
- name: Search dispatch repo
16+
id: search-dispatch-repo
17+
run: |
18+
if [[ ${{ github.ref_name }} =~ ${{ matrix.version }} ]]; then
19+
echo ::set-output name=value::"${{ matrix.dispatch-repo }}"
20+
echo "Detected beta branch: ${{ github.ref_name }}"
21+
echo "Dispatch repository: ${{ matrix.dispatch-repo }}"
22+
fi
23+
24+
dispatch-push-event:
25+
runs-on: ubuntu-latest
26+
needs: search-dispatch-repo
27+
if: ${{ needs.search-dispatch-repo.outputs.dispatch-repo != '' }}
28+
steps:
29+
- name: Generate token
30+
id: generate-token
31+
uses: tibdex/github-app-token@v1
32+
with:
33+
app_id: ${{ secrets.INTERNAL_APP_ID }}
34+
private_key: ${{ secrets.INTERNAL_PRIVATE_KEY }}
35+
36+
# 注意: workflow_dispatchで指定するブランチはmain固定となっているため、dispatch-repoのmainブランチにupdate-beta-branch.yamlが存在することが前提条件。
37+
- name: Dispatch the update-beta-branch workflow
38+
run: |
39+
curl -L \
40+
-X POST \
41+
-H "Accept: application/vnd.github+json" \
42+
-H "Authorization: Bearer ${{ steps.generate-token.outputs.token }}" \
43+
-H "X-GitHub-Api-Version: 2022-11-28" \
44+
https://api.github.com/repos/tier4/${{ needs.search-dispatch-repo.outputs.dispatch-repo }}/actions/workflows/update-beta-branch.yaml/dispatches \
45+
-d '{"ref":"main"}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: dispatch-release-note
2+
on:
3+
push:
4+
branches:
5+
- beta/v*
6+
- tier4/main
7+
tags:
8+
- v*
9+
workflow_dispatch:
10+
inputs:
11+
beta-branch-or-tag-name:
12+
description: The name of the beta branch or tag to write release note
13+
type: string
14+
required: true
15+
jobs:
16+
dispatch-release-note:
17+
runs-on: ubuntu-latest
18+
name: release-repository-dispatch
19+
steps:
20+
- name: Set tag name
21+
id: set-tag-name
22+
run: |
23+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
24+
REF_NAME="${{ github.event.inputs.beta-branch-or-tag-name }}"
25+
else
26+
REF_NAME="${{ github.ref_name }}"
27+
fi
28+
echo ::set-output name=ref-name::"$REF_NAME"
29+
echo ::set-output name=tag-name::"${REF_NAME#beta/}"
30+
31+
- name: Generate token
32+
id: generate-token
33+
uses: tibdex/github-app-token@v1
34+
with:
35+
app_id: ${{ secrets.APP_ID }}
36+
private_key: ${{ secrets.PRIVATE_KEY }}
37+
38+
- name: Repository dispatch for release note
39+
run: |
40+
curl \
41+
-X POST \
42+
-H "Accept: application/vnd.github+json" \
43+
-H "Authorization: token ${{ steps.generate-token.outputs.token }}" \
44+
-H "X-GitHub-Api-Version: 2022-11-28" \
45+
"https://api.github.com/repos/tier4/update-release-notes/dispatches" \
46+
-d '{"event_type":"${{ steps.set-tag-name.outputs.ref-name }}"}'

.github/workflows/slack-send.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: slack-send
2+
on:
3+
workflow_run:
4+
workflows:
5+
- build-and-test
6+
types:
7+
- completed
8+
9+
jobs:
10+
on-failure:
11+
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out repository
15+
uses: actions/checkout@v3
16+
17+
- name: Send to Slack workflow
18+
uses: slackapi/slack-github-action@v1
19+
with:
20+
payload: |
21+
{
22+
"workflow-url": "${{ github.event.workflow_run.html_url }}"
23+
}
24+
env:
25+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WORKFLOW_WEBHOOK_URL }}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: sync-awf-latest
2+
3+
on:
4+
schedule:
5+
- cron: 50 */1 * * * # every 1 hour (**:50)
6+
workflow_dispatch:
7+
8+
jobs:
9+
sync-awf-latest:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
token: ${{ secrets.TOKEN_TO_MODIFY_WOKFLOW }}
15+
fetch-depth: 0
16+
- name: Commit Results
17+
run: |
18+
git config --local user.email "action@github.com"
19+
git config --local user.name "GitHub Action"
20+
21+
git checkout awf-latest
22+
git remote add awf https://github.com/autowarefoundation/autoware.universe
23+
git fetch awf main
24+
git rebase awf/main
25+
26+
git push origin awf-latest --force

.github/workflows/sync-upstream.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: sync-upstream
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
target_branch:
7+
description: Target branch
8+
required: true
9+
type: string
10+
11+
jobs:
12+
sync-upstream:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Generate token
16+
id: generate-token
17+
uses: tibdex/github-app-token@v1
18+
with:
19+
app_id: ${{ secrets.APP_ID }}
20+
private_key: ${{ secrets.PRIVATE_KEY }}
21+
22+
- uses: actions/setup-node@v3
23+
with:
24+
node-version: 16
25+
26+
- run: npm install @holiday-jp/holiday_jp
27+
28+
- uses: actions/github-script@v6
29+
id: is-holiday
30+
with:
31+
script: |
32+
const holiday_jp = require(`${process.env.GITHUB_WORKSPACE}/node_modules/@holiday-jp/holiday_jp`)
33+
core.setOutput('holiday', holiday_jp.isHoliday(new Date()));
34+
- name: Print warning for invalid branch name
35+
if: ${{ inputs.target_branch == 'tier4/main' }}
36+
run: |
37+
echo This action cannot be performed on 'tier4/main' branch
38+
39+
- name: Run sync-branches
40+
if: ${{ inputs.target_branch != 'tier4/main' }}
41+
uses: autowarefoundation/autoware-github-actions/sync-branches@v1
42+
with:
43+
token: ${{ steps.generate-token.outputs.token }}
44+
base-branch: ${{ inputs.target_branch }}
45+
sync-pr-branch: sync-upstream
46+
sync-target-repository: https://github.com/tier4/autoware.universe.git
47+
sync-target-branch: awf-latest
48+
pr-title: "chore: sync tier4/autoware.universe:awf-latest"
49+
auto-merge-method: merge
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/usr/bin/env python3
2+
3+
# Copyright 2024 The Autoware Contributors
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
import argparse
18+
19+
from diagnostic_msgs.msg import DiagnosticStatus
20+
import rclpy
21+
import rclpy.node
22+
from tier4_system_msgs.msg import DiagnosticGraph
23+
24+
25+
def print_table(lines: list, header: list):
26+
widths = [0 for _ in range(len(header))]
27+
lines.insert(0, header)
28+
for line in lines:
29+
widths = map(max, widths, map(len, line))
30+
widths = list(widths)
31+
lines.insert(0, ["-" * w for w in widths])
32+
lines.insert(2, ["-" * w for w in widths])
33+
for line in lines:
34+
line = map(lambda v, w: f"{v: {w}}", line, widths)
35+
line = " | ".join(line)
36+
print(f"| {line} |")
37+
38+
39+
def get_level_text(level: int):
40+
if level == DiagnosticStatus.OK:
41+
return "OK"
42+
if level == DiagnosticStatus.WARN:
43+
return "WARN"
44+
if level == DiagnosticStatus.ERROR:
45+
return "ERROR"
46+
if level == DiagnosticStatus.STALE:
47+
return "STALE"
48+
return "-----"
49+
50+
51+
class NodeData:
52+
def __init__(self, index, node):
53+
self.index = index
54+
self._node = node
55+
56+
@property
57+
def level(self):
58+
return get_level_text(self._node.status.level)
59+
60+
@property
61+
def name(self):
62+
return self._node.status.name
63+
64+
@property
65+
def links(self):
66+
return " ".join(str(link.index) for link in self._node.links)
67+
68+
@property
69+
def line(self):
70+
return [str(self.index), self.level, self.name, self.links]
71+
72+
73+
class DumpNode(rclpy.node.Node):
74+
def __init__(self, args):
75+
super().__init__("dump_diagnostic_graph")
76+
self.sub = self.create_subscription(DiagnosticGraph, args.topic, self.callback, 1)
77+
78+
def callback(self, msg):
79+
nodes = [NodeData(index, node) for index, node in enumerate(msg.nodes)]
80+
table = [node.line for node in nodes]
81+
print_table(table, ["index", "level", "name", "links"])
82+
83+
84+
if __name__ == "__main__":
85+
parser = argparse.ArgumentParser()
86+
parser.add_argument("--topic", default="/diagnostics_graph")
87+
args, unparsed = parser.parse_known_args()
88+
89+
try:
90+
rclpy.init(args=unparsed)
91+
rclpy.spin(DumpNode(args))
92+
rclpy.shutdown()
93+
except KeyboardInterrupt:
94+
pass

0 commit comments

Comments
 (0)