From 5272a9f595e67ab417d48e1bdbee6dd0e5505e23 Mon Sep 17 00:00:00 2001 From: wam-v-tan Date: Sun, 19 Jan 2025 13:11:52 +0000 Subject: [PATCH] Setup workflow --- .github/workflows/BuildTest.yaml | 122 ++++++++++++++++++++ .github/workflows/Release.yaml | 68 +++++++++++ .github/workflows/Review.yaml | 24 ++++ .github/workflows/UpdateWorkflowStatus.yaml | 22 ++++ 4 files changed, 236 insertions(+) create mode 100644 .github/workflows/BuildTest.yaml create mode 100644 .github/workflows/Release.yaml create mode 100644 .github/workflows/Review.yaml create mode 100644 .github/workflows/UpdateWorkflowStatus.yaml diff --git a/.github/workflows/BuildTest.yaml b/.github/workflows/BuildTest.yaml new file mode 100644 index 0000000..619e5f9 --- /dev/null +++ b/.github/workflows/BuildTest.yaml @@ -0,0 +1,122 @@ +name: BuildTest + +on: + schedule: + - cron: 0 0 * * * + pull_request: + workflow_dispatch: + +jobs: + build: + name: build + runs-on: ubuntu-22.04 + timeout-minutes: 180 + strategy: + fail-fast: false + max-parallel: 8 + matrix: + rosdistro: [humble] + include: + # Galactic Geochelone (May 2021 - November 2022) + # - docker_image: rostooling/setup-ros-docker:ubuntu-focal-ros-galactic-ros-base-latest + # rosdistro: galactic + # Humble Hawksbill (May 2022 - May 2027) + - docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest + rosdistro: humble + # Rolling Ridley + # - docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-rolling-ros-base-latest + # rosdistro: rolling + env: + ROS_DISTRO: ${{ matrix.rosdistro }} + container: + image: ${{ matrix.docker_image }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: workaround for jammy + if: ${{ matrix.rosdistro == 'humble' }} + run: | + apt remove libunwind-14-dev -y + apt install python3-nose -y + pip uninstall nose -y + - name: install ccache + run: | + apt install -y ccache + - name: Make ccache dir + run: | + mkdir -p /tmp/ccache + - uses: actions/cache@v3 + with: + path: /tmp/ccache + key: ccache-${{ matrix.rosdistro }} + - name: Search packages in this repository + id: list_packages + run: | + echo name=package_list::$(colcon list --names-only | sed -e ':loop; N; $!b loop; s/\n/ /g') >> "$GITHUB_OUTPUT" + - name: Show target packages + run: | + echo "Target packages: ${{ steps.list_packages.outputs.package_list }}" + - name: Check dependency-${{ matrix.rosdistro }}.repos existence + id: check_rosdistro_repos_files + uses: andstor/file-existence-action@v1 + with: + files: dependency-${{ matrix.rosdistro }}.repos + allow_failure: false + - name: Check dependency.repos existence + id: check_repos_files + uses: andstor/file-existence-action@v1 + with: + files: dependency.repos + allow_failure: false + - name: Run build test with dependency-${{ matrix.rosdistro }}.repos + uses: ros-tooling/action-ros-ci@v0.3 + if: steps.check_rosdistro_repos_files.outputs.files_exists == 'true' + with: + package-name: ${{ steps.list_packages.outputs.package_list }} + target-ros2-distro: ${{ matrix.rosdistro }} + vcs-repo-file-url: dependency-${{ matrix.rosdistro }}.repos + extra-cmake-args: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + env: + CCACHE_DIR: /tmp/ccache + DEVELOP: true + - name: Run build test with dependency.repos + uses: ros-tooling/action-ros-ci@v0.3 + if: steps.check_rosdistro_repos_files.outputs.files_exists == 'false' && steps.check_repos_files.outputs.files_exists == 'true' + with: + package-name: ${{ steps.list_packages.outputs.package_list }} + target-ros2-distro: ${{ matrix.rosdistro }} + vcs-repo-file-url: dependency.repos + extra-cmake-args: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + env: + CCACHE_DIR: /tmp/ccache + DEVELOP: true + - name: Run build test without .repos file + uses: ros-tooling/action-ros-ci@v0.3 + if: steps.check_rosdistro_repos_files.outputs.files_exists == 'false' && steps.check_repos_files.outputs.files_exists == 'false' + with: + package-name: ${{ steps.list_packages.outputs.package_list }} + target-ros2-distro: ${{ matrix.rosdistro }} + extra-cmake-args: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + env: + CCACHE_DIR: /tmp/ccache + DEVELOP: true + - name: Notify Slack + uses: 8398a7/action-slack@v2 + if: failure() + with: + status: ${{ job.status }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + merge: + name: merge + runs-on: ubuntu-22.04 + timeout-minutes: 180 + needs: build + steps: + - name: merge PR + if : ${{ (github.event_name == 'pull_request') && (github.actor == 'wam-v-tan') }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh pr merge ${{ github.event.pull_request.html_url }} --merge diff --git a/.github/workflows/Release.yaml b/.github/workflows/Release.yaml new file mode 100644 index 0000000..40aa7ff --- /dev/null +++ b/.github/workflows/Release.yaml @@ -0,0 +1,68 @@ +# This file is automatically deployed from https://github.com/at-wat/.rospkg-assets. +# Please don't directly edit; update at-wat/.rospkg-assets instead. + +name: Release +on: + issues: + types: [opened, edited] + +jobs: + release: + runs-on: ubuntu-latest + if: startsWith(github.event.issue.title, 'Release ') + steps: + - name: checkout + uses: actions/checkout@v4 + - name: create release + id: create_release + uses: at-wat/catkin-release-action@v1 + with: + issue_title: ${{ github.event.issue.title }} + git_user: wam-v-tan + git_email: ouxt.share@gmail.com + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: open pull-request + uses: repo-sync/pull-request@v2 + id: create_pull_request + with: + source_branch: ${{ steps.create_release.outputs.created_branch }} + destination_branch: ${{ github.event.repository.default_branch }} + pr_title: Release ${{ steps.create_release.outputs.version}} + pr_body: close \#${{ github.event.issue.number }} + pr_assignee: wam-v-tan + github_token: ${{ secrets.WAMV_TAN_BOT_SECRET }} + - name: Enable Pull Request Automerge + uses: peter-evans/enable-pull-request-automerge@v1 + with: + token: ${{ secrets.WAMV_TAN_BOT_SECRET }} + pull-request-number: ${{ steps.create_pull_request.outputs.pr_number }} + merge-method: squash + - name: create GitHub release + uses: actions/create-release@v1 + continue-on-error: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.create_release.outputs.version}} + release_name: Release ${{ steps.create_release.outputs.version}} + - name: bloom release + if: github.event.label.name == 'bloom' + id: bloom + uses: at-wat/bloom-release-action@v0 + with: + ros_distro: foxy galactic rolling + github_token_bloom: ${{ secrets.WAMV_TAN_BOT_SECRET }} + github_user: wam-v-tan + git_user: wam-v-tan + git_email: ouxt.share@gmail.com + release_repository_push_url: https://github.com/${{ github.repository }}-release.git + tag_and_release: true + open_pr: true + - name: Notify Slack + uses: 8398a7/action-slack@v2 + if: failure() + with: + status: ${{ job.status }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/Review.yaml b/.github/workflows/Review.yaml new file mode 100644 index 0000000..60a5584 --- /dev/null +++ b/.github/workflows/Review.yaml @@ -0,0 +1,24 @@ +name: CodeReview + +permissions: + contents: read + pull-requests: write + +on: + pull_request: + types: [review_requested] + +jobs: + review: + runs-on: ubuntu-latest + if: ${{ github.event.requested_reviewer.login == 'wam-v-tan' }} + steps: + - uses: OUXT-Polaris/chatgpt-github-actions@main + with: + openai_api_key: ${{ secrets.OPENAI_API_KEY }} + github_token: ${{ secrets.WAMV_TAN_BOT_SECRET }} + github_pr_id: ${{ github.event.number }} + openai_engine: "gpt-3.5-turbo" #optional + openai_temperature: 0.5 #optional + openai_max_tokens: 2048 #optional + mode: review diff --git a/.github/workflows/UpdateWorkflowStatus.yaml b/.github/workflows/UpdateWorkflowStatus.yaml new file mode 100644 index 0000000..b8d821b --- /dev/null +++ b/.github/workflows/UpdateWorkflowStatus.yaml @@ -0,0 +1,22 @@ +name: UpdateDashboard +on: + pull_request: + paths-ignore: + - ".github/workflows/UpdateWorkflowStatus.yaml" + - ".github/workflows/BuildTest.yaml" + - ".github/workflows/Release.yaml" + - ".github/workflows/Review.yaml" + workflow_dispatch: + +jobs: + build: + name: UpdateDashboard + runs-on: ubuntu-latest + steps: + - uses: benc-uk/workflow-dispatch@v1 + with: + # You should create a personal access token and store it in your repository + token: ${{ secrets.WAMV_TAN_BOT_SECRET }} + repo: OUXT-Polaris/ouxt_automation + workflow: document + ref: master