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
72 changes: 72 additions & 0 deletions .github/workflows/build-makefile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: build-makefile
on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

concurrency:
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
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) }}

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

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

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

- name: Test Makefile build (Ubuntu)
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
159 changes: 159 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: build-cmake
on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

concurrency:
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
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.json)" >> $GITHUB_OUTPUT

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

strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.load-matrix.outputs.matrix) }}

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

# MSYS2 setup
- name: Setup MSYS2
if: matrix.os == 'windows-msys2'
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msys }}
path-type: minimal
update: true
install: >-
git
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)
if: matrix.os == 'windows'
run: |
$arch = if ("${{ matrix.runner }}" -eq "windows-11-arm") { "arm64" } else { "x64" }
vcpkg install zlib:$arch-windows

# CMake builds
- name: Build with CMake (Ubuntu/macOS)
if: matrix.os == 'ubuntu' || matrix.os == 'macos'
run: |
cmake -B build-cmake \
-DCMAKE_BUILD_TYPE=Release \
-DPNGCHECK_USE_SYSTEM_ZLIB=ON
cmake --build build-cmake --config Release

- 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 --build build-cmake --config Release

- name: Build with CMake (Windows MSYS2)
if: matrix.os == 'windows-msys2'
shell: msys2 {0}
run: |
cmake -B build-cmake \
-G "MSYS Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-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)
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

- name: Prepare artifacts (Unix/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
107 changes: 107 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: release

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

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

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

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

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y zlib1g-dev cmake build-essential

- name: Configure CMake
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DPNGCHECK_USE_SYSTEM_ZLIB=ON

- 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
cd release-artifacts
sha256sum * > checksums-${{ matrix.runner }}-${{ matrix.arch }}.txt

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

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

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

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: all-artifacts

- 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
cd release-assets
cat checksums-*.txt > combined-checksums.txt

# List all files for verification
ls -la

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

Compiled binaries for Ubuntu 22.04:

### Ubuntu 22.04
- `pngcheck-ubuntu-22.04-x64` - Ubuntu 22.04 (x64)
- `pngcheck-ubuntu-22.04-arm-arm64` - Ubuntu 22.04 (ARM64)

All binaries are built with CMake and system zlib, and include SHA256 checksums for verification.
files: release-assets/*
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* GRR - Greg Roelofs
* JB - John Bowler
* TGL - Tom Lane
* RT - Ronald Tse (Ribose)
*
* 19950223 AL: fixed wrong magic numbers
* ["version 1.1"]
Expand Down Expand Up @@ -290,3 +291,7 @@
* 20250604 CT: Required the zlib library as a non-optional dependency, and
removed the need to define the USE_ZLIB macro externally
* 20250605 CT: Added third_party/wildargs to auto-expand wildcard arguments
* 20250707 RT: Prevent hard fails on chunks of unknown type in compliance with
PNG spec. By Maxim Samsonov (Ribose), metanorma/pngcheck-metanorma#1.
* 20250708 RT: Added CI workflows and Windows Makefiles (MSVC and MinGW) for GitHub
Actions on Linux, macOS, and Windows.
Loading