diff --git a/.github/sync-files.yaml b/.github/sync-files.yaml index 6728792249..4deb334463 100644 --- a/.github/sync-files.yaml +++ b/.github/sync-files.yaml @@ -11,7 +11,6 @@ - source: .github/PULL_REQUEST_TEMPLATE/small-change.md - source: .github/PULL_REQUEST_TEMPLATE/standard-change.md - source: .github/dependabot.yaml - - source: .github/workflows/backport.yaml - source: .github/stale.yml - source: .github/workflows/github-release.yaml - source: .github/workflows/pre-commit.yaml diff --git a/.github/update-sync-param-files.py b/.github/update-sync-param-files.py new file mode 100644 index 0000000000..707909cdd1 --- /dev/null +++ b/.github/update-sync-param-files.py @@ -0,0 +1,80 @@ +import argparse +import dataclasses +from pathlib import Path +from typing import List +from typing import Optional + +import git + +""" +This module updates `sync-param-files.yaml` based on the launch parameter files in `autoware.universe`. +""" + +REPO_NAME = "autowarefoundation/autoware.universe" +REPO_URL = f"https://github.com/{REPO_NAME}.git" +CLONE_PATH = Path("/tmp/autoware.universe") + + +@dataclasses.dataclass +class FileSyncConfig: + source: str + dest: str + replace: Optional[bool] = None + delete_orphaned: Optional[bool] = None + pre_commands: Optional[str] = None + post_commands: Optional[str] = None + + +def create_tier4_launch_sync_configs(tier4_launch_package_path: Path) -> List[FileSyncConfig]: + launch_package_name = tier4_launch_package_path.name + launch_config_path = tier4_launch_package_path / "config" + + sync_configs = [] + for param_file_path in tier4_launch_package_path.glob("config/**/*.param.yaml"): + relative_param_file_path = param_file_path.relative_to(launch_config_path) + + source = param_file_path.relative_to(CLONE_PATH) + dest = Path("autoware_launch/config") / launch_package_name / relative_param_file_path + + sync_configs.append(FileSyncConfig(str(source), str(dest))) + + return sync_configs + + +def dump_sync_config(section_name: str, sync_configs: List[FileSyncConfig]) -> List[str]: + indent = 4 * " " + lines = [f"{indent}# {section_name}\n"] + for sync_config in sync_configs: + lines.append(f"{indent}- source: {sync_config.source}\n") + lines.append(f"{indent} dest: {sync_config.dest}\n") + lines.append("\n") + return lines + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("sync_param_files_path", type=Path, help="path to sync-param-files.yaml") + args = parser.parse_args() + + # Clone Autoware + if not CLONE_PATH.exists(): + git.Repo.clone_from(REPO_URL, CLONE_PATH) + + # Create sync config for tier4_*_launch + tier4_launch_package_paths = sorted( + CLONE_PATH.glob("launch/tier4_*_launch"), key=lambda p: p.name + ) + tier4_launch_sync_configs_map = { + p.name: create_tier4_launch_sync_configs(p) for p in tier4_launch_package_paths + } + + # Create sync-param-files.yaml + with open(args.sync_param_files_path, "w") as f: + f.write(f"- repository: {REPO_NAME}\n") + f.write(" files:\n") + for section_name, sync_config in tier4_launch_sync_configs_map.items(): + f.writelines(dump_sync_config(section_name, sync_config)) + + +if __name__ == "__main__": + main() diff --git a/.github/workflows/backport.yaml b/.github/workflows/backport.yaml deleted file mode 100644 index d79e709888..0000000000 --- a/.github/workflows/backport.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: backport -on: - pull_request_target: - types: - - closed - - labeled - -jobs: - backport: - runs-on: ubuntu-latest - # Only react to merged PRs for security reasons. - # See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target. - if: > - github.event.pull_request.merged - && ( - github.event.action == 'closed' - || ( - github.event.action == 'labeled' - && contains(github.event.label.name, 'backport') - ) - ) - steps: - - name: Generate token - id: generate-token - uses: tibdex/github-app-token@v2 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} - - - uses: tibdex/backport@v2 - with: - github_token: ${{ steps.generate-token.outputs.token }} - title_template: "<%= title %> (backport #<%= number %>)" diff --git a/.github/workflows/beta-to-tier4-main-sync.yaml b/.github/workflows/beta-to-tier4-main-sync.yaml deleted file mode 100644 index 79bdb6f0bd..0000000000 --- a/.github/workflows/beta-to-tier4-main-sync.yaml +++ /dev/null @@ -1,34 +0,0 @@ -name: beta-to-tier4-main-sync - -on: - workflow_dispatch: - inputs: - source_branch: - description: Source branch - required: true - type: string - -jobs: - sync-beta-branch: - runs-on: ubuntu-latest - steps: - - name: Generate token - id: generate-token - uses: tibdex/github-app-token@v1 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} - - - name: Run sync-branches - uses: autowarefoundation/autoware-github-actions/sync-branches@v1 - with: - token: ${{ steps.generate-token.outputs.token }} - base-branch: tier4/main - sync-pr-branch: beta-to-tier4-main-sync - sync-target-repository: https://github.com/tier4/autoware_launch.git - sync-target-branch: ${{ inputs.source_branch }} - pr-title: "chore: sync beta branch ${{ inputs.source_branch }} with tier4/main" - pr-labels: | - bot - sync-beta-branch - auto-merge-method: merge diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 46fd7f159f..fe0069d0a9 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -29,14 +29,6 @@ jobs: - name: Show disk space before the tasks run: df -h - - name: Free disk space (Ubuntu) - uses: jlumbroso/free-disk-space@v1.3.1 - with: - tool-cache: false - dotnet: false - swap-storage: false - large-packages: false - - name: Remove exec_depend uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1 diff --git a/.github/workflows/check-build-depends.yaml b/.github/workflows/check-build-depends.yaml new file mode 100644 index 0000000000..b2d14fa751 --- /dev/null +++ b/.github/workflows/check-build-depends.yaml @@ -0,0 +1,41 @@ +name: check-build-depends + +on: + pull_request: + paths: + - build_depends*.repos + +jobs: + check-build-depends: + runs-on: ubuntu-22.04 + container: ${{ matrix.container }} + strategy: + fail-fast: false + matrix: + rosdistro: + - galactic + - humble + include: + - rosdistro: galactic + container: ros:galactic + build-depends-repos: build_depends.repos + - rosdistro: humble + container: ros:humble + build-depends-repos: build_depends.repos + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Remove exec_depend + uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1 + + - name: Get self packages + id: get-self-packages + uses: autowarefoundation/autoware-github-actions/get-self-packages@v1 + + - name: Build + uses: autowarefoundation/autoware-github-actions/colcon-build@v1 + with: + rosdistro: ${{ matrix.rosdistro }} + target-packages: ${{ steps.get-self-packages.outputs.self-packages }} + build-depends-repos: ${{ matrix.build-depends-repos }} diff --git a/.github/workflows/comment-on-pr.yaml b/.github/workflows/comment-on-pr.yaml deleted file mode 100644 index 3cfec4bf14..0000000000 --- a/.github/workflows/comment-on-pr.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: comment-on-pr - -on: - pull_request: - types: - - opened - branches: - - beta/v0.[0-9]+.[1-9]+ - -jobs: - comment: - runs-on: ubuntu-latest - steps: - - name: Create comments - run: | - cat << EOF > comments - ### Merging guidelines for the beta branch - Please use `Squash and merge` as the default. - However, when incorporating multiple changes with cherry-pick, use a `Create a merge commit` to preserve the changes in the history. - EOF - - name: Post comments - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - URL: ${{ github.event.pull_request.html_url }} - run: gh pr comment -F ./comments "${URL}" diff --git a/.github/workflows/dispatch-release-note.yaml b/.github/workflows/dispatch-release-note.yaml deleted file mode 100644 index 89356b6abd..0000000000 --- a/.github/workflows/dispatch-release-note.yaml +++ /dev/null @@ -1,44 +0,0 @@ -name: dispatch-release-note -on: - push: - branches: - - beta/v* - - tier4/main - tags: - - v* - workflow_dispatch: - inputs: - beta-branch-or-tag-name: - description: The name of the beta branch or tag to write release note - type: string - required: true -jobs: - dispatch-release-note: - runs-on: ubuntu-latest - name: release-repository-dispatch - steps: - - name: Set ref name - id: set-ref-name - run: | - if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then - REF_NAME="${{ github.event.inputs.beta-branch-or-tag-name }}" - else - REF_NAME="${{ github.ref_name }}" - fi - echo ::set-output name=ref-name::"${{ github.repository }}/'$REF_NAME'" - - name: Generate token - id: generate-token - uses: tibdex/github-app-token@v1 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} - - - name: Repository dispatch for release note - run: | - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: token ${{ steps.generate-token.outputs.token }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "https://api.github.com/repos/tier4/update-release-notes/dispatches" \ - -d '{"event_type":"${{ steps.set-ref-name.outputs.ref-name }}"}' diff --git a/.github/workflows/sync-awf-latest.yaml b/.github/workflows/sync-awf-latest.yaml deleted file mode 100644 index 7a5f79acaa..0000000000 --- a/.github/workflows/sync-awf-latest.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: sync-awf-latest - -on: - schedule: - - cron: 50 */1 * * * # every 1 hour (**:50) - workflow_dispatch: - -jobs: - sync-awf-latest: - runs-on: ubuntu-latest - steps: - - name: Generate token - id: generate-token - uses: tibdex/github-app-token@v1 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} - - - name: Run sync-branches - uses: autowarefoundation/autoware-github-actions/sync-branches@v1 - with: - token: ${{ steps.generate-token.outputs.token }} - base-branch: awf-latest - sync-pr-branch: sync-awf-latest - sync-target-repository: https://github.com/autowarefoundation/autoware_launch.git - sync-target-branch: main - pr-title: "chore: sync awf-latest" - pr-labels: | - bot - auto-merge-method: merge diff --git a/.github/workflows/sync-awf-upstream.yaml b/.github/workflows/sync-awf-upstream.yaml deleted file mode 100644 index 3a8dd05797..0000000000 --- a/.github/workflows/sync-awf-upstream.yaml +++ /dev/null @@ -1,53 +0,0 @@ -name: sync-awf-upstream - -on: - workflow_dispatch: - inputs: - target_branch: - description: Target branch - required: true - type: string - -jobs: - sync-awf-upstream: - runs-on: ubuntu-latest - steps: - - name: Generate token - id: generate-token - uses: tibdex/github-app-token@v1 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} - - - uses: actions/setup-node@v3 - with: - node-version: 16 - - - run: npm install @holiday-jp/holiday_jp - - - uses: actions/github-script@v6 - id: is-holiday - with: - script: | - const holiday_jp = require(`${process.env.GITHUB_WORKSPACE}/node_modules/@holiday-jp/holiday_jp`) - core.setOutput('holiday', holiday_jp.isHoliday(new Date())); - - - name: Print warning for invalid branch name - if: ${{ inputs.target_branch == 'tier4/main' }} - run: | - echo This action cannot be performed on 'tier4/main' branch - - - name: Run sync-branches - uses: autowarefoundation/autoware-github-actions/sync-branches@v1 - if: ${{ inputs.target_branch != 'tier4/main' }} - with: - token: ${{ steps.generate-token.outputs.token }} - base-branch: ${{ inputs.target_branch }} - sync-pr-branch: sync-awf-upstream - sync-target-repository: https://github.com/tier4/autoware_launch.git - sync-target-branch: awf-latest - pr-title: "chore: sync tier4/autoware_launch:awf-latest" - pr-labels: | - bot - sync-awf-upstream - auto-merge-method: merge diff --git a/.github/workflows/sync-beta-upstream.yaml b/.github/workflows/sync-beta-upstream.yaml deleted file mode 100644 index 25b83306ca..0000000000 --- a/.github/workflows/sync-beta-upstream.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# This workflow is intended for the use in the repositories created by forking tier4/autoware_launch. -name: sync-beta-upstream - -on: - schedule: - - cron: 0 20 * * * - workflow_dispatch: - -jobs: - sync-tier4-upstream: - runs-on: ubuntu-latest - steps: - - name: Generate token - id: generate-token - uses: tibdex/github-app-token@v1 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} - - - name: Run sync-branches - uses: autowarefoundation/autoware-github-actions/sync-branches@v1 - with: - token: ${{ steps.generate-token.outputs.token }} - base-branch: beta/ - sync-pr-branch: sync-beta-upstream - sync-target-repository: https://github.com/tier4/autoware_launch.git - sync-target-branch: beta/ - pr-title: "chore: sync beta upstream" - pr-labels: | - bot - sync-tier4-upstream - auto-merge-method: merge diff --git a/.github/workflows/sync-tier4-upstream-up-to-tag.yaml b/.github/workflows/sync-tier4-upstream-up-to-tag.yaml deleted file mode 100644 index f85b58a2fa..0000000000 --- a/.github/workflows/sync-tier4-upstream-up-to-tag.yaml +++ /dev/null @@ -1,92 +0,0 @@ -# This workflow is intended for the use in the repositories created by forking tier4/autoware_launch. -name: sync-tier4-upstream-up-to-tag - -on: - workflow_dispatch: - inputs: - sync-target-tag: - description: sync target tag like v0.24.0 - required: true - type: string - default: "" - -jobs: - sync-tier4-upstream-up-to-tag: - runs-on: ubuntu-latest - env: - BASE_BRANCH: tier4/main - SYNC_TARGET_REPOSITORY: https://github.com/tier4/autoware_launch.git - steps: - - name: Generate token - id: generate-token - uses: tibdex/github-app-token@v1 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} - - - name: Check out repository - uses: actions/checkout@v4 - with: - ref: ${{ env.BASE_BRANCH }} - fetch-depth: 0 - - - name: Set git config - uses: autowarefoundation/autoware-github-actions/set-git-config@v1 - with: - token: ${{ steps.generate-token.outputs.token }} - - - name: Sync tag - run: | - git remote add sync-target ${{ env.SYNC_TARGET_REPOSITORY }} - git fetch -pPtf --all - git reset --hard "${{ inputs.sync-target-tag }}" - git remote rm sync-target - shell: bash - - - name: Generate changelog - id: generate-changelog - uses: autowarefoundation/autoware-github-actions/generate-changelog@v1 - with: - git-cliff-args: origin/${{ env.BASE_BRANCH }}..HEAD - - - name: Replace PR number to URL - id: replace-pr-number-to-url - run: | - # Output multiline strings: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-multiline-string - changelog=$(echo "$CHANGELOG" | sed -r "s|\(#([0-9]+)\)|("${REPO_URL%.git}"/pull/\1)|g") - EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) - echo "changelog<<$EOF" >> $GITHUB_OUTPUT - echo "$changelog" >> $GITHUB_OUTPUT - echo "$EOF" >> $GITHUB_OUTPUT - env: - CHANGELOG: ${{ steps.generate-changelog.outputs.changelog }} - REPO_URL: ${{ env.SYNC_TARGET_REPOSITORY }} - shell: bash - - - name: Create PR - id: create-pr - uses: peter-evans/create-pull-request@v6 - with: - token: ${{ steps.generate-token.outputs.token }} - base: ${{ env.BASE_BRANCH }} - branch: sync-tier4-upstream-${{ inputs.sync-target-tag }} - title: "chore: sync upstream up to ${{ inputs.sync-target-tag }}" - body: ${{ steps.replace-pr-number-to-url.outputs.changelog }} - labels: | - bot - sync-tier4-upstream - author: github-actions - signoff: true - delete-branch: true - - - name: Check outputs - run: | - echo "Pull Request Number - ${{ steps.create-pr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.create-pr.outputs.pull-request-url }}" - - - name: Enable auto-merge - if: ${{ steps.create-pr.outputs.pull-request-operation == 'created' }} - run: gh pr merge --merge --auto "${{ steps.create-pr.outputs.pull-request-number }}" - shell: bash - env: - GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/sync-tier4-upstream.yaml b/.github/workflows/sync-tier4-upstream.yaml deleted file mode 100644 index b97a9bab28..0000000000 --- a/.github/workflows/sync-tier4-upstream.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# This workflow is intended for the use in the repositories created by forking tier4/autoware_launch. -name: sync-tier4-upstream - -on: - schedule: - - cron: 0 0 * * * - workflow_dispatch: - -jobs: - sync-tier4-upstream: - runs-on: ubuntu-latest - steps: - - name: Generate token - id: generate-token - uses: tibdex/github-app-token@v1 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} - - - name: Run sync-branches - uses: autowarefoundation/autoware-github-actions/sync-branches@v1 - with: - token: ${{ steps.generate-token.outputs.token }} - base-branch: tier4/main - sync-pr-branch: sync-tier4-upstream - sync-target-repository: https://github.com/tier4/autoware_launch.git - sync-target-branch: tier4/main - pr-title: "chore: sync upstream" - pr-labels: | - bot - sync-tier4-upstream - auto-merge-method: merge