|
| 1 | +name: projmgr |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + paths: |
| 5 | + - '.github/workflows/projmgr.yml' |
| 6 | + - 'CMakeLists.txt' |
| 7 | + - 'libs/crossplatform/**' |
| 8 | + - 'libs/rtefsutils/**' |
| 9 | + - 'libs/xmlreader/**' |
| 10 | + - 'libs/xmltree/**' |
| 11 | + - 'libs/xmltreeslim/**' |
| 12 | + - 'tools/projmgr/**' |
| 13 | + release: |
| 14 | + types: [published] |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + if: ${{ github.event_name == 'pull_request' || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/projmgr/')) }} |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + timeout-minutes: 15 |
| 21 | + strategy: |
| 22 | + fail-fast: true |
| 23 | + matrix: |
| 24 | + os: [ macos-10.15, ubuntu-20.04, windows-2019 ] |
| 25 | + include: |
| 26 | + - os: macos-10.15 |
| 27 | + target: darwin64 |
| 28 | + binary: projmgr |
| 29 | + - os: ubuntu-20.04 |
| 30 | + target: linux64 |
| 31 | + binary: projmgr |
| 32 | + - os: windows-2019 |
| 33 | + target: windows64 |
| 34 | + binary: projmgr.exe |
| 35 | + |
| 36 | + steps: |
| 37 | + - name: Install macos deps |
| 38 | + if: ${{ startsWith(matrix.os, 'macos') }} |
| 39 | + run: | |
| 40 | + brew install \ |
| 41 | + ninja \ |
| 42 | + python \ |
| 43 | + swig |
| 44 | +
|
| 45 | + - name: Install linux deps |
| 46 | + if: ${{ startsWith(matrix.os, 'ubuntu') }} |
| 47 | + run: | |
| 48 | + sudo apt update |
| 49 | + sudo apt-get install \ |
| 50 | + bc \ |
| 51 | + build-essential \ |
| 52 | + ninja-build \ |
| 53 | + python-dev \ |
| 54 | + swig |
| 55 | +
|
| 56 | + - name: Install windows deps |
| 57 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 58 | + run: choco install -y ninja python swig |
| 59 | + |
| 60 | + - name: Checkout devtools |
| 61 | + uses: actions/checkout@v2 |
| 62 | + with: |
| 63 | + submodules: true |
| 64 | + |
| 65 | + - name: Create build folders |
| 66 | + run: | |
| 67 | + mkdir build |
| 68 | + mkdir buildswig |
| 69 | +
|
| 70 | + - name: Configure windows build for amd64 |
| 71 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 72 | + uses: ilammy/msvc-dev-cmd@v1 |
| 73 | + with: |
| 74 | + arch: amd64 |
| 75 | + |
| 76 | + - uses: ammaraskar/gcc-problem-matcher@master |
| 77 | + if: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }} |
| 78 | + - uses: ammaraskar/msvc-problem-matcher@master |
| 79 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 80 | + |
| 81 | + - name: Build projmgr |
| 82 | + run: | |
| 83 | + cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .. |
| 84 | + cmake --build . --target projmgr |
| 85 | + working-directory: ./build |
| 86 | + |
| 87 | + - name: Archive projmgr |
| 88 | + uses: actions/upload-artifact@v2 |
| 89 | + with: |
| 90 | + name: projmgr-${{ matrix.target }} |
| 91 | + path: ./build/tools/projmgr/${{ matrix.target }}/Release/${{ matrix.binary }} |
| 92 | + retention-days: 1 |
| 93 | + if-no-files-found: error |
| 94 | + |
| 95 | + - name: Build projmgr swig libs |
| 96 | + run: | |
| 97 | + cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DSWIG_LIBS=ON .. |
| 98 | + cmake --build . --target projmgr --config Release |
| 99 | + working-directory: ./buildswig |
| 100 | + |
| 101 | + - name: Archive projmgr swig libs windows |
| 102 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 103 | + uses: actions/upload-artifact@v2 |
| 104 | + with: |
| 105 | + name: projmgr-swig-${{ matrix.target }} |
| 106 | + path: | |
| 107 | + ./buildswig/tools/projmgr/swig/projmgr.py |
| 108 | + ./buildswig/tools/projmgr/swig/_projmgr.pyd |
| 109 | + retention-days: 1 |
| 110 | + |
| 111 | + - name: Archive projmgr swig libs macos ubuntu |
| 112 | + if: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }} |
| 113 | + uses: actions/upload-artifact@v2 |
| 114 | + with: |
| 115 | + name: projmgr-swig-${{ matrix.target }} |
| 116 | + path: | |
| 117 | + ./buildswig/tools/projmgr/swig/projmgr.py |
| 118 | + ./buildswig/tools/projmgr/swig/_projmgr.so |
| 119 | + retention-days: 1 |
| 120 | + |
| 121 | + release: |
| 122 | + if: ${{ github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/projmgr/') }} |
| 123 | + needs: [ build, unittest ] |
| 124 | + runs-on: ubuntu-20.04 |
| 125 | + timeout-minutes: 15 |
| 126 | + |
| 127 | + steps: |
| 128 | + - name: Checkout devtools |
| 129 | + uses: actions/checkout@v2 |
| 130 | + |
| 131 | + - name: Create distribution folders |
| 132 | + run: | |
| 133 | + mkdir -p tools/projmgr/distribution/bin tools/projmgr/distribution/lib tools/projmgr/distribution/doc |
| 134 | + cp tools/projmgr/docs/LICENSE.txt tools/projmgr/distribution/ |
| 135 | + cp tools/projmgr/docs/README.md tools/projmgr/distribution/doc/ |
| 136 | +
|
| 137 | + - name: Download projmgr linux |
| 138 | + uses: actions/download-artifact@v2 |
| 139 | + with: |
| 140 | + name: projmgr-linux64 |
| 141 | + path: tools/projmgr/distribution/bin/linux64/ |
| 142 | + |
| 143 | + - name: Download projmgr macos |
| 144 | + uses: actions/download-artifact@v2 |
| 145 | + with: |
| 146 | + name: projmgr-darwin64 |
| 147 | + path: tools/projmgr/distribution/bin/darwin64/ |
| 148 | + |
| 149 | + - name: Download projmgr windows |
| 150 | + uses: actions/download-artifact@v2 |
| 151 | + with: |
| 152 | + name: projmgr-windows64 |
| 153 | + path: tools/projmgr/distribution/bin/windows64/ |
| 154 | + |
| 155 | + - name: Download projmgr-swig linux |
| 156 | + uses: actions/download-artifact@v2 |
| 157 | + with: |
| 158 | + name: projmgr-swig-linux64 |
| 159 | + path: tools/projmgr/distribution/lib/linux64/ |
| 160 | + |
| 161 | + - name: Download projmgr-swig macos |
| 162 | + uses: actions/download-artifact@v2 |
| 163 | + with: |
| 164 | + name: projmgr-swig-darwin64 |
| 165 | + path: tools/projmgr/distribution/lib/darwin64/ |
| 166 | + |
| 167 | + - name: Download projmgr-swig windows |
| 168 | + uses: actions/download-artifact@v2 |
| 169 | + with: |
| 170 | + name: projmgr-swig-windows64 |
| 171 | + path: tools/projmgr/distribution/lib/windows64/ |
| 172 | + |
| 173 | + - name: Zip distribution folder |
| 174 | + run: zip -r projmgr.zip * |
| 175 | + working-directory: tools/projmgr/distribution |
| 176 | + |
| 177 | + - name: Attach zip archive to release assets |
| 178 | + uses: svenstaro/upload-release-action@v2 |
| 179 | + with: |
| 180 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 181 | + file: tools/projmgr/distribution/projmgr.zip |
| 182 | + tag: ${{ github.ref }} |
| 183 | + overwrite: true |
| 184 | + asset_name: projmgr.zip |
| 185 | + |
| 186 | + unittest: |
| 187 | + if: ${{ github.event_name == 'pull_request' || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/projmgr/')) }} |
| 188 | + runs-on: ${{ matrix.os }} |
| 189 | + timeout-minutes: 15 |
| 190 | + strategy: |
| 191 | + fail-fast: true |
| 192 | + matrix: |
| 193 | + os: [ macos-10.15, ubuntu-20.04, windows-2019 ] |
| 194 | + include: |
| 195 | + - os: macos-10.15 |
| 196 | + target: darwin64 |
| 197 | + - os: ubuntu-20.04 |
| 198 | + target: linux64 |
| 199 | + - os: windows-2019 |
| 200 | + target: windows64 |
| 201 | + |
| 202 | + steps: |
| 203 | + - name: Install macos deps |
| 204 | + if: ${{ startsWith(matrix.os, 'macos') }} |
| 205 | + run: | |
| 206 | + brew install \ |
| 207 | + ninja |
| 208 | +
|
| 209 | + - name: Install linux deps |
| 210 | + if: ${{ startsWith(matrix.os, 'ubuntu') }} |
| 211 | + run: | |
| 212 | + sudo apt update |
| 213 | + sudo apt-get install \ |
| 214 | + bc \ |
| 215 | + build-essential \ |
| 216 | + ninja-build |
| 217 | +
|
| 218 | + - name: Install windows deps |
| 219 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 220 | + run: choco install -y ninja |
| 221 | + |
| 222 | + - name: Checkout devtools |
| 223 | + uses: actions/checkout@v2 |
| 224 | + with: |
| 225 | + submodules: true |
| 226 | + |
| 227 | + - name: Create build folder |
| 228 | + run: mkdir build |
| 229 | + |
| 230 | + - name: Configure windows build for amd64 |
| 231 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 232 | + uses: ilammy/msvc-dev-cmd@v1 |
| 233 | + with: |
| 234 | + arch: amd64 |
| 235 | + |
| 236 | + - uses: ammaraskar/gcc-problem-matcher@master |
| 237 | + if: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }} |
| 238 | + - uses: ammaraskar/msvc-problem-matcher@master |
| 239 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 240 | + |
| 241 | + - name: Build and run projmgr unit tests |
| 242 | + run: | |
| 243 | + cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug .. |
| 244 | + cmake --build . --target ProjMgrUnitTests |
| 245 | + ctest -C Debug -R ProjMgrUnitTests |
| 246 | + working-directory: ./build |
| 247 | + |
| 248 | + - name: Archive unit tests results |
| 249 | + uses: actions/upload-artifact@v2 |
| 250 | + with: |
| 251 | + name: unittest-${{ matrix.target }} |
| 252 | + path: ./build/Testing/Temporary/LastTest.log |
| 253 | + retention-days: 1 |
| 254 | + if-no-files-found: error |
| 255 | + if: ${{ always() }} |
| 256 | + |
| 257 | + - name: Publish projmgr unit test results |
| 258 | + uses: mikepenz/action-junit-report@v2 |
| 259 | + with: |
| 260 | + check_name: "projmgr unit tests [${{ matrix.target }}]" |
| 261 | + report_paths: build/projmgr_unit_test_report.xml |
| 262 | + |
0 commit comments