config: improve fonts acquiring #247
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: CMake CI (Test oshot) | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| get-version: | |
| name: Get Version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.get-version.outputs.version }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get version from git tag or commit | |
| id: get-version | |
| run: | | |
| if [ -n "$(git tag --points-at HEAD)" ]; then | |
| version=$(git describe --tags --abbrev=0) | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| else | |
| version=$(git rev-parse --short HEAD) | |
| echo "version=commit-$version" >> $GITHUB_OUTPUT | |
| fi | |
| echo "Version: $version" | |
| build: | |
| name: Build on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-latest, ubuntu-22.04, macos-latest, macos-15-intel, windows-latest ] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| fetch-depth: 0 | |
| - name: Install dependencies (Linux) | |
| if: contains(matrix.os, 'ubuntu') | |
| run: | | |
| sudo apt-get update && sudo apt-get purge firefox -y | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| pkg-config \ | |
| make \ | |
| cmake \ | |
| git \ | |
| zip \ | |
| fuse \ | |
| libx11-dev \ | |
| libxcb1-dev \ | |
| libglfw3-dev \ | |
| libtesseract-dev \ | |
| libcurl4-openssl-dev \ | |
| libpng-dev \ | |
| libjpeg-dev \ | |
| libgif-dev \ | |
| libtiff-dev \ | |
| libwebp-dev \ | |
| libzbar-dev \ | |
| libappindicator3-dev | |
| - name: Install dependencies (MacOS) | |
| if: contains(matrix.os, 'macos') | |
| run: | | |
| brew update && brew upgrade || true | |
| brew install cmake glfw tesseract leptonica zbar curl dylibbundler | |
| - name: Install dependencies (Windows) | |
| if: matrix.os == 'windows-latest' | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| update: true | |
| install: >- | |
| zip | |
| git | |
| libcurl-devel | |
| mingw-w64-x86_64-7zip | |
| mingw-w64-x86_64-directx-headers | |
| mingw-w64-x86_64-ninja | |
| mingw-w64-x86_64-toolchain | |
| mingw-w64-x86_64-minizip | |
| mingw-w64-x86_64-cmake | |
| mingw-w64-x86_64-zbar | |
| mingw-w64-x86_64-make | |
| mingw-w64-x86_64-tesseract-ocr | |
| mingw-w64-x86_64-glfw | |
| mingw-w64-x86_64-libpng | |
| mingw-w64-x86_64-libjpeg-turbo | |
| mingw-w64-x86_64-openjpeg2 | |
| mingw-w64-x86_64-libwebp | |
| mingw-w64-x86_64-libtiff | |
| mingw-w64-x86_64-curl | |
| - name: Build project (Linux) | |
| if: contains(matrix.os, 'ubuntu') | |
| run: | | |
| ./scripts/generateVersion.sh | |
| mkdir -p build | |
| cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug | |
| make -C build | |
| ./build/oshot --version | |
| - name: Build project (MacOS) | |
| if: contains(matrix.os, 'macos') | |
| run: | | |
| ./scripts/generateVersion.sh | |
| BREW=$(brew --prefix) | |
| mkdir -p build | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_PREFIX_PATH="$BREW" \ | |
| -DPKG_CONFIG_PATH="$BREW/lib/pkgconfig:$BREW/share/pkgconfig" | |
| make -C build | |
| - name: Build project (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: msys2 {0} | |
| run: | | |
| #mingw32-make all DEBUG=0 WINDOWS_CMD=0 | |
| ./scripts/generateVersion.sh | |
| mkdir -p build | |
| cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DWINDOWS_CMD=ON | |
| ninja -C build | |
| - name: Prepare Linux package | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| mkdir -p package/oshot/models | |
| cp ./build/oshot package/oshot/ | |
| echo "#!/bin/bash" > package/oshot/install.sh | |
| echo "cp oshot /usr/local/bin/oshot" >> package/oshot/install.sh | |
| chmod +x package/oshot/install.sh package/oshot/oshot | |
| wget https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata -O package/oshot/models/eng.traineddata | |
| wget https://github.com/matomo-org/travis-scripts/raw/refs/heads/master/fonts/Arial.ttf -O package/oshot/Arial.ttf | |
| cd package | |
| zip -r oshot-linux.zip oshot/ | |
| - name: Prepare AppImage package | |
| if: matrix.os == 'ubuntu-22.04' | |
| run: | | |
| mkdir -p package/oshot/models | |
| ./scripts/create_appimage.sh ./build/oshot oshot-x86_64.AppImage | |
| chmod +x oshot-x86_64.AppImage | |
| mv oshot-x86_64.AppImage package/oshot/ | |
| wget https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata -O package/oshot/models/eng.traineddata | |
| wget https://github.com/matomo-org/travis-scripts/raw/refs/heads/master/fonts/Arial.ttf -O package/oshot/Arial.ttf | |
| cd package | |
| zip -r oshot-appimage.zip oshot/ | |
| - name: Prepare macOS bundle | |
| if: contains(matrix.os, 'macos') | |
| run: | | |
| mkdir -p package/oshot/models | |
| ARCH=$(uname -m) | |
| ./scripts/create_app_bundle.sh ./build/oshot oshot-macos-${ARCH}.dmg | |
| mv oshot-macos-${ARCH}.dmg package/oshot/ | |
| curl -L https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata -o package/oshot/models/eng.traineddata | |
| curl -L https://github.com/matomo-org/travis-scripts/raw/refs/heads/master/fonts/Arial.ttf -o package/oshot/Arial.ttf | |
| cd package | |
| zip -r oshot-macos-${ARCH}.zip oshot/ | |
| - name: Prepare Windows package | |
| if: matrix.os == 'windows-latest' | |
| shell: msys2 {0} | |
| run: | | |
| mkdir -p package/oshot/models | |
| cp ./build/oshot.exe ./oshot.ico package/oshot/ | |
| # Copy required DLLs | |
| ldd ./build/oshot.exe | grep -i mingw | awk '{print $3}' | xargs -I {} cp {} package/oshot/ || true | |
| curl -L https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata -o package/oshot/models/eng.traineddata | |
| cd package | |
| zip -r oshot-windows.zip oshot/ | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.os }}-packages | |
| path: package/*.zip | |
| if-no-files-found: error |