plug memory leak #2293
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 | |
| on: [push, pull_request, workflow_dispatch] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| BUILD_TYPE: Release | |
| DATA_ROOT: ${{ github.workspace }}/data | |
| DATA_BRANCH: master | |
| GENERATOR_PLATFORM: | |
| jobs: | |
| source-package: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install git-archive-all | |
| run: python -m pip install git-archive-all | |
| - name: Generate source archives with submodules | |
| shell: bash | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| echo "TAG=$TAG" >> "$GITHUB_ENV" | |
| git-archive-all --prefix="grok-${TAG}/" "source-full.tar.gz" | |
| git-archive-all --prefix="grok-${TAG}/" "source-full.zip" | |
| - name: Upload source archives to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| source-full.tar.gz | |
| source-full.zip | |
| build: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| shared_libs_flag: [ON, OFF] | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install pytest | |
| run: pip install pytest | |
| - name: Delete workflow runs | |
| if: startsWith(matrix.os, 'ubuntu') && matrix.shared_libs_flag == 'ON' | |
| uses: Mattraks/delete-workflow-runs@v2.0.6 | |
| - name: ubuntu-dependencies | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y libpsl-dev swig | |
| - name: macos-dependencies | |
| if: startsWith(matrix.os, 'macos') | |
| run: | | |
| brew install libpsl libssh2 swig | |
| - name: windows-dependencies | |
| if: startsWith(matrix.os, 'windows') | |
| shell: pwsh | |
| run: | | |
| # Install vcpkg explicitly since it is no longer pre-installed on runners | |
| git clone https://github.com/microsoft/vcpkg.git C:\vcpkg | |
| C:\vcpkg\bootstrap-vcpkg.bat -disableMetrics | |
| C:\vcpkg\vcpkg.exe install libpsl:x64-windows | |
| echo "CMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake" >> $env:GITHUB_ENV | |
| echo "GENERATOR_PLATFORM=-DCMAKE_GENERATOR_PLATFORM=x64" >> $env:GITHUB_ENV | |
| choco install swig -y | |
| - name: dependencies | |
| run: | | |
| cmake -E make_directory ${{ github.workspace }}/build | |
| git clone --depth=1 --branch=${{ env.DATA_BRANCH }} https://github.com/GrokImageCompression/grok-test-data.git ${{ env.DATA_ROOT }} | |
| - name: configure cmake | |
| shell: bash | |
| working-directory: ${{ github.workspace }}/build | |
| run: | | |
| if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
| cmake $GITHUB_WORKSPACE \ | |
| -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ | |
| -DBUILD_SHARED_LIBS=${{ matrix.shared_libs_flag }} \ | |
| -DBUILD_TESTING:BOOL=ON \ | |
| -DGRK_DATA_ROOT=$DATA_ROOT \ | |
| -DGRK_ENABLE_LIBCURL=OFF \ | |
| -DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE \ | |
| $GENERATOR_PLATFORM | |
| elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
| cmake $GITHUB_WORKSPACE \ | |
| -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ | |
| -DBUILD_SHARED_LIBS=${{ matrix.shared_libs_flag }} \ | |
| -DBUILD_TESTING:BOOL=ON \ | |
| -DGRK_DATA_ROOT=$DATA_ROOT \ | |
| -DGRK_ENABLE_LIBCURL=OFF | |
| else | |
| cmake $GITHUB_WORKSPACE \ | |
| -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ | |
| -DBUILD_SHARED_LIBS=${{ matrix.shared_libs_flag }} \ | |
| -DBUILD_TESTING:BOOL=ON \ | |
| -DGRK_DATA_ROOT=$DATA_ROOT \ | |
| -DGRK_ENABLE_LIBCURL=ON | |
| fi | |
| - name: build | |
| working-directory: ${{ github.workspace }}/build | |
| shell: bash | |
| run: cmake --build . --config $BUILD_TYPE | |
| - name: test | |
| working-directory: ${{ github.workspace }}/build | |
| shell: bash | |
| run: | | |
| ctest --output-on-failure -C $BUILD_TYPE \ | |
| --output-junit test-results-${{ matrix.os }}-${{ matrix.shared_libs_flag }}.xml | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.os }}-shared_${{ matrix.shared_libs_flag }} | |
| path: | | |
| ${{ github.workspace }}/build/test-results-${{ matrix.os }}-${{ matrix.shared_libs_flag }}.xml | |
| ${{ github.workspace }}/build/Testing/Temporary/LastTest.log | |
| - name: package | |
| if: ${{ always() && matrix.shared_libs_flag == 'ON' }} | |
| working-directory: ${{ github.workspace }}/build | |
| shell: bash | |
| run: | | |
| cmake -Wno-dev \ | |
| -DCPACK_GENERATOR:STRING=ZIP \ | |
| -DCPACK_PACKAGE_FILE_NAME:STRING=grok-${{ matrix.os }} . | |
| cmake --build . --config $BUILD_TYPE --target package | |
| 7z x grok-${{ matrix.os }}.zip | |
| - name: Debug - verify zip exists | |
| if: ${{ always() && matrix.shared_libs_flag == 'ON' }} | |
| working-directory: ${{ github.workspace }}/build | |
| shell: bash | |
| run: | | |
| ls -la *.zip || echo "ERROR: No zip files found in build directory" | |
| - name: publish | |
| if: ${{ always() && matrix.shared_libs_flag == 'ON' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: grok-${{ matrix.os }} | |
| path: ${{ github.workspace }}/build/grok-${{ matrix.os }} | |
| - name: Upload binaries to release | |
| uses: softprops/action-gh-release@v2 | |
| if: ${{ always() && startsWith(github.ref, 'refs/tags/') && matrix.shared_libs_flag == 'ON' }} | |
| with: | |
| files: build/grok-${{ matrix.os }}.zip | |