Attempt2 on MacOS #10
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: | |
push: | |
branches: [ "develop", "devbleo3", bleo8, bleo5_01, bleo5_01.1 ] | |
pull_request: | |
branches: [ "devbleo" , bleo5_01 ] | |
jobs: | |
build: | |
#needs: [winprep] | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. | |
fail-fast: false | |
matrix: | |
build_type: [RelWithDebInfo,Debug] #Release with no debug info is useless I believe | |
config: | |
- os: windows-2022 # , ubuntu-latest] #[windows-latest] # [ubuntu-latest, windows-latest] | |
vcpkg_triplet: x64-windows | |
github-binarycache: true | |
- os: ubuntu-22.04 # , ubuntu-latest] #[windows-latest] # [ubuntu-latest, windows-latest] | |
vcpkg_triplet: x64-linux | |
github-binarycache: true | |
- os: macos-latest | |
vcpkg_triplet: x64-osx-dynamic-release | |
github-binarycache: true | |
steps: | |
################################### | |
- name: Generate UUID | |
id: generate-uuid | |
uses: filipstefansson/uuid-action@v1 | |
- name: 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: Windows Only // Install Winget so that e can use it to install SDK as needed | |
if: ${{ startsWith( matrix.config.os , 'windows' ) }} | |
uses: Cyberboss/install-winget@v1 | |
- name: 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: 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: LINUX Only // Prepare Linux packages that are needed | |
if: ${{ startsWith( matrix.config.os , 'ubuntu' ) }} | |
run: > | |
sudo apt update -y && | |
sudo apt upgrade -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: MACOS Only // Prepare Linux packages that are needed | |
if: ${{ startsWith( matrix.config.os , 'macos' ) }} | |
continue-on-error: true | |
run: | | |
xcode-select --install | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
brew install cmake asciidoctor | |
brew install pkg-config vcpkg | |
- name: get from Git | |
uses: actions/checkout@v4 | |
- name: Windows AND MacOS // VCPKG install build | |
id: vcpkg | |
if: ${{ startsWith( matrix.config.os , 'windows' ) }} || ${{ startsWith( matrix.config.os , 'macos' ) }} | |
uses: blessio/[email protected] | |
with: | |
manifest-dir: ${{ github.workspace }} # Set to directory containing vcpkg.json | |
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: "kpxco5-${{ matrix.config.vcpkg_triplet }}" | |
fetch-depth: "0" | |
- name: 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: 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: 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: 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: 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: 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: 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: 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: Test and Install | |
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: Install | |
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: 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: 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: 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 |