2027 #221
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 | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: [ "main" ] | |
| env: | |
| BUILD_TYPE: Release | |
| jobs: | |
| build-host: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-22.04 | |
| arch-name: linuxx86-64 | |
| - os: ubuntu-22.04-arm | |
| arch-name: linuxarm64 | |
| - os: windows-latest | |
| arch-name: windowsx86-64 | |
| extra-flags: -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl | |
| - os: macos-latest | |
| arch-name: osxuniversal | |
| extra-flags: -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" | |
| runs-on: ${{ matrix.os }} | |
| name: "mrcal-jni - Build - ${{ matrix.arch-name }}" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: 'true' | |
| fetch-depth: 0 | |
| - name: Fetch tags | |
| run: git fetch --tags --force | |
| - run: git describe --tags | |
| - uses: actions/setup-java@v5 | |
| with: | |
| java-version: 21 | |
| distribution: temurin | |
| - name: Install deps (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt update | |
| sudo apt-get install -y cmake ninja-build gcc g++ liblist-moreutils-perl | |
| - name: Install deps (macOS) | |
| if: runner.os == 'macOS' | |
| run: sudo cpan -i List::MoreUtils | |
| - name: Configure CMake | |
| # 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 | |
| run: cmake -B ${{github.workspace}}/cmake_build -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DOPENCV_ARCH=${{ matrix.arch-name }} ${{ matrix.extra-flags }} | |
| - name: Build shared mrcal_jni | |
| # Build your program with the given configuration | |
| run: cmake --build ${{github.workspace}}/cmake_build --target mrcal_jni | |
| - name: Gradle build | |
| # Build your program with the given configuration | |
| run: ./gradlew build | |
| - run: ./gradlew publish | |
| name: Publish | |
| env: | |
| ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} | |
| # TODO get rid of the 2027 exception once the 2027 branch is merged | |
| if: github.event_name == 'push' || startsWith(github.ref, 'refs/tags/v') || github.branch == '2027' | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: libmrcal-jar-${{ matrix.arch-name }} | |
| path: ${{ github.workspace }}/build/libs/*.jar | |
| release: | |
| needs: build-host | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| # Download literally every single artifact. This also downloads client and docs, | |
| # but the filtering below won't pick these up (I hope) | |
| - uses: actions/download-artifact@v5 | |
| - run: find | |
| # Push to dev release on pushes to master | |
| - uses: pyTooling/Actions/releaser@r6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: 'Dev' | |
| rm: true | |
| files: | | |
| **/* | |
| if: github.event_name == 'push' | |
| # Push to actual release, if tagged | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| **/* | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |