BLD AND TEST MatrixBased-WIN64-UBUNTU-MacOS #112
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# File: .github/workflows/bld-test-upload.yml | |
# Copyright: 2024, 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 ] | |
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,Debug] #Release with no debug info is useless I believe | |
config: | |
- os: windows-latest | |
vcpkg_triplet: x64-windows | |
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 | |
uses: filipstefansson/uuid-action@v1 | |
- 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 "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 | |
- name: 173.1 MACOS (re)install pyhon | |
if: ${{ startsWith( matrix.config.os , 'macos' ) }} | |
continue-on-error: true | |
run: | | |
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 [email protected] | |
- name: 173.3 MACOS (re)install pyhon | |
if: ${{ startsWith( matrix.config.os , 'macos' ) }} | |
continue-on-error: true | |
run: | | |
pip install setuptools | |
- 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 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: 500. Print intermediate environment results | |
shell: bash | |
run: | | |
echo " ***** RECOMENDED CMAKE CONFIG is ${{ steps.vcpkg.outputs.vcpkg-cmake-config }}" | |
echo " ***** HASH IS ${{ steps.vcpkg.outputs.vcpkg-cache-hash }}" | |
- 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 | |
-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 }} | |
-DWITH_GUI_TESTS=ON | |
.. | |
- 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 | |
-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 }} | |
-DWITH_GUI_TESTS=ON | |
.. | |
- 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 | |
.. | |
- 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 specual 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 // ADD paths to some specual DLLs needed for the testing | |
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 | |
source ~/.bashrc | |
- name: 730. PRINT Environment Variable | |
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: 750. Test | |
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: | | |
ctest --build-config ${{ matrix.build_type }} | |
ctest --build-config ${{ matrix.build_type }} --rerun-failed --output-on-failure | |
- 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' ) }} | |
uses: actions/upload-artifact@v3 | |
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' ) }} | |
uses: actions/upload-artifact@v3 | |
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 | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test-Logs ${{ steps.strings.outputs.bld-var-str }} | |
path: | | |
${{ github.workspace }}/${{ steps.strings.outputs.build-sub-dir }}/Testing/Temporary |