From ed3a9cb4d33526253d01d4c1a5c6a9d34dd9fbfe Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Tue, 9 Jul 2024 17:10:08 +0200 Subject: [PATCH] ci-staging: split build action --- .../sil-kit-ci-configure-build/action.yml | 75 +++++++++++++++++ .../action.yml | 82 +++++++++++++++++++ .github/workflows/build-linux.yml | 24 ++++-- 3 files changed, 174 insertions(+), 7 deletions(-) create mode 100644 .github/actions/sil-kit-ci-configure-build/action.yml create mode 100644 .github/actions/sil-kit-ci-setup-build-environment/action.yml diff --git a/.github/actions/sil-kit-ci-configure-build/action.yml b/.github/actions/sil-kit-ci-configure-build/action.yml new file mode 100644 index 00000000..466dbccd --- /dev/null +++ b/.github/actions/sil-kit-ci-configure-build/action.yml @@ -0,0 +1,75 @@ +name: sil-kil ci: configure build + +inputs: + preset-name: + description: "The preset name from CMakePresets.json." + required: true + upload-testlog: + description: "Upload gtest log with same name as preset-name" + required: false + default: true + type: boolean + 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 + retention-days: + description: "How long we keep the artifacts" + required: false + type: number + default: 14 + 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 + linux-docker-image: + type: string + default: ghcr.io/mariusbgm/sil-kit-ci-ubuntu-22.04:main + description: "Docker image used under Linux" + 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: (linux) configure cmake preset + run: | + docker run \ + -v "${{ github.workspace }}/s/sil-kit:/s" \ + -v "${{ github.workspace }}/b/linux:/b" \ + "${{ inputs.linux-docker-image }}" \ + gcc --version + if: runner.os == 'Linux' + shell: bash diff --git a/.github/actions/sil-kit-ci-setup-build-environment/action.yml b/.github/actions/sil-kit-ci-setup-build-environment/action.yml new file mode 100644 index 00000000..0271de4b --- /dev/null +++ b/.github/actions/sil-kit-ci-setup-build-environment/action.yml @@ -0,0 +1,82 @@ +name: SIL Kit CI: Setup build environment + +inputs: + preset-name: + description: "The preset name from CMakePresets.json." + required: true + upload-testlog: + description: "Upload gtest log with same name as preset-name" + required: false + default: true + type: boolean + 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 + retention-days: + description: "How long we keep the artifacts" + required: false + type: number + default: 14 + 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 + linux-docker-image: + type: string + default: ghcr.io/mariusbgm/sil-kit-ci-ubuntu-22.04:main + description: "Docker image used under Linux" + 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: (all) checkout sil-kit sources + uses: actions/checkout@v1 + with: + path: s/sil-kit + submodules: true + + - name: (linux) create build directory + run: mkdir b/linux + if: runner.os == 'Linux' + shell: bash + + - name: (linux) pull docker image for building via cmake + run: docker pull "${{ inputs.linux-docker-image }}" + if: runner.os == 'Linux' + shell: bash + diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index e7908ffd..5ddeaa2a 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -20,18 +20,28 @@ on: jobs: ci-testing: - name: CI Testing + name: Linux Build environment: public-github-runners runs-on: ubuntu-22.04 if: inputs.run_build == true steps: - - name: git checkout - uses: actions/checkout@v1 + + #- name: git checkout + # uses: actions/checkout@v1 + # with: + # submodules: true + + - name: setup build environment + uses: ./.github/actions/sil-kit-ci-setup-build-environment + id: setup-build-environment with: - submodules: true - - name: GCC release build - uses: ./.github/actions/build-cmake-preset - id: build + preset-name: linux-release + do-package: ${{ inputs.do_package }} + retention-days: ${{ env.retention_days }} + + - name: configure build + uses: ./.github/actions/sil-kit-ci-configure-build + id: configure-build with: preset-name: linux-release do-package: ${{ inputs.do_package }}