Skip to content

reduced the number of builds #108

reduced the number of builds

reduced the number of builds #108

#################################################
# File: .github/workflows/bld-test-upload.yml
# Copyright: 2024 - 2025, Owner of blessio.com
# License: MIT
#################################################
# Used the starter here:
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
# BUILDS KeepasXC
#################################################
name: BLD AND TEST MatrixBased-WIN64-UBUNTU-MacOS
on:
schedule:
- cron: 7 3 * * FRI
# runs every Friday 3:07AM
push:
branches: [ "develop", "devbleo3", bleo8, bleo5_01, bleo5_01.1, bleo5_01.2 ]
pull_request:
branches: [ "devbleo" , bleo5_01 ]
jobs:
build: # BUILD JOB ############################################################################
if: ${{ github.event_name != 'schedule' || github.ref == 'refs/heads/devbleo3' }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
build_type: [RelWithDebInfo] # [RelWithDebInfo,Release,Debug] practically only this one is needed
config:
- os: windows-latest
vcpkg_triplet: x64-windows
github-binarycache: true
# - os: windows-latest
# vcpkg_triplet: arm64-windows # 2025-01-05 This could not compile Qt5 yet
# github-binarycache: true
- os: ubuntu-latest
vcpkg_triplet: x64-linux
github-binarycache: true
- os: macos-latest
vcpkg_triplet: arm64-osx-dynamic-release
github-binarycache: true
- os: macos-13
vcpkg_triplet: x64-osx-dynamic-release
github-binarycache: true
steps:
###################################
- name: 100. Generate UUID
id: generate-uuid
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "uuid=$(powershell -Command '[guid]::NewGuid().ToString()')" >> "$GITHUB_OUTPUT"
else
echo "uuid=$(uuidgen)" >> "$GITHUB_OUTPUT"
fi
- name: 110. Set reusable strings and Environment for actions
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-sub-dir=build" >> "$GITHUB_OUTPUT"
echo "build-root-vcpkg-dir=_vpkg" >> "$GITHUB_OUTPUT"
echo "build-winsdk=10.0.26100" >> "$GITHUB_OUTPUT"
echo "FORCE_JAVASCRIPT_ACTIONS_TO_NODE20=true" >> "$GITHUB_OUTPUT"
echo "bld-var-str=${{ matrix.build_type }}-BLD_ON_${{ matrix.config.os }}_${{ matrix.config.vcpkg_triplet }}_${{ steps.generate-uuid.outputs.uuid }}" >> "$GITHUB_OUTPUT"
echo "bld-humanreadable-str=${{ matrix.config.vcpkg_triplet }} (built on: ${{ matrix.config.os }} of type: ${{ matrix.build_type }})" >> "$GITHUB_OUTPUT"
echo "TRIPLET IS ${{ matrix.config.vcpkg_triplet }}"
echo "Running on ${{ matrix.config.os }}"
- name: 112. MacOS version and environment
if: ${{ startsWith( matrix.config.os , 'macos' ) }}
continue-on-error: true
run: |
xcodebuild -version
sw_vers
- name: 120. Windows Only // Install Winget so that it can use it to install SDK as needed
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
uses: blessio/install-winget@develop # Cyberboss/install-winget@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
wget_release_id: '164835566'
- name: 130. Windows Only // Set Up windows SDK and Ruby and the needed gem of asciidoctor
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
run: |
winget install --source winget --exact --id Microsoft.WindowsSDK.${{ steps.strings.outputs.build-winsdk }} --silent
winget install RubyInstallerTeam.Ruby.3.2 --accept-package-agreements --accept-source-agreements
gem install asciidoctor
- name: 140. Windows Only // Set environment variable VCPKG_ROOT
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
run: |
$env:VCPKG_ROOT = "$env:VCPKG_INSTALLATION_ROOT"
echo "VCPKG_ROOT=$env:VCPKG_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: 150. LINUX Only // Prepare Linux packages that are needed
if: ${{ startsWith( matrix.config.os , 'ubuntu' ) }}
run: >
sudo apt update -y &&
sudo apt install -y build-essential cmake g++ asciidoctor &&
sudo apt install -y qtbase5-dev qtbase5-private-dev qttools5-dev qttools5-dev-tools
libqt5svg5-dev libargon2-dev libminizip-dev libbotan-2-dev libqrencode-dev
libkeyutils-dev zlib1g-dev libreadline-dev libpcsclite-dev libusb-1.0-0-dev
libxi-dev libxtst-dev libqt5x11extras5-dev
#- name: 170. MACOS Only // commandline extension
# if: ${{ startsWith( matrix.config.os , 'macos' ) }}
# continue-on-error: true
# run: xcode-select --install
- name: 171. MACOS Only // Homebrew
if: ${{ startsWith( matrix.config.os , 'macos' ) }}
continue-on-error: true
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: 172. MACOS Only cmake and asciidoctor
if: ${{ startsWith( matrix.config.os , 'macos' ) }}
continue-on-error: true
run: brew install asciidoctor
- name: 173.0 MACOS (re)install pyhon
if: ${{ startsWith( matrix.config.os , 'macos' ) }}
continue-on-error: true
run: |
brew uninstall --ignore-dependencies python ||
brew uninstall --ignore-dependencies python3
- name: 173.2 MACOS (re)install pyhon
if: ${{ startsWith( matrix.config.os , 'macos' ) }}
continue-on-error: true
run: |
brew install python@3.12
- name: 173.4 MACOS (re)install pyhon
if: ${{ startsWith( matrix.config.os , 'macos' ) }}
continue-on-error: true
run: |
python3 --version
- name: 173.5 MACOS (re)install pyhon
if: ${{ startsWith( matrix.config.os , 'macos' ) }}
continue-on-error: true
run: |
python --version
- name: 174. MACOS Only PKGs
if: ${{ startsWith( matrix.config.os , 'macos' ) }}
continue-on-error: true
run: brew install pkg-config vcpkg
- name: 180. get the Source from Git
uses: actions/checkout@v4
- name: 300. Windows AND MacOS // VCPKG install build
id: vcpkg1
if: ${{ startsWith( matrix.config.os , 'macos' ) || startsWith( matrix.config.os , 'windows' ) }}
uses: blessio/vcpkg-actionB@bleo_v7.1.0 # vbleo7.0
with:
manifest-dir: ${{ github.workspace }} # Set to directory containing vcpkg.json
# No verbose available extra-args: ' --x-make '
triplet: ${{matrix.config.vcpkg_triplet }} # x64-windows-release
token: ${{ github.token }}
github-binarycache: true
vcpkg-subdir: ${{steps.strings.outputs.build-root-vcpkg-dir}}
cache-key: "kpxco7-1-${{ matrix.config.vcpkg_triplet }}"
fetch-depth: "0"
- name: 550. Windows ONLY // Configure CMake
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
run: >
mkdir ${{ steps.strings.outputs.build-sub-dir }} &&
cd ${{ steps.strings.outputs.build-sub-dir }} &&
cmake -DWITH_XC_ALL=ON -DWITH_GUI_TESTS=ON
-DCMAKE_SYSTEM_VERSION=${{ steps.strings.outputs.build-winsdk }}
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}\${{ steps.strings.outputs.build-root-vcpkg-dir}}\scripts\buildsystems\vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=${{ matrix.config.vcpkg_triplet}}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
..
- name: 555. MacOS ONLY // Configure CMake
if: ${{ startsWith( matrix.config.os , 'macos' ) }}
run: >
mkdir ${{ steps.strings.outputs.build-sub-dir }} &&
cd ${{ steps.strings.outputs.build-sub-dir }} &&
cmake -DWITH_XC_ALL=ON -DWITH_GUI_TESTS=ON
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/${{ steps.strings.outputs.build-root-vcpkg-dir}}/scripts/buildsystems/vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=${{ matrix.config.vcpkg_triplet }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
..
- name: 560. LINUX ONLY // Configure CMake
if: ${{ startsWith( matrix.config.os , 'ubuntu' ) }}
run: >
mkdir ${{ steps.strings.outputs.build-sub-dir }} &&
cd ${{ steps.strings.outputs.build-sub-dir }} &&
cmake -DWITH_XC_ALL=ON -DWITH_GUI_TESTS=ON
-DVCPKG_TARGET_TRIPLET=${{ matrix.config.vcpkg_triplet }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
..
- name: 600. Windows Check DiskSpace
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
run: >
Get-PSDrive -PSProvider FileSystem | Select-Object Name, @{Name="Used (GB)";Expression={[math]::round($_.Used/1GB,2)}},
@{Name="Free (GB)";Expression={[math]::round($_.Free/1GB,2)}}
#- name: Print all environement Variables
# run: >
# Get-ChildItem Env: | Sort-Object Name
- name: 650. Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
working-directory: ${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}
run: |
cmake --build . --config ${{ matrix.build_type }}
# Prep for the tests
- name: 700. Windows Only // ADD paths to some special DLLs needed for the testing
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
run: |
$env:PATH="$env:PATH;${{ github.workspace }}\${{ steps.strings.outputs.build-sub-dir }}\src\autotype\test\${{ matrix.build_type }}"
echo "PATH=$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: 710. Linux ONLY // ADD paths to TESTS and prepare GUI Tests, print environment
if: ${{ startsWith( matrix.config.os , 'ubuntu' ) }}
run: |
# echo "export PATH=$PATH:${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/src/autotype/test/${{ matrix.build_type }}" >> ~/.bashrc
echo "PATH=$PATH:${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/src/autotype/test/${{ matrix.build_type }}" >> $GITHUB_ENV
# sudo apt-get install xvfb # is already installed on GitHUB Linux runner
Xvfb :99 -ac &
# echo "export DISPLAY=:99" >> ~/.bashrc
echo "DISPLAY=:99" >> $GITHUB_ENV
- name: 730. PRINT Environment Variables on Windows
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
run: |
Get-ChildItem Env: | Sort-Object Name
cd "${{ github.workspace }}\${{ steps.strings.outputs.build-sub-dir }}\src\autotype\test\${{ matrix.build_type }}"
ls
- name: 731. PRINT Environment Variables on NON-Windows
if: ${{ ! startsWith( matrix.config.os , 'windows' ) }}
run: |
echo "Environment printed"
echo "===== ALL ENV START ====="
printenv | sort
echo "===== ALL ENV END ====="
echo "List of files and folders in buildtype subdir"
ls
# END OF PREP for TEST
- name: 750. AUTOMATIC TESTS
working-directory: ${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
shell: bash
continue-on-error: true
run: > # this sequence is executed so that the result can be both parsed in a later step (step_summary) and visible in the step itself
ctest --build-config ${{ matrix.build_type }} > ctest-pass1.txt &&
cat ctest-pass1.txt ||
ctest --build-config ${{ matrix.build_type }} --rerun-failed --output-on-failure > ctest-pass2-results-of-failedonly.txt ||
cat ctest-pass1.txt ctest-pass2-results-of-failedonly.txt
- name: 760. Install RUN on any host with bash
working-directory: ${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
shell: bash
continue-on-error: true
run: >
cmake --install ${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}
--config ${{ matrix.build_type }}
--prefix ${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/_install -v
- name: 770. WINDOWS ONLY // Upload build Executables
if: ${{ startsWith( matrix.config.os , 'windows' ) }}
id: a-wexecutables
uses: actions/upload-artifact@v4
with:
name: build-win-executables-${{ steps.strings.outputs.bld-var-str }}
path: |
${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/src/${{ matrix.build_type }}
- name: 780. NON-WINDOWS // Upload build Executables
if: ${{ ! startsWith( matrix.config.os , 'windows' ) }}
id: a-executables
uses: actions/upload-artifact@v4
with:
name: build-non-win-executables-${{ steps.strings.outputs.bld-var-str }}
path: |
${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/_install
- name: 790. Upload build Test Result Logs
id: a-TestLog
uses: actions/upload-artifact@v4
with:
name: Test-Logs ${{ steps.strings.outputs.bld-var-str }}
if-no-files-found: ignore # Last file will be present only if there are failed tests
path: |
${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/Testing/Temporary
${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/ctest-pass1.txt
${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/ctest-pass2-results-of-failedonly.txt
- name: 800. SUMMARY PAGE UPDATE
working-directory: ${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}
shell: bash
continue-on-error: true
run: |
echo "### ${{ steps.strings.outputs.bld-humanreadable-str }}" >> $GITHUB_STEP_SUMMARY
echo " - Download built files from: ${{ steps.a-wexecutables.outputs.artifact-url }} ${{ steps.a-executables.outputs.artifact-url }}" >> $GITHUB_STEP_SUMMARY
if [ -f ctest-pass2-results-of-failedonly.txt ]; then
echo -e " - 🟡 Some tests **failed**. " >> $GITHUB_STEP_SUMMARY
# echo all lines from file ctest-pass2-results-of-failedonly.txt starting from the line that contains the string "The following tests FAILED:"
awk '/The following tests FAILED:/ {flag=1; next} /Errors while running CTest/ {flag=0} flag {print " " $0}' ctest-pass2-results-of-failedonly.txt >> $GITHUB_STEP_SUMMARY
echo " Download the test results to check why. Look into \`ctest-pass2-results-of-failedonly.txt\` file in Test-Result logs, which " >> $GITHUB_STEP_SUMMARY
else
echo -e " - 🟢 All tests **passed**. Test-Result logs " >> $GITHUB_STEP_SUMMARY
fi
echo -e "are here: ${{ steps.a-TestLog.outputs.artifact-url }}." >> $GITHUB_STEP_SUMMARY
# - `\u26A0` represents the warning emoji ⚠️.
# - `\u2705` represents the check mark emoji ✅.
# - `\u274C` represents the cross mark emoji `❌`.
# - 🟢 represents a green circle.
# - 🟡 represents a yellow circle.
# - 🔴 represents a red circle.