Skip to content

Compatibility fix semver #662

Compatibility fix semver

Compatibility fix semver #662

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
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
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
posix-paths-final:
needs: [check-posix-paths-unix, check-posix-paths-macos]
runs-on: ubuntu-latest
name: POSIX Paths final
steps:
- name: Final check
run: echo "All POSIX path checks completed successfully"