|
| 1 | +name: Build and Test Subversion with CMake |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["*"] |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: ${{ github.ref }} |
| 9 | + cancel-in-progress: false |
| 10 | + |
| 11 | +defaults: |
| 12 | + run: |
| 13 | + shell: pwsh |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + include: |
| 21 | + - name: Windows, shared, x64 |
| 22 | + os: windows-latest |
| 23 | + build_shared: ON |
| 24 | + vcpkg_triplet: x64-windows |
| 25 | + arch: x64 |
| 26 | + - name: Windows, shared, x86 |
| 27 | + os: windows-latest |
| 28 | + build_shared: ON |
| 29 | + vcpkg_triplet: x86-windows |
| 30 | + arch: x86 |
| 31 | + - name: Windows, static, x64, with tests |
| 32 | + os: windows-latest |
| 33 | + build_shared: OFF |
| 34 | + vcpkg_triplet: x64-windows-static |
| 35 | + arch: x64 |
| 36 | + run_tests: true |
| 37 | + - name: Linux, shared, with tests |
| 38 | + os: ubuntu-latest |
| 39 | + build_shared: ON |
| 40 | + run_tests: true |
| 41 | + |
| 42 | + runs-on: ${{ matrix.os }} |
| 43 | + name: ${{ matrix.name }} |
| 44 | + |
| 45 | + env: |
| 46 | + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" |
| 47 | + |
| 48 | + steps: |
| 49 | + - name: Prepare Enviroment (Windows) |
| 50 | + if: runner.os == 'Windows' |
| 51 | + run: | |
| 52 | + $root = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" |
| 53 | + Import-Module "$root\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" |
| 54 | + Enter-VsDevShell -VsInstallPath $root -DevCmdArguments "-arch=${{ matrix.arch }}" |
| 55 | +
|
| 56 | + ls env: | foreach { "$($_.Name)=$($_.Value)" >> $env:GITHUB_ENV } |
| 57 | +
|
| 58 | + - name: Prepare Enviroment (Linux) |
| 59 | + if: runner.os == 'Windows' |
| 60 | + run: | |
| 61 | + # nothing yet |
| 62 | +
|
| 63 | + - name: Export GitHub Actions cache environment variables |
| 64 | + if: runner.os == 'Windows' |
| 65 | + uses: actions/github-script@v7 |
| 66 | + with: |
| 67 | + script: | |
| 68 | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); |
| 69 | + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); |
| 70 | +
|
| 71 | + - name: Install dependecies (Windows, vcpkg) |
| 72 | + if: runner.os == 'Windows' |
| 73 | + run: | |
| 74 | + C:\vcpkg\vcpkg.exe install --triplet ${{ matrix.vcpkg_triplet }} ` |
| 75 | + apr apr-util expat zlib sqlite3 |
| 76 | +
|
| 77 | + "CMAKE_PREFIX_PATH=C:\vcpkg\installed\${{ matrix.vcpkg_triplet }}" >> $env:GITHUB_ENV |
| 78 | +
|
| 79 | + - name: Install dependecies (Linux, apt-get) |
| 80 | + if: runner.os == 'Linux' |
| 81 | + run: > |
| 82 | + sudo apt-get install |
| 83 | + libtool |
| 84 | + libtool-bin |
| 85 | + libapr1-dev |
| 86 | + libaprutil1-dev |
| 87 | + libexpat1-dev |
| 88 | + zlib1g-dev |
| 89 | + libsqlite3-dev |
| 90 | + ninja-build |
| 91 | +
|
| 92 | + - uses: actions/checkout@v4 |
| 93 | + |
| 94 | + - name: gen-make |
| 95 | + run: python ./gen-make.py -t cmake |
| 96 | + |
| 97 | + - name: Configure CMake |
| 98 | + run: > |
| 99 | + cmake -B out -G Ninja |
| 100 | + -DBUILD_SHARED_LIBS=${{ matrix.build_shared }} |
| 101 | + -DSVN_ENABLE_TESTS=ON |
| 102 | + -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/installdir |
| 103 | +
|
| 104 | + - name: Build CMake |
| 105 | + run: cmake --build out |
| 106 | + |
| 107 | + - name: Install |
| 108 | + run: cmake --install out |
| 109 | + |
| 110 | + - name: Run all tests |
| 111 | + id: run_all_tests |
| 112 | + if: matrix.run_tests |
| 113 | + working-directory: out |
| 114 | + run: ctest --output-on-failure --verbose |
| 115 | + |
| 116 | + - name: Rerun failed tests |
| 117 | + if: ${{ matrix.run_tests && failure() && steps.run_all_tests.conclusion == 'failure' }} |
| 118 | + working-directory: out |
| 119 | + run: ctest --output-on-failure --verbose --rerun-failed |
0 commit comments