forked from tier4/autoware_launch-old
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve build-pr CI (tier4#405) Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Add sync-public.yaml (tier4#404) * Add sync-public.yaml Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Add sync-public-develop.yaml Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Fix pre-commit (tier4#407) * Fix pre-commit errors Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Fix package.xml Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Add pre-commit (tier4#406) * Add pre-commit Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Add sort-package-xml Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Update system.launch.xml (tier4#411) * Handle empty output in get_modified_package.sh (tier4#412) Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Co-authored-by: Taichi Higashide <taichi.higashide@tier4.jp> Co-authored-by: Hiroki OTA <hiroki.ota@tier4.jp>
- Loading branch information
1 parent
e3bbdf9
commit 38929bf
Showing
21 changed files
with
273 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/bin/bash | ||
# Search for packages that have been modified from the main branch. | ||
# Usage: get_modified_package.sh <base_branch> | ||
|
||
set -e | ||
|
||
SCRIPT_DIR=$(readlink -f "$(dirname "$0")") | ||
ROOT_DIR=$(readlink -f "$SCRIPT_DIR"/../) | ||
|
||
# Parse arguments | ||
args=() | ||
while [ "${1:-}" != "" ]; do | ||
case "$1" in | ||
*) | ||
args+=("$1") | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
base_branch="${args[0]}" | ||
|
||
# Check args | ||
if [ "$base_branch" = "" ]; then | ||
echo -e "\e[31mPlease input a valid base_branch as the 1st argument.\e[m" | ||
exit 1 | ||
fi | ||
|
||
function find_package_dir() { | ||
[ "$1" == "" ] && return 1 | ||
|
||
target_dir=$(dirname "$1") | ||
while true ; do | ||
parent_dir=$(dirname "$target_dir") | ||
|
||
# Exit if no parent found | ||
if [ "$parent_dir" = "$target_dir" ] ; then | ||
return 0 | ||
fi | ||
|
||
# Output package name if package.xml found | ||
if [ -f "$target_dir/package.xml" ] ; then | ||
if [ ! -f "$target_dir/COLCON_IGNORE" ] ; then | ||
echo "$target_dir" | ||
return 0 | ||
fi | ||
fi | ||
|
||
# Move to parent dir | ||
target_dir=$parent_dir | ||
done | ||
|
||
return 1 | ||
} | ||
|
||
# Find modified files from base branch | ||
modified_files=$(git diff --name-only "$base_branch"...HEAD) | ||
|
||
# Find modified packages | ||
modified_package_dirs=() | ||
for modified_file in $modified_files; do | ||
modified_package_dir=$(find_package_dir "$ROOT_DIR/$modified_file") | ||
|
||
if [ "$modified_package_dir" != "" ] ; then | ||
modified_package_dirs+=("$modified_package_dir") | ||
fi | ||
done | ||
|
||
# Get package names from paths | ||
if [ "${#modified_package_dirs[@]}" != "0" ] ; then | ||
modified_packages=$(colcon list --names-only --paths "${modified_package_dirs[@]}") | ||
fi | ||
|
||
# Output | ||
# shellcheck disable=SC2086 | ||
echo ::set-output name=package_list::$modified_packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: pre-commit | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
|
||
- name: Run pre-commit | ||
uses: pre-commit/action@v2.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: sync public | ||
|
||
on: | ||
schedule: | ||
- cron: "0 19 * * *" # run at 4 AM JST | ||
workflow_dispatch: | ||
|
||
env: | ||
BASE_BRANCH: develop | ||
SYNC_TARGET_BRANCH: develop | ||
SYNC_TARGET_REPOSITORY: https://github.com/tier4/AutowareArchitectureProposal_launcher.git | ||
|
||
jobs: | ||
sync-public: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ env.BASE_BRANCH }} | ||
fetch-depth: 0 | ||
|
||
- name: Generate token | ||
uses: tibdex/github-app-token@v1 | ||
id: generate-token | ||
with: | ||
app_id: ${{ secrets.PROPOSAL_SYNC_APP_ID }} | ||
private_key: ${{ secrets.PROPOSAL_SYNC_APP_PRIVATE_KEY }} | ||
|
||
- name: Set git config for private repositories | ||
run: | | ||
git config --local --unset-all http.https://github.com/.extraheader || true | ||
git config --global url.https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com.insteadOf 'https://github.com' | ||
- name: Push to public repository | ||
run: | | ||
git remote add public ${{ env.SYNC_TARGET_REPOSITORY }} | ||
git fetch public | ||
git push public ${{ env.BASE_BRANCH }}:${{ env.SYNC_TARGET_BRANCH }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: sync public | ||
|
||
on: | ||
schedule: | ||
- cron: "0 19 * * *" # run at 4 AM JST | ||
workflow_dispatch: | ||
|
||
env: | ||
BASE_BRANCH: main | ||
SYNC_TARGET_BRANCH: main | ||
SYNC_TARGET_REPOSITORY: https://github.com/tier4/AutowareArchitectureProposal_launcher.git | ||
|
||
jobs: | ||
sync-public: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ env.BASE_BRANCH }} | ||
fetch-depth: 0 | ||
|
||
- name: Generate token | ||
uses: tibdex/github-app-token@v1 | ||
id: generate-token | ||
with: | ||
app_id: ${{ secrets.PROPOSAL_SYNC_APP_ID }} | ||
private_key: ${{ secrets.PROPOSAL_SYNC_APP_PRIVATE_KEY }} | ||
|
||
- name: Set git config for private repositories | ||
run: | | ||
git config --local --unset-all http.https://github.com/.extraheader || true | ||
git config --global url.https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com.insteadOf 'https://github.com' | ||
- name: Push to public repository | ||
run: | | ||
git remote add public ${{ env.SYNC_TARGET_REPOSITORY }} | ||
git fetch public | ||
git push public ${{ env.BASE_BRANCH }}:${{ env.SYNC_TARGET_BRANCH }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
default: true | ||
MD013: false | ||
MD024: | ||
siblings_only: true | ||
MD033: false | ||
MD041: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# To install: | ||
# | ||
# pip install pre-commit | ||
# | ||
# To use: | ||
# | ||
# pre-commit run -a | ||
# | ||
# Or: | ||
# | ||
# pre-commit install # (runs every time you commit in git) | ||
# | ||
# To update this file: | ||
# | ||
# pre-commit autoupdate | ||
# | ||
# See https://github.com/pre-commit/pre-commit | ||
|
||
repos: | ||
# Standard hooks | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.0.1 | ||
hooks: | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-toml | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: detect-private-key | ||
- id: double-quote-string-fixer | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
args: [--markdown-linebreak-ext=md] | ||
|
||
- repo: https://github.com/igorshubovych/markdownlint-cli | ||
rev: v0.27.1 | ||
hooks: | ||
- id: markdownlint | ||
args: ["-c", ".markdownlint.yaml", "--fix"] | ||
|
||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v2.3.2 | ||
hooks: | ||
- id: prettier | ||
|
||
- repo: https://github.com/tier4/pre-commit-hooks-ros | ||
rev: v0.1.2 | ||
hooks: | ||
- id: prettier-xml | ||
- id: sort-package-xml | ||
|
||
- repo: https://github.com/gruntwork-io/pre-commit | ||
rev: v0.1.12 | ||
hooks: | ||
- id: shellcheck | ||
|
||
exclude: "(.svg|.rviz|.param.yaml|traffic_light_camera.yaml)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
printWidth: 120 | ||
tabWidth: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.