From d0aa628d008f9b394fe2b6683bee685223bebba7 Mon Sep 17 00:00:00 2001 From: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Date: Mon, 18 Apr 2022 16:05:47 +0900 Subject: [PATCH] test(get-modified-packages): add tests (#134) * fix trigger condition Signed-off-by: Kenji Miyake * add tests Signed-off-by: Kenji Miyake * add a workaround Signed-off-by: Kenji Miyake --- .github/workflows/test-composite-actions.yaml | 53 +++++++++++++++++++ get-modified-packages/action.yaml | 5 ++ 2 files changed, 58 insertions(+) diff --git a/.github/workflows/test-composite-actions.yaml b/.github/workflows/test-composite-actions.yaml index 44d0b99a..9e29c7b3 100644 --- a/.github/workflows/test-composite-actions.yaml +++ b/.github/workflows/test-composite-actions.yaml @@ -2,6 +2,9 @@ name: test-composite-actions on: pull_request: + schedule: + - cron: 0 0 * * * + workflow_dispatch: jobs: test-register-autonomoustuff-repository: @@ -134,3 +137,53 @@ jobs: with: rosdistro: ${{ matrix.rosdistro }} target-packages: empty_target_cmake empty_target_python + + test-get-self-packages-and-get-modified-packages: + runs-on: ubuntu-latest + container: ${{ matrix.container }} + strategy: + fail-fast: false + matrix: + container: + - ros:galactic + - ghcr.io/autowarefoundation/autoware-universe:latest + steps: + - name: Check out repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set git config + uses: autowarefoundation/autoware-github-actions/set-git-config@v1 + + - name: Workaround for https://github.com/actions/checkout/issues/766 + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + + - name: Modify packages + run: | + echo "" >> tests/dummy_packages/empty_target_cmake/package.xml + git add . + git commit -m "modify packages" + + - name: Clear workaround + run: | + git config --global --unset safe.directory + + - name: Run get-self-packages + id: get-self-packages + uses: ./get-self-packages + + - name: Check result of get-self-packages + run: | + [[ "${{ steps.get-self-packages.outputs.self-packages }}" == "empty_target_cmake empty_target_python" ]] + shell: bash + + - name: Run get-modified-packages + id: get-modified-packages + uses: ./get-modified-packages + + - name: Check result of get-modified-packages + run: | + [[ "${{ steps.get-modified-packages.outputs.modified-packages }}" == "empty_target_cmake" ]] + shell: bash diff --git a/get-modified-packages/action.yaml b/get-modified-packages/action.yaml index 0bd75ced..6160dfe9 100644 --- a/get-modified-packages/action.yaml +++ b/get-modified-packages/action.yaml @@ -9,6 +9,11 @@ outputs: runs: using: composite steps: + - name: Workaround for https://github.com/actions/checkout/issues/766 + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + shell: bash + - name: Get modified packages id: get-modified-packages run: |