compile.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. name: compile
  2. on:
  3. push:
  4. branches:
  5. - "**"
  6. - "!dependabot/**"
  7. pull_request:
  8. workflow_dispatch:
  9. jobs:
  10. job:
  11. name: ${{ matrix.os }}-${{ github.workflow }}
  12. runs-on: ${{ matrix.os }}
  13. strategy:
  14. fail-fast: false
  15. matrix:
  16. os: [ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest]
  17. include:
  18. - os: windows-latest
  19. triplet: x64-windows
  20. - os: ubuntu-20.04
  21. triplet: x64-linux
  22. - os: macos-latest
  23. triplet: x64-osx
  24. steps:
  25. - name: Clone repository
  26. uses: actions/checkout@v4
  27. with:
  28. persist-credentials: false
  29. # Install CMake
  30. - uses: lukka/get-cmake@v3.30.1
  31. # Install NASM
  32. - uses: ilammy/setup-nasm@v1
  33. # Launch the MSVC Tools Command Prompt (Windows)
  34. - uses: ilammy/msvc-dev-cmd@v1
  35. # Initialize the CMake directory and build
  36. - name: Build
  37. run: |
  38. cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_NO_SUBFOLDERS=1
  39. cmake --build build --config Release
  40. # Run tests
  41. - name: Tests
  42. run: |
  43. ctest --output-on-failure --test-dir build --build-config Release
  44. # Gather documentation and executables to a common directory
  45. # Ignore copying errors from only one of build/jpegoptim or build/jpegoptim.exe existing
  46. - name: Prepare files
  47. if: matrix.os != 'ubuntu-latest'
  48. run: |
  49. mkdir build/dist
  50. cp build/jpegoptim build/jpegoptim.exe COPYRIGHT LICENSE README build/dist/ 2>/dev/null || true
  51. shell: bash
  52. # Upload the compiled binary
  53. - uses: actions/upload-artifact@v4
  54. if: matrix.os != 'ubuntu-latest'
  55. with:
  56. name: jpegoptim-${{ matrix.triplet }}
  57. path: build/dist