CI: Also fetch build number token on GA

GitHub Actions previously did not use the build number token. This is
changed by this commit. In order to to so, the build process has been
outsourced into its own script.
This commit is contained in:
Robert Adam 2022-05-01 14:30:41 +02:00
parent 28e97073cb
commit 26d64edcc5
2 changed files with 32 additions and 13 deletions

27
.github/workflows/build.sh vendored Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
buildDir="${GITHUB_WORKSPACE}/build"
mkdir "$buildDir"
cd "$buildDir"
VERSION=$("${GITHUB_WORKSPACE}/scripts/mumble-version.py")
BUILD_NUMBER=$("${GITHUB_WORKSPACE}/scripts/mumble-build-number.py" --commit "${GITHUB_SHA}" --version "${VERSION}" \
--password "${MUMBLE_BUILD_NUMBER_TOKEN}" --default 0)
# Run cmake with all necessary options
cmake -G Ninja \
-S "$GITHUB_WORKSPACE" \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DBUILD_NUMBER=$BUILD_NUMBER \
$CMAKE_OPTIONS \
-DCMAKE_UNITY_BUILD=ON \
$ADDITIONAL_CMAKE_OPTIONS \
$VCPKG_CMAKE_OPTIONS
# Actually build
cmake --build . --config $BUILD_TYPE

View File

@ -50,22 +50,14 @@ jobs:
arch: ${{ matrix.arch }}
- name: Create build dir
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Run CMake
run: |
cmake -G Ninja -S $GITHUB_WORKSPACE -B ${{runner.workspace}}/build -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_OPTIONS \
-DCMAKE_UNITY_BUILD=ON $ADDITIONAL_CMAKE_OPTIONS $VCPKG_CMAKE_OPTIONS
shell: bash
- name: Build
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE
run: ./.github/workflows/build.sh
shell: bash
env:
MUMBLE_BUILD_NUMBER_TOKEN: ${{ secrets.BUILD_NUMBER_TOKEN }}
- name: Test
working-directory: ${{runner.workspace}}/build
working-directory: ${{ github.workspace }}/build
shell: bash
run: QT_QPA_PLATFORM=offscreen ctest -output-on-failure -C $BUILD_TYPE
run: QT_QPA_PLATFORM=offscreen ctest --output-on-failure -C $BUILD_TYPE