-
-
Notifications
You must be signed in to change notification settings - Fork 22
115 lines (112 loc) · 3.54 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
- '**'
jobs:
shellcheck:
name: Run shellcheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: shellcheck
uses: reviewdog/[email protected]
test:
name: Test verify-changed-files
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, windows-2022]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Test files has no changes
uses: ./
id: changed_files_not_expected
with:
files: |
test/*.txt
test/*.sql
test/**/*.txt
test/**/*.sql
- name: Display changed files
if: steps.changed_files_not_expected.outputs.files_changed == 'true'
run: |
echo "Changed files (Not expected): ${{ steps.changed_files_not_expected.outputs.changed_files }}"
exit 1
- name: Make changes
run: |
printf '%s\n' "323442" "424" >> test/new.txt
printf '%s\n' "323442" "424" >> test/new1.txt
printf '%s\n' "323442" "424" >> test/new2.txt
- name: Test test/new.txt file has changes
uses: ./
id: changed_files_expected
with:
separator: '\n'
files: |
test/*.txt
test/*.sql
test/**/*.txt
test/**/*.sql
- name: Display changed files
if: steps.changed_files_expected.outputs.files_changed == 'true'
run: |
echo "Changed files: ${{ steps.changed_files_expected.outputs.changed_files }}"
- name: Verify Changes to test/new.txt
if: steps.changed_files_expected.outputs.files_changed != 'true'
run: |
echo "No Changes found: (Not expected)"
exit 1
- name: Generate an unstaged file
run: |
echo "New changes" > unstaged.txt
- name: Test unstaged file has changes
uses: ./
id: changed_unstaged_files_expected
with:
files: |
unstaged.txt
- name: Display unstaged changed files
if: steps.changed_unstaged_files_expected.outputs.files_changed == 'true'
run: |
echo "Changed files: ${{ steps.changed_unstaged_files_expected.outputs.changed_files }}"
- name: Verify Changes to unstaged.txt
if: steps.changed_unstaged_files_expected.outputs.files_changed != 'true'
run: |
echo "No Changes found: (Not expected)"
exit 1
- name: Test unstaged file changes are ignored
uses: ./
id: changed_unstaged_files_not_expected
with:
files: |
!test/new.txt
!test/new1.txt
!test/new2.txt
!unstaged.txt
- name: Verify Changes to unstaged.txt are ignored
if: steps.changed_unstaged_files_not_expected.outputs.files_changed != 'false'
run: |
echo "Changes found: (Not expected)"
exit 1
- name: Test unstaged file has changes
uses: ./
id: changed_unstaged2_files_expected
with:
files: |
!test/new.txt
!test/new1.txt
!test/new2.txt
unstaged.txt
- name: Verify Changes to unstaged.txt are ignored
if: steps.changed_unstaged2_files_expected.outputs.files_changed != 'true'
run: |
echo "No Changes found: (Not expected)"
exit 1