diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cee3c36..b917d19 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,13 +26,17 @@ jobs: fail-fast: false matrix: platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, windows-2022] + path: ['.', 'dir1'] steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + with: + path: ${{ matrix.path }} - name: Test files has no changes - uses: ./ + uses: ${{ matrix.path }} id: changed_files_not_expected with: + path: ${{ matrix.path }} files: | test/*.txt test/*.sql @@ -44,9 +48,10 @@ jobs: echo "Changed files (Not expected): ${{ steps.changed_files_not_expected.outputs.changed_files }}" exit 1 - name: Test dont fail if not changed - uses: ./ + uses: ${{ matrix.path }} id: changed_files_not_expected_fail with: + path: ${{ matrix.path }} fail-if-changed: true files: | test/*.txt @@ -61,9 +66,10 @@ jobs: printf '%s\n' "323442" "424" >> "test/\$(whoami).txt" shell: bash - name: Test test/new*.txt file has changes - uses: ./ + uses: ${{ matrix.path }} id: changed_files_expected with: + path: ${{ matrix.path }} separator: '\n' files: | test/*.txt @@ -80,10 +86,11 @@ jobs: echo "No Changes found: (Not expected)" exit 1 - name: Test fail if changed - uses: ./ + uses: ${{ matrix.path }} id: changed_files_expected_fail continue-on-error: true with: + path: ${{ matrix.path }} fail-if-changed: true files: | test/*.txt @@ -94,9 +101,10 @@ jobs: run: | echo "New changes" > unstaged.txt - name: Test unstaged file has changes - uses: ./ + uses: ${{ matrix.path }} id: changed_unstaged_files_expected with: + path: ${{ matrix.path }} files: | unstaged.txt - name: Display unstaged changed files @@ -109,9 +117,10 @@ jobs: echo "No Changes found: (Not expected)" exit 1 - name: Test unstaged file changes are ignored - uses: ./ + uses: ${{ matrix.path }} id: changed_unstaged_files_not_expected with: + path: ${{ matrix.path }} files: | !test/new.txt !test/new1.txt @@ -124,9 +133,10 @@ jobs: echo "Changes found: (Not expected)" exit 1 - name: Test unstaged file has changes - uses: ./ + uses: ${{ matrix.path }} id: changed_unstaged2_files_expected with: + path: ${{ matrix.path }} files: | !test/new.txt !test/new1.txt @@ -144,8 +154,10 @@ jobs: rm test/new.txt - name: Test deletion of test/new.txt - uses: ./ + uses: ${{ matrix.path }} id: deleted_file_test + with: + path: ${{ matrix.path }} - name: Show output run: |