-
-
Notifications
You must be signed in to change notification settings - Fork 36
227 lines (178 loc) · 6.33 KB
/
check_posix_paths.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: Check POSIX Paths in Zip File
on:
push:
branches:
- renovate/**
tags:
- '*'
pull_request:
jobs:
create-valid-zip-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v2.0.1
with:
bun-version: latest
- name: Install dependencies
id: install_code
run: bun install --frozen-lockfile
- name: Build code
id: build_code
run: bun run build
- name: Create a valid zip test
id: create_zip
run: node ./dist/index.js bundle zip --path test/test_upload -n build-linux.zip
- name: Check build directory contents
run: |
echo "Listing contents of the build directory..."
ls -R ./dist
- name: Check ZIP file contents
run: |
echo "Listing contents of the ZIP file..."
unzip -l build-linux.zip
- name: Upload build-linux.zip artifact
uses: actions/upload-artifact@v4
with:
name: build-zip-linux
path: build-linux.zip
check-posix-paths-windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019, windows-2022]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v2.0.1
with:
bun-version: latest
- name: Install dependencies
id: install_code
run: bun install --frozen-lockfile
- name: Build code
id: build_code
run: bun run build
- name: Create a zip test
id: create_zip
run: node ./dist/index.js bundle zip --path test/test_upload -n build-${{ matrix.os }}.zip
- name: Upload build.zip artifact
uses: actions/upload-artifact@v4
with:
name: build-zip-${{ matrix.os }}
path: build-${{ matrix.os }}.zip
check-posix-paths-unix:
runs-on: ubuntu-latest
needs: [create-valid-zip-linux, check-posix-paths-windows]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download build-linux.zip artifact
uses: actions/download-artifact@v4
with:
name: build-zip-linux
- name: List the files
run: ls -lh
- name: Check file size of Linux build
run: ls -lh build-linux.zip
- name: Verify ZIP file integrity for Linux build with zipinfo
run: |
echo "Verifying ZIP file integrity for Linux build with zipinfo..."
zipinfo ./build-linux.zip || (echo "ZIP file is corrupted: build-linux.zip" && exit 1)
- name: Verify POSIX paths for Linux build
run: |
unzip build-linux.zip -d extracted-linux
if find extracted-linux -type f | grep -qE '\\\\'; then
echo "Non-POSIX paths detected in build-linux.zip."
exit 1
else
echo "All paths are POSIX compliant in build-linux.zip."
fi
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Compile VerifyZip.java
run: javac ./test/VerifyZip.java
- name: Verify ZIP file integrity for Linux build with Java
run: java -cp ./test VerifyZip build-linux.zip
- name: Download build-windows-2019.zip artifact
uses: actions/download-artifact@v4
with:
name: build-zip-windows-2019
- name: Download build-windows-2022.zip artifact
uses: actions/download-artifact@v4
with:
name: build-zip-windows-2022
- name: List the files
run: ls -lh
- name: Check file sizes of Windows builds
run: |
echo "Checking file sizes..."
ls -lh build-windows-2019.zip
ls -lh build-windows-2022.zip
- name: Verify ZIP file integrity for Windows 2019 build with zipinfo
run: |
echo "Verifying ZIP file integrity for Windows 2019 build with zipinfo..."
zipinfo ./build-windows-2019.zip || (echo "ZIP file is corrupted: build-windows-2019.zip" && exit 1)
- name: Verify ZIP file integrity for Windows 2022 build with zipinfo
run: |
echo "Verifying ZIP file integrity for Windows 2022 build with zipinfo..."
zipinfo ./build-windows-2022.zip || (echo "ZIP file is corrupted: build-windows-2022.zip" && exit 1)
- name: Verify POSIX paths for Windows 2019 build
run: |
unzip build-windows-2019.zip -d extracted-2019
if find extracted-2019 -type f | grep -qE '\\\\'; then
echo "Non-POSIX paths detected in build-windows-2019.zip."
exit 1
else
echo "All paths are POSIX compliant in build-windows-2019.zip."
fi
- name: Verify POSIX paths for Windows 2022 build
run: |
unzip build-windows-2022.zip -d extracted-2022
if find extracted-2022 -type f | grep -qE '\\\\'; then
echo "Non-POSIX paths detected in build-windows-2022.zip."
exit 1
else
echo "All paths are POSIX compliant in build-windows-2022.zip."
fi
- name: Verify ZIP file integrity for Windows 2019 build with Java
run: java -cp ./test VerifyZip build-windows-2019.zip
- name: Verify ZIP file integrity for Windows 2022 build with Java
run: java -cp ./test VerifyZip build-windows-2022.zip
check-posix-paths-macos:
runs-on: macos-latest
needs: [create-valid-zip-linux, check-posix-paths-windows]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download build-linux.zip artifact
uses: actions/download-artifact@v4
with:
name: build-zip-linux
- name: Download build-windows-2019.zip artifact
uses: actions/download-artifact@v4
with:
name: build-zip-windows-2019
- name: Download build-windows-2022.zip artifact
uses: actions/download-artifact@v4
with:
name: build-zip-windows-2022
- name: List the files
run: ls -lh
- name: Check file size of Linux build
run: ls -lh build-linux.zip
- name: Setup Swift
uses: swift-actions/setup-swift@v2
- name: Get swift version
run: swift --version # Swift 5.10
- name: Compile test executable
run: swift build -c release
working-directory: ./test/test_zip_swift/
- name: Run the swift test
run: ./test/test_zip_swift/.build/release/MyCLI --zip-files build-linux.zip build-windows-2019.zip build-windows-2022.zip