Add PngSuite tests to prevent pngcheck regressions #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build-makefile | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| # In order to upload test artifacts to GHA | |
| contents: write | |
| 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 | |
| # Setup Ruby 3.4 for Ceedling | |
| - name: Setup Ruby 3.4 | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.4' | |
| bundler-cache: true | |
| # Cache PNG suite test files | |
| - name: Cache PNG suite test files | |
| uses: actions/cache@v4 | |
| with: | |
| path: test/fixtures/pngsuite | |
| key: pngsuite-fixtures-${{ hashFiles('test/generate_expectations.sh') }} | |
| restore-keys: | | |
| pngsuite-fixtures- | |
| # Run tests using Ceedling | |
| - name: Run pngcheck test suite with Ceedling (Ubuntu) | |
| env: | |
| PNGCHECK_EXECUTABLE: ${{ github.workspace }}/pngcheck | |
| PNGSUITE_PATH: test/fixtures/pngsuite | |
| EXPECTATIONS_PATH: expectations | |
| run: | | |
| bundle exec ceedling test:all | |
| - name: List out all files in directory | |
| shell: bash | |
| run: | | |
| echo "Current directory: $(pwd)" | |
| echo "Directory contents:" | |
| ls -laR || echo "No files found" | |
| # Upload test reports as artifacts | |
| - name: Upload test reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-reports-${{ matrix.name }}-makefile | |
| path: | | |
| build/artifacts/test/ | |
| build/logs/ | |
| *.xml | |
| *.json | |
| retention-days: 30 | |
| # Upload test results for GitHub's test reporting | |
| - name: Publish Test Results | |
| if: always() | |
| uses: dorny/test-reporter@v1 | |
| with: | |
| name: Unity Tests (${{ matrix.name }}, Makefile) | |
| path: 'build/artifacts/test/junit_tests_report.xml' | |
| reporter: java-junit | |
| fail-on-error: true | |
| # Upload test results on failure for debugging | |
| - name: Upload test results on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.name }}-makefile | |
| path: | | |
| test/fixtures/ | |
| test/expectations/ | |
| *.log | |
| retention-days: 7 | |
| # Artifacts | |
| - 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 |