diff --git a/.github/actions/build-cmake-preset/action.yml b/.github/actions/build-cmake-preset/action.yml index e1ac34ac2..66b38a51a 100644 --- a/.github/actions/build-cmake-preset/action.yml +++ b/.github/actions/build-cmake-preset/action.yml @@ -13,20 +13,56 @@ inputs: cmake-args: description: "Additional CMake arguments" required: false - + do-package-symbols: + description: "In Debug builds, split symbols and provide a zip package" + required: false + type: boolean + do-package: + description: "Run `cmake --target package` and upload artifact" + required: false + type: boolean + run-tests: + description: "Run tests" + required: false + default: true + type: boolean + toolset: + type: string + default: '14.1' + description: "MSVC tool set to use" + required: false + build-arch: + type: string + default: "x64" + description: "MSVC build architecture to use" + required: false + +outputs: + package-name: + description: artifact name of the distribution zip + value: "${{ steps.cmake-package.outputs.package-name }}" + package-path: + description: file path of the distribution zip + value: "${{ steps.cmake-package.outputs.package-path }}" + symbols-package-path: + description: file path of the symbols zip + value: "${{ steps.cmake-package.outputs.symbols-package-path }}" + symbols-package-name: + description: artifact name of the symbols zip + value: "${{ steps.cmake-package.outputs.symbols-package-name }}" + runs: using: composite steps: - - name: Setup host - if: runner.os == 'Linux' - run: sudo apt install -y ninja-build doxygen clang-12 llvm-12 - id: setup-host-linux - shell: bash - - name: Setup host if: runner.os == 'Windows' - run: choco install -y ninja + run: | + choco install -y ninja + choco install -y doxygen.install + pip install breathe==4.34.0 + pip install sphinx==5.1.1 + pip install sphinx-rtd-theme==1.0.0 id: setup-host-windows shell: powershell @@ -40,8 +76,8 @@ runs: if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1.12.0 with: - arch: x64 - toolset: '14.1' + arch: ${{ inputs.build-arch }} + toolset: ${{ inputs.toolset }} id: setup-env-windows - name: Configure ${{ inputs.preset-name }} @@ -55,13 +91,42 @@ runs: shell: bash - name: test ${{ inputs.preset-name }} + if: ${{ inputs.run-tests == 'true' }} id: ctests run: ctest --preset ${{ inputs.preset-name }} --output-on-failure -R '^(I|T)' shell: bash - name: stash test reports ${{ inputs.preset-name }} - if: ${{ inputs.upload-testlog }} + if: ${{ inputs.upload-testlog == 'true' }} uses: actions/upload-artifact@v3 with: - name: ${{ inputs.preset-name }} + name: "${{ inputs.preset-name }}-test-results" path: '_build/**/*gtestresults.xml' + + - name: create cmake package for ${{ inputs.preset-name }} + if: ${{ inputs.do-package == 'true' }} + id: cmake-package + run: | + cmake --build --preset ${{ inputs.preset-name }} --target package + echo "package-name=$(basename _build/${{inputs.preset-name}}/_CPack_Packages/*/ZIP/SilKit-*-*/)" >> $GITHUB_OUTPUT + # keep our original zip, otherwise the execute bits are lost + echo "package-path=$(echo _build/${{inputs.preset-name}}/_CPack_Packages/*/ZIP/SilKit-*-*.zip)" >> $GITHUB_OUTPUT + echo "symbols-package-name=$(basename _build/${{inputs.preset-name}}/SilKit-*-*-SYMBOLS.zip)" >> $GITHUB_OUTPUT + echo "symbols-package-path=$(echo _build/${{inputs.preset-name}}/SilKit-*-*-SYMBOLS.zip)" >> $GITHUB_OUTPUT + shell: bash + + - name: upload package ${{ inputs.preset-name }} + if: ${{ inputs.do-package == 'true' }} + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.cmake-package.outputs.package-name }} + path: ${{ steps.cmake-package.outputs.package-path }} + if-no-files-found: 'error' + + - name: upload symbols package ${{ inputs.preset-name }} + if: ${{ inputs.do-package-symbols == 'true' }} + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.cmake-package.outputs.symbols-package-name }} + path: ${{ steps.cmake-package.outputs.symbols-package-path}} + if-no-files-found: 'error' diff --git a/.github/actions/make-package/action.yml b/.github/actions/make-package/action.yml new file mode 100644 index 000000000..4a26a0d78 --- /dev/null +++ b/.github/actions/make-package/action.yml @@ -0,0 +1,44 @@ +name: make distribution package +description: Create a release package with release and debug binaries + +inputs: + debug-package-name: + required: true + type: string + description: The name of the debug build job + release-package-name: + required: true + type: string + description: The name of the release build job +runs: + using: composite + steps: + + - name: fetch debug package + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.debug-package-name }} + path: bundle + + - name: fetch release package + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.release-package-name }} + path: bundle + + + - name: bundle release and debug build + id: bundle-zip + run: | + python3 SilKit/ci/package.py bundle/*.zip + PACKAGE=$(ls -1 SilKit-*.zip | sed 's/.zip$//'g) + echo $PACKAGE + echo "package-name=$PACKAGE" >> $GITHUB_OUTPUT + shell: bash + + - name: Upload final SIL Kit package + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.bundle-zip.outputs.package-name }} + path: ${{ steps.bundle-zip.outputs.package-name }}.zip + if-no-files-found: 'error' diff --git a/.github/workflows/build-release-packages.yml b/.github/workflows/build-release-packages.yml new file mode 100644 index 000000000..f5de9fc85 --- /dev/null +++ b/.github/workflows/build-release-packages.yml @@ -0,0 +1,175 @@ +name: SIL Kit release packages +on: + workflow_dispatch + +jobs: + + gcc8-release: + environment: public-github-runners + runs-on: ubuntu-latest + container: + image: vectorgrp/sil-kit:ci-ubuntu-18.04 + outputs: + package-name: ${{ steps.build.outputs.package-name}} + steps: + - name: git checkout + uses: actions/checkout@v1 + with: + submodules: true + - name: gcc8-release build + uses: ./.github/actions/build-cmake-preset + id: build + with: + preset-name: gcc8-release + cmake-args: -D SILKIT_INSTALL_SOURCE=ON + do-package: true + run-tests: true + + + gcc8-debug: + environment: public-github-runners + runs-on: ubuntu-latest + container: + image: vectorgrp/sil-kit:ci-ubuntu-18.04 + outputs: + package-name: ${{ steps.build.outputs.package-name}} + steps: + - name: git checkout + uses: actions/checkout@v1 + with: + submodules: true + - name: gcc8-debug build + uses: ./.github/actions/build-cmake-preset + id: build + with: + preset-name: gcc8-debug + do-package: true + run-tests: false + do-package-symbols: true + + gcc8-package: + needs: [ gcc8-release, gcc8-debug ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + sparse-checkout: | + .github + SilKit/ci/package.py + - uses: ./.github/actions/make-package + with: + debug-package-name: ${{needs.gcc8-debug.outputs.package-name}} + release-package-name: ${{needs.gcc8-release.outputs.package-name}} + + vs141-x86-release: + environment: public-github-runners + runs-on: windows-latest + outputs: + package-name: ${{ steps.build.outputs.package-name}} + steps: + - name: git checkout + uses: actions/checkout@v1 + with: + submodules: true + - name: vs141-x86-release + uses: ./.github/actions/build-cmake-preset + id: build + with: + preset-name: vs141-x86-release + do-package: true + cmake-args: -D SILKIT_INSTALL_SOURCE=ON + run-tests: true + toolset: 14.1 + build-arch: x86 + + vs141-x86-debug: + environment: public-github-runners + runs-on: windows-latest + outputs: + package-name: ${{ steps.build.outputs.package-name}} + steps: + - name: git checkout + uses: actions/checkout@v1 + with: + submodules: true + - name: vs141-x86-debug + uses: ./.github/actions/build-cmake-preset + id: build + with: + preset-name: vs141-x86-debug + do-package: true + do-package-symbols: true + run-tests: false + toolset: 14.1 + build-arch: x86 + + vs141-x86-package: + needs: [ vs141-x86-release, vs141-x86-debug ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + sparse-checkout: | + .github + SilKit/ci/package.py + - uses: ./.github/actions/make-package + with: + debug-package-name: ${{needs.vs141-x86-debug.outputs.package-name}} + release-package-name: ${{needs.vs141-x86-release.outputs.package-name}} + + + vs141-x64-release: + environment: public-github-runners + runs-on: windows-latest + outputs: + package-name: ${{ steps.build.outputs.package-name}} + steps: + - name: git checkout + uses: actions/checkout@v1 + with: + submodules: true + - name: vs141-x64-release + uses: ./.github/actions/build-cmake-preset + id: build + with: + preset-name: vs141-x64-release + do-package: true + cmake-args: -D SILKIT_INSTALL_SOURCE=ON + run-tests: true + toolset: 14.1 + build-arch: x64 + + vs141-x64-debug: + environment: public-github-runners + runs-on: windows-latest + outputs: + package-name: ${{ steps.build.outputs.package-name}} + steps: + - name: git checkout + uses: actions/checkout@v1 + with: + submodules: true + - name: vs141-x64-debug + uses: ./.github/actions/build-cmake-preset + id: build + with: + preset-name: vs141-x64-debug + do-package: true + do-package-symbols: true + run-tests: false + toolset: 14.1 + build-arch: x64 + + vs141-x64-package: + needs: [ vs141-x64-release, vs141-x64-debug ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + sparse-checkout: | + .github + SilKit/ci/package.py + - uses: ./.github/actions/make-package + with: + debug-package-name: ${{needs.vs141-x64-debug.outputs.package-name}} + release-package-name: ${{needs.vs141-x64-release.outputs.package-name}} diff --git a/SilKit/ci/package.py b/SilKit/ci/package.py index 3aae16dea..488c0f3bf 100755 --- a/SilKit/ci/package.py +++ b/SilKit/ci/package.py @@ -176,7 +176,7 @@ def parseArgs(): files.append(cpack) if len(files) != len(build_types): die(2, "sanity check failed: more cpack files than supported build types" - "given as argument (expected: {}".format(build_types)) + " given as argument (expected: {}). arguments: {} ".format(build_types, files)) if not isCompatibleCpack(files[0], files[1]): die(3, "incompatible cpack files (based on name schema) detected!")