This repository has been archived by the owner on May 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
166 lines (164 loc) · 5.34 KB
/
unit_tests.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Unit Tests
on:
push:
paths:
- "**.fish"
- ".github/workflows/unit_tests.yml"
- "action.yml"
branches: [ master ]
pull_request:
paths:
- "**.fish"
- ".github/workflows/tests.yml"
- "action.yml"
branches: [ master ]
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
jobs:
default_test:
name: Run with default settings
runs-on: ubuntu-latest
steps:
- name: Checkout current version
uses: actions/checkout@v2
- name: Create files to sync
run: |
mkdir docs/
mkdir docs/folder_a/
mkdir docs/folder_b/
touch docs/hello.md
touch docs/folder_a/nice.png
touch docs/folder_b/nice_tmp.png
touch docs/folder_a/dog.JPG
- name: Sync with local action
uses: ./
with:
source-directory: "./docs"
dry-run: true
id: default_test
- name: Test output
run: |
sol="./folder_a/dog.JPG ./folder_a/nice.png ./folder_b/nice_tmp.png ./hello.md"
res="${{ steps.default_test.outputs.sync_result }}"
[ "$sol" = "$res" ] || { echo "::error::Failed default settings test"; exit 1; }
only_include_test:
name: Include only png and md
runs-on: ubuntu-latest
steps:
- name: Checkout current version
uses: actions/checkout@v2
- name: Create files to sync
run: |
mkdir docs/
mkdir docs/folder_a/
mkdir docs/folder_a/sub_a/
touch docs/hello.md
touch docs/hello.png
touch docs/folder_a/nice.png
touch docs/folder_a/sub_a/nice.png
touch docs/folder_a/dog.JPG
- name: Sync with local action
uses: ./
with:
source-directory: "./docs"
dry-run: true
include-patterns: "*.md *.png"
id: only_include
- name: Test output
run: |
sol="./folder_a/nice.png ./folder_a/sub_a/nice.png ./hello.md ./hello.png"
res="${{ steps.only_include.outputs.sync_result }}"
[ "$sol" = "$res" ] || { echo "::error::Failed include only test"; exit 1; }
test_case_sensitivity:
name: Test case sensitivity
runs-on: ubuntu-latest
steps:
- name: Checkout current version
uses: actions/checkout@v2
- name: Create files to sync
run: |
mkdir docs/
mkdir docs/folder_a/
mkdir docs/folder_a/sub_a/
touch docs/hello.md
touch docs/hello.png
touch docs/folder_a/nice.png
touch docs/folder_a/sub_a/nice.png
touch docs/folder_a/sub_a/nice_extension.PNG
touch docs/folder_a/dog.JPG
- name: Sync with local action
uses: ./
with:
source-directory: "./docs"
dry-run: true
include-patterns: "*.md *.png"
id: case_sensitivity
- name: Test output
run: |
sol="./folder_a/nice.png ./folder_a/sub_a/nice.png ./hello.md ./hello.png"
res="${{ steps.case_sensitivity.outputs.sync_result }}"
[ "$sol" = "$res" ] || { echo "::error::Failed case sensitivity test"; exit 1; }
test_exclude_only:
name: Exclude only JPG and md files
runs-on: ubuntu-latest
steps:
- name: Checkout current version
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Create files to sync
run: |
mkdir docs/
mkdir docs/folder_a/
mkdir docs/folder_a/sub_a/
mkdir docs/folder_b/
touch docs/hello.md
touch docs/hello.png
touch docs/folder_a/nice.png
touch docs/folder_a/sub_a/nice.png
touch docs/folder_a/sub_a/nice_extension.PNG
touch docs/folder_b/nice_tmp.png
touch docs/folder_a/dog.JPG
- name: Sync with local action
uses: ./
with:
source-directory: "./docs"
dry-run: true
exclude-patterns: "*.md *.JPG"
id: exclude_only
- name: Test output
run: |
sol="./folder_a/nice.png ./folder_a/sub_a/nice.png ./folder_a/sub_a/nice_extension.PNG ./folder_b/nice_tmp.png ./hello.png"
res="${{ steps.exclude_only.outputs.sync_result }}"
[ "$sol" = "$res" ] || { echo "::error::Failed exclude_only test"; exit 1; }
test_include_and_exclude:
name: Include only *.pdf but ignore *.tmp.pdf files
runs-on: ubuntu-latest
steps:
- name: Checkout current version
uses: actions/checkout@v2
- name: Create files to sync
run: |
mkdir docs/
mkdir docs/folder_a/
mkdir docs/folder_b/
touch docs/hello.md
touch docs/hello.png
touch docs/hello.pdf
touch docs/folder_a/nice.png
touch docs/folder_a/nice.pdf
touch docs/folder_b/nice_tmp.png
touch docs/folder_b/nice.tmp.pdf
- name: Sync with local action
uses: ./
with:
source-directory: "./docs"
dry-run: true
include-patterns: "*.pdf"
exclude-patterns: "*.tmp.pdf"
id: include_exclude
- name: Test output
run: |
sol="./folder_a/nice.pdf ./hello.pdf"
res="${{ steps.include_exclude.outputs.sync_result }}"
[ "$sol" = "$res" ] || { echo "::error::Failed include_exclude test"; exit 1; }