Skip to content

CMake: Do not compile/use included "getopt" if OS has native implemen… #90

CMake: Do not compile/use included "getopt" if OS has native implemen…

CMake: Do not compile/use included "getopt" if OS has native implemen… #90

Workflow file for this run

name: compile
on:
push:
branches:
- "**"
- "!dependabot/**"
pull_request:
workflow_dispatch:
jobs:
job:
name: ${{ matrix.os }}-${{ github.workflow }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest]
include:
- os: windows-latest
triplet: x64-windows
- os: ubuntu-20.04
triplet: x64-linux
- os: macos-latest
triplet: x64-osx
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
persist-credentials: false
# Install CMake
- uses: lukka/[email protected]
# Install NASM
- uses: ilammy/setup-nasm@v1
# Launch the MSVC Tools Command Prompt (Windows)
- uses: ilammy/msvc-dev-cmd@v1
# Initialize the CMake directory and build
- name: Build
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_NO_SUBFOLDERS=1
cmake --build build --config Release
# Run tests
- name: Tests
run: |
ctest --test-dir build --build-config Release
# Gather documentation and executables to a common directory
# Ignore copying errors from only one of build/jpegoptim or build/jpegoptim.exe existing
- name: Prepare files
if: matrix.os != 'ubuntu-latest'
run: |
mkdir build/dist
cp build/jpegoptim build/jpegoptim.exe COPYRIGHT LICENSE README build/dist/ 2>/dev/null || true
shell: bash
# Upload the compiled binary
- uses: actions/upload-artifact@v3
if: matrix.os != 'ubuntu-latest'
with:
name: jpegoptim-${{ matrix.triplet }}
path: build/dist