Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 5 additions & 46 deletions .github/workflows/build-makefile.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: build-makefile
on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

Expand All @@ -10,63 +9,23 @@ concurrency:
cancel-in-progress: true

jobs:
load-matrix:
name: Load Build Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set matrix outputs
id: set-matrix
run: |
echo "matrix=$(jq -c '.' matrix-makefile.json)" >> $GITHUB_OUTPUT

build-makefile:
name: ${{ matrix.name }}-makefile
runs-on: ${{ matrix.runner }}
needs: load-matrix

strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.load-matrix.outputs.matrix) }}
name: ubuntu-makefile
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

# Ubuntu dependencies
- name: Install dependencies (Ubuntu)
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential zlib1g-dev

# Makefile builds
- name: Build with Makefile (Ubuntu)
- name: Build with Makefile
run: |
make

- name: Test Makefile build (Ubuntu)
- name: Test Makefile build
run: |
./pngcheck -h

# - name: Prepare artifacts (Ubuntu)
# run: |
# mkdir -p artifacts
# cp pngcheck artifacts/pngcheck-${{ matrix.name }}-makefile
# cd artifacts
# if command -v sha256sum >/dev/null 2>&1; then
# sha256sum * > checksums.txt
# elif command -v shasum >/dev/null 2>&1; then
# shasum -a 256 * > checksums.txt
# fi

# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# with:
# name: pngcheck-${{ matrix.name }}-makefile
# path: artifacts/
# retention-days: 30
72 changes: 12 additions & 60 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: build-cmake
on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

Expand All @@ -22,7 +21,7 @@ jobs:
- name: Set matrix outputs
id: set-matrix
run: |
echo "matrix=$(jq -c '.' matrix.json)" >> $GITHUB_OUTPUT
echo "matrix=$(jq -c '.' .github/workflows/matrix.json)" >> $GITHUB_OUTPUT

build-cmake:
name: ${{ matrix.name }}-cmake
Expand All @@ -38,47 +37,39 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

# MSYS2 setup
- name: Setup MSYS2
- name: Setup MSYS2 (Windows GCC)
if: matrix.os == 'windows-msys2'
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msys }}
msystem: mingw64
path-type: minimal
update: true
install: >-
git
make
install: make
pacboy: >-
toolchain:p
zlib:p
cmake:p

# Ubuntu dependencies
- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu'
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential zlib1g-dev

# macOS dependencies
- name: Install dependencies (macOS)
if: matrix.os == 'macos'
run: |
brew list zlib || brew install zlib

# Windows dependencies
- name: Setup MSVC (Windows)
if: matrix.os == 'windows'
uses: microsoft/setup-msbuild@v2

- name: Install vcpkg dependencies (Windows)
- name: Install vcpkg dependencies (Windows MSVC)
if: matrix.os == 'windows'
run: |
$arch = if ("${{ matrix.runner }}" -eq "windows-11-arm") { "arm64" } else { "x64" }
vcpkg install zlib:$arch-windows
vcpkg install zlib:x64-windows

# CMake builds
- name: Build with CMake (Ubuntu/macOS)
if: matrix.os == 'ubuntu' || matrix.os == 'macos'
run: |
Expand All @@ -90,11 +81,10 @@ jobs:
- name: Build with CMake (Windows MSVC)
if: matrix.os == 'windows'
run: |
$arch = if ("${{ matrix.runner }}" -eq "windows-11-arm") { "ARM64" } else { "x64" }
cmake -B build-cmake -A $arch -DCMAKE_BUILD_TYPE=Release -DPNGCHECK_USE_SYSTEM_ZLIB=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake -B build-cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DPNGCHECK_USE_SYSTEM_ZLIB=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build-cmake --config Release

- name: Build with CMake (Windows MSYS2)
- name: Build with CMake (Windows GCC)
if: matrix.os == 'windows-msys2'
shell: msys2 {0}
run: |
Expand All @@ -104,56 +94,18 @@ jobs:
-DPNGCHECK_USE_SYSTEM_ZLIB=ON
cmake --build build-cmake --config Release

# Testing CMake builds
- name: Test CMake build (MSYS2)
if: matrix.os == 'windows-msys2'
shell: msys2 {0}
run: |
build-cmake/pngcheck.exe -h

- name: Test CMake build (Windows MSVC)
if: matrix.os == 'windows'
run: |
build-cmake/Release/pngcheck.exe -h

- name: Test CMake build (Unix/macOS)
if: matrix.os == 'ubuntu' || matrix.os == 'macos'
run: |
./build-cmake/pngcheck -h

# Artifacts
- name: Prepare artifacts (MSYS2)
- name: Test CMake build (Windows GCC)
if: matrix.os == 'windows-msys2'
shell: msys2 {0}
run: |
mkdir -p artifacts
cp build-cmake/pngcheck.exe artifacts/pngcheck-${{ matrix.name }}-cmake.exe
cd artifacts
sha256sum * > checksums.txt

- name: Prepare artifacts (Windows MSVC)
if: matrix.os == 'windows'
run: |
mkdir -p artifacts
cp build-cmake/Release/pngcheck.exe artifacts/pngcheck-${{ matrix.name }}-cmake.exe
cd artifacts
Get-FileHash -Algorithm SHA256 *.exe | ForEach-Object { "$($_.Hash.ToLower()) $($_.Path | Split-Path -Leaf)" } > checksums.txt
build-cmake/pngcheck.exe -h

- name: Prepare artifacts (Unix/macOS)
- name: Test CMake build (Ubuntu/macOS)
if: matrix.os == 'ubuntu' || matrix.os == 'macos'
run: |
mkdir -p artifacts
cp build-cmake/pngcheck artifacts/pngcheck-${{ matrix.name }}-cmake
cd artifacts
if command -v sha256sum >/dev/null 2>&1; then
sha256sum * > checksums.txt
elif command -v shasum >/dev/null 2>&1; then
shasum -a 256 * > checksums.txt
fi

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: pngcheck-${{ matrix.name }}-cmake
path: artifacts/
retention-days: 30
./build-cmake/pngcheck -h
22 changes: 22 additions & 0 deletions .github/workflows/matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"runner": "ubuntu-latest",
"os": "ubuntu",
"name": "ubuntu"
},
{
"runner": "macos-latest",
"os": "macos",
"name": "macos"
},
{
"runner": "windows-latest",
"os": "windows",
"name": "windows-msvc"
},
{
"runner": "windows-latest",
"os": "windows-msys2",
"name": "windows-gcc"
}
]
78 changes: 35 additions & 43 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,68 @@
name: release

on:
push:
tags:
- 'v*'
workflow_dispatch:

jobs:
build:
name: Build Release Artifacts
runs-on: ${{ matrix.runner }}
build-windows:
name: Build Windows ${{ matrix.arch }}
runs-on: windows-latest

strategy:
fail-fast: false
matrix:
include:
# Ubuntu 22.04 builds only, compatibile with 22+ later versions
- runner: ubuntu-22.04
os: ubuntu
arch: x64
- runner: ubuntu-22.04-arm
os: ubuntu
arch: arm64
- arch: Win32
vcpkg_triplet: x86-windows
artifact_name: pngcheck-windows-x86.exe
- arch: x64
vcpkg_triplet: x64-windows
artifact_name: pngcheck-windows-x64.exe
- arch: ARM64
vcpkg_triplet: arm64-windows
artifact_name: pngcheck-windows-arm64.exe

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
- name: Setup MSVC
uses: microsoft/setup-msbuild@v2

- name: Install vcpkg dependencies
run: |
sudo apt-get update
sudo apt-get install -y zlib1g-dev cmake build-essential
vcpkg install zlib:${{ matrix.vcpkg_triplet }}

- name: Configure CMake
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DPNGCHECK_USE_SYSTEM_ZLIB=ON
cmake -B build -A ${{ matrix.arch }} -DCMAKE_BUILD_TYPE=Release -DPNGCHECK_USE_SYSTEM_ZLIB=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake

- name: Build
run: cmake --build build --config Release

- name: Prepare release artifacts
run: |
mkdir -p release-artifacts
cp build/pngcheck release-artifacts/pngcheck-${{ matrix.runner }}-${{ matrix.arch }}

# Generate checksums
mkdir release-artifacts
cp build/Release/pngcheck.exe release-artifacts/${{ matrix.artifact_name }}
cd release-artifacts
sha256sum * > checksums-${{ matrix.runner }}-${{ matrix.arch }}.txt
Get-FileHash -Algorithm SHA256 *.exe | ForEach-Object { "$($_.Hash.ToLower()) $($_.Path | Split-Path -Leaf)" } > checksums-${{ matrix.arch }}.txt

- name: Upload release artifacts
uses: actions/upload-artifact@v4
with:
name: pngcheck-${{ matrix.runner }}-${{ matrix.arch }}
name: pngcheck-windows-${{ matrix.arch }}
path: release-artifacts/
retention-days: 90

release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build
needs: build-windows
if: startsWith(github.ref, 'refs/tags/')

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -75,32 +71,28 @@ jobs:
- name: Prepare release assets
run: |
mkdir -p release-assets

# Flatten artifact structure and rename files
find all-artifacts -type f -name "pngcheck*" -exec cp {} release-assets/ \;
find all-artifacts -type f -name "checksums*" -exec cp {} release-assets/ \;

# Create a combined checksums file
find all-artifacts -type f \( -name "*.exe" -o -name "checksums-*.txt" \) -exec cp {} release-assets/ \;
cd release-assets
cat checksums-*.txt > combined-checksums.txt

# List all files for verification
cat checksums-*.txt > checksums.txt
rm checksums-*.txt
ls -la

- name: Create Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
name: Release ${{ github.ref_name }}
name: pngcheck ${{ github.ref_name }}
body: |
## pngcheck ${{ github.ref_name }}

Compiled binaries for Ubuntu 22.04:
### Windows Binaries

### Ubuntu 22.04
- `pngcheck-ubuntu-22.04-x64` - Ubuntu 22.04 (x64)
- `pngcheck-ubuntu-22.04-arm-arm64` - Ubuntu 22.04 (ARM64)
| File | Architecture |
|------|--------------|
| `pngcheck-windows-x86.exe` | Windows 32-bit (x86) |
| `pngcheck-windows-x64.exe` | Windows 64-bit (x64) |
| `pngcheck-windows-arm64.exe` | Windows ARM64 |

All binaries are built with CMake and system zlib, and include SHA256 checksums for verification.
Built with MSVC and zlib. SHA256 checksums included.
files: release-assets/*
draft: false
prerelease: false
Expand Down
12 changes: 0 additions & 12 deletions matrix-makefile.json

This file was deleted.

Loading
Loading