Skip to content

Commit

Permalink
test(get-modified-packages): add tests (#134)
Browse files Browse the repository at this point in the history
* fix trigger condition

Signed-off-by: Kenji Miyake <[email protected]>

* add tests

Signed-off-by: Kenji Miyake <[email protected]>

* add a workaround

Signed-off-by: Kenji Miyake <[email protected]>
  • Loading branch information
kenji-miyake authored Apr 18, 2022
1 parent 1848a1a commit d0aa628
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/test-composite-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: test-composite-actions

on:
pull_request:
schedule:
- cron: 0 0 * * *
workflow_dispatch:

jobs:
test-register-autonomoustuff-repository:
Expand Down Expand Up @@ -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
5 changes: 5 additions & 0 deletions get-modified-packages/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down

0 comments on commit d0aa628

Please sign in to comment.