Add progress reporting to CZI repair tool #23
This file contains 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: CMake | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
strategy: | |
matrix: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
build: [Release, Debug] | |
os: [ubuntu-latest, windows-latest] | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencies (Windows) | |
if: ${{ (matrix.OS == 'windows-latest') }} | |
# on Windows, we rely on vcpkg to pull in dependencies | |
shell: bash | |
run: | | |
vcpkg install rapidjson --triplet x64-windows | |
- name: Install dependencies (Linux) | |
if: ${{ (matrix.OS == 'ubuntu-latest') }} | |
# on Linux, we use apt to get our dependencies | |
shell: bash | |
run: | | |
sudo apt-get install zlib1g-dev -y | |
sudo apt-get install libpng-dev -y | |
sudo apt-get install libfreetype6-dev -y | |
sudo apt-get install rapidjson-dev -y | |
- name: Configure CMake (Windows) | |
if: ${{ (matrix.OS == 'windows-latest') }} | |
shell: bash | |
run: | | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
# on Windows, we need to point CMake to the vcpkg-toolchain-file | |
cmake -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=${{matrix.build}} -DLIBCZI_BUILD_CZICMD=ON -DLIBCZI_BUILD_CURL_BASED_STREAM=OFF -DCMAKE_TOOLCHAIN_FILE="${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" | |
- name: Configure CMake (Linux) | |
if: ${{ (matrix.OS == 'ubuntu-latest') }} | |
shell: bash | |
run: | | |
cmake -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=${{matrix.build}} -DLIBCZI_BUILD_CZICMD=ON -DLIBCZI_BUILD_CURL_BASED_STREAM=OFF | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build}} | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
# Use debug flag to show all exeucted tests | |
run: ctest --debug -C ${{matrix.build}} | |
# gather the CZIrepair-binary and put it into a folder - it will be zipped with the upload step | |
- name: Package | |
if: ${{ (matrix.OS == 'windows-latest') && ( matrix.build == 'Release') }} | |
id: create_artifact | |
shell: bash | |
run: | | |
mkdir "${{github.workspace}}/release" | |
cp "${{github.workspace}}/build/Src/czirepair/release/CZIrepair.exe" release/ | |
cp "${{github.workspace}}/THIRD_PARTY_LICENSES.txt" release/ | |
name="CZIrepair-windows-win64-$(git describe --always)" | |
echo "name=${name}" >> "$GITHUB_OUTPUT" | |
echo "path=release" >> "$GITHUB_OUTPUT" | |
# upload the build-results to artifacts-store | |
- name: Upload artifacts | |
if: ${{ (matrix.OS == 'windows-latest') && ( matrix.build == 'Release') }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{steps.create_artifact.outputs.name}} # This is the name of the artifact that will be uploaded to GitHub, determined in the step above | |
path: ${{steps.create_artifact.outputs.path}} # This is the path to the artifacts that will be uploaded to GitHub, determined in the step above- name: Package |