Skip to content

use fast_float to parse int #699

use fast_float to parse int

use fast_float to parse int #699

Workflow file for this run

name: CMake Build
on:
pull_request:
push:
branches:
- master
- stable
paths-ignore:
- "docs/**"
- '**/*.md'
workflow_dispatch:
env:
BUILD_TYPE: Release
INSTALLBUILDER_VERSION: 23.4.0
jobs:
buildLinux:
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'skip linux ci')"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: [
{ arch: x86_64, bits: 64 },
]
name: Linux Build (${{ matrix.bits }} bit / ${{ matrix.arch }})
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup Workspace
run: ./setup_workspace.sh
- if: "contains(github.event.head_commit.message, 'codeql')"
name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: cpp
- name: Create Build Directory
run: mkdir -p ${{runner.workspace}}/BrickSim/cmake-build/release${{ matrix.bits }}
- name: install ccache
run: sudo apt install ccache
- name: Get timestamp
run: echo "timestamp=$(date --iso-8601=seconds)" >> "$GITHUB_OUTPUT"
id: get_timestamp
- name: Setup cache
uses: actions/cache@v3
with:
path: ${{runner.workspace}}/.ccache
key: ccache-${{ runner.os }}-${{ matrix.arch }}-${{ steps.get_timestamp.outputs.timestamp }}
restore-keys: |
ccache-${{ runner.os }}-${{ matrix.arch }}-
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/BrickSim/cmake-build/release${{ matrix.bits }}
run: |
cmake $GITHUB_WORKSPACE \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_LIBRARY_PATH=/usr/lib/${{ matrix.arch }}-linux-gnu \
-G Ninja
env:
CC: gcc-12
CXX: g++-12
CFLAGS: -m${{ matrix.bits }}
LDFLAGS: -m${{ matrix.bits }}
CXXFLAGS: -m${{ matrix.bits }}
CCACHE_BASEDIR: ${{runner.workspace}}
CCACHE_DIR: ${{runner.workspace}}/.ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6
CCACHE_MAXSIZE: 500M
- name: Build
working-directory: ${{runner.workspace}}/BrickSim/cmake-build/release${{ matrix.bits }}
shell: bash
run: |
ccache -z # zero statistics
cmake --build . --target BrickSim BrickSimTests --config $BUILD_TYPE -j $(nproc --all)
ccache -s # print statistics
env:
CCACHE_BASEDIR: ${{runner.workspace}}
CCACHE_DIR: ${{runner.workspace}}/.ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6
CCACHE_MAXSIZE: 500M
- if: "contains(github.event.head_commit.message, 'codeql')"
name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
with:
config-file: ./.github/codeql/codeql-config.yml
- name: list all binaries in runner workspace
run: find ${{runner.workspace}} -type f -executable
- name: BrickSimRawBinary
uses: actions/upload-artifact@v3
with:
name: BrickSimRawBinary_Linux${{ matrix.bits }}
path: |
${{runner.workspace}}/BrickSim/cmake-build/release${{ matrix.bits }}/BrickSim
- name: Upload BrickSimTests
uses: actions/upload-artifact@v3
with:
name: BrickSimTests_Linux${{ matrix.bits }}
path: ${{runner.workspace}}/BrickSim/cmake-build/release${{ matrix.bits }}/BrickSimTests
testLinux:
name: Linux Tests (${{ matrix.bits }} bit / ${{ matrix.arch }})
needs: buildLinux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: [
{ arch: x86_64, bits: 64 },
]
steps:
- name: Download test artifact
uses: actions/download-artifact@v3
with:
name: BrickSimTests_Linux64
- name: Make tests executable
run: chmod a+x ${{runner.workspace}}/BrickSim/BrickSimTests
- name: ldd the executable
if: always()
run: ldd ${{runner.workspace}}/BrickSim/BrickSimTests
- name: Run tests with JUnit XML output
run: ${{runner.workspace}}/BrickSim/BrickSimTests -r junit > ${{runner.workspace}}/junitTestReport_Linux64.xml
- name: Run tests with Catch2 XML output
if: always()
run: ${{runner.workspace}}/BrickSim/BrickSimTests -d yes -r xml > ${{runner.workspace}}/catchTestReport_Linux64.xml
- name: Print report to log
run: cat ${{runner.workspace}}/catchTestReport_Linux64.xml
if: always()
- name: Run tests with Console output
if: failure()
run: ${{runner.workspace}}/BrickSim/BrickSimTests -d yes >> $GITHUB_STEP_SUMMARY
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: UnitTestReport_Linux64
path: ${{runner.workspace}}/*TestReport*.xml
buildInstallerLinux:
needs: buildLinux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: [
{ arch: x86_64, bits: 64 },
]
name: Linux Installer (${{ matrix.bits }} bit / ${{ matrix.arch }})
steps:
- name: Setup cache of InstallBuilder installer
id: installbuilder-installer-cache
uses: actions/cache@v3
with:
path: ${{ runner.workspace }}/installbuilder_installer.run
key: installbuilder-${{ env.INSTALLBUILDER_VERSION }}-linux-x64-installer
- name: Download InstallBuilder installer on cache miss
if: steps.installbuilder-installer-cache.outputs.cache-hit != 'true'
working-directory: ${{ runner.workspace }}
#WARNING: if you change the version here, also change it in the cache key
run: |
wget https://releases.installbuilder.com/installbuilder/installbuilder-enterprise-${{ env.INSTALLBUILDER_VERSION }}-linux-x64-installer.run -O installbuilder_installer.run
- name: Install InstallBuilder
working-directory: ${{ runner.workspace }}
run: |
chmod a+x installbuilder_installer.run
./installbuilder_installer.run --mode unattended --prefix ${{ runner.workspace }}/installbuilder
- uses: actions/checkout@v3
with:
submodules: false
fetch-depth: 0
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: BrickSimRawBinary_Linux${{ matrix.bits }}
path: ${{ runner.workspace }}/artifacts
- name: Create build directory and copy raw binary to it
run: |
mkdir -p $GITHUB_WORKSPACE/cmake-build/release${{ matrix.bits }}
cp ${{ runner.workspace }}/artifacts/BrickSim $GITHUB_WORKSPACE/cmake-build/release${{ matrix.bits }}
chmod a+x $GITHUB_WORKSPACE/cmake-build/release${{ matrix.bits }}/BrickSim
- name: Save license to file
run: |
echo "${{ secrets.INSTALLBUILDER_LICENSE_XML_BASE64 }}" | base64 --decode > ${{ runner.workspace }}/license.xml
- name: Build Installer
run: |
${{ runner.workspace }}/installbuilder/bin/builder build $GITHUB_WORKSPACE/InstallBuilder.xml linux-x64 \
--setvars project.version=$($GITHUB_WORKSPACE/scripts/get_git_tag.sh | tr -d v) \
--license ${{ runner.workspace }}/license.xml
- name: Delete license file
run: rm ${{ runner.workspace }}/license.xml
- name: Upload BrickSimInstaller
uses: actions/upload-artifact@v3
with:
name: BrickSimInstaller_Linux${{ matrix.bits }}
path: ${{runner.workspace}}/installbuilder/output/*.run
buildWindows:
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'skip windows ci')"
runs-on: windows-2022
name: Windows Build (64 bit / x86_64)
env:
VCPKG_DEFAULT_TRIPLET: x64-windows
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup Workspace
shell: powershell
working-directory: ${{runner.workspace}}\BrickSim
run: .\setup_workspace.ps1
- name: Get git info
shell: bash
id: git_info
run: |
echo "commit_hash=$(./scripts/get_git_commit_hash.sh)" >> "$GITHUB_OUTPUT"
echo "commit_count=$(./scripts/get_git_commit_count.sh)" >> "$GITHUB_OUTPUT"
echo "total_hours=$(./scripts/get_git_total_hours.sh)" >> "$GITHUB_OUTPUT"
echo "version_tag=$(./scripts/get_git_tag.sh)" >> "$GITHUB_OUTPUT"
- name: Configure and Build
shell: cmd
working-directory: ${{runner.workspace}}\BrickSim
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
md cmake-build
cd cmake-build
md release64
cd release64
cmake -DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_TOOLCHAIN_FILE="%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake" ^
-DGIT_COMMIT_HASH:STRING=${{ steps.git_info.outputs.commit_hash }} ^
-DGIT_COMMIT_COUNT:STRING=${{ steps.git_info.outputs.commit_count }} ^
-DTOTAL_HOURS:STRING=${{ steps.git_info.outputs.total_hours }} ^
-DGIT_VERSION_TAG:STRING=${{ steps.git_info.outputs.version_tag }} ^
-G "Ninja" ^
..\..
cmake --build . --target BrickSim BrickSimTests --config Release -j 2
- name: Upload BrickSimRawBinary
uses: actions/upload-artifact@v3
with:
name: BrickSimRawBinary_Windows64
path: |
${{runner.workspace}}\BrickSim\cmake-build\release64\BrickSim.exe
${{runner.workspace}}\BrickSim\cmake-build\release64\zlib1.dll
- name: Upload BrickSimTests
uses: actions/upload-artifact@v3
with:
name: BrickSimTests_Windows64
path: ${{runner.workspace}}\BrickSim\cmake-build\release64\BrickSimTests.exe
buildInstallerWindows:
needs: buildWindows
runs-on: windows-latest
name: Windows Installer (64 bit / x86_64)
steps:
- name: Setup cache of InstallBuilder installer
id: installbuilder-installer-cache
uses: actions/cache@v3
with:
path: ${{ runner.workspace }}/installbuilder_installer.exe
key: installbuilder-enterprise-${{ env.INSTALLBUILDER_VERSION }}-windows-x64-installer
- name: Download InstallBuilder installer on cache miss
if: steps.installbuilder-installer-cache.outputs.cache-hit != 'true'
working-directory: ${{ runner.workspace }}
shell: powershell
#WARNING: if you change the version here, also change it in the cache key
run: Invoke-WebRequest -Uri https://releases.installbuilder.com/installbuilder/installbuilder-enterprise-${{ env.INSTALLBUILDER_VERSION }}-windows-x64-installer.exe -OutFile installbuilder_installer.exe
- name: Install InstallBuilder
working-directory: ${{ runner.workspace }}
shell: powershell
run: |
Start-Process -FilePath installbuilder_installer.exe -ArgumentList "--mode unattended --prefix ${{ runner.workspace }}\installbuilder"
- uses: actions/checkout@v3
with:
submodules: false
fetch-depth: 0
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: BrickSimRawBinary_Windows64
path: ${{ runner.workspace }}/artifacts
- name: Create build directory and copy raw binary to it
shell: powershell
run: |
New-Item "${{ runner.workspace }}/BrickSim/cmake-build/release64" -ItemType Directory
Copy-Item "${{ runner.workspace }}/artifacts/BrickSim.exe" -Destination "${{ runner.workspace }}/BrickSim/cmake-build/release64"
- name: Save license to file
shell: powershell
run: |
[Text.Encoding]::Utf8.GetString([Convert]::FromBase64String("${{ secrets.INSTALLBUILDER_LICENSE_XML_BASE64 }}")) | Out-File -FilePath "${{ runner.workspace }}/license.xml"
- name: Build Installer
shell: powershell
run: |
$VERSION = git describe --tags --match v[0-9]*
$VERSION = $VERSION.Substring(1,$VERSION.IndexOf('-'))
New-Item -ItemType directory -Path "${{runner.workspace}}\installbuilder\output"
Start-Process -FilePath "${{ runner.workspace }}\installbuilder\bin\builder-cli.exe" `
-Wait `
-NoNewWindow `
-ArgumentList "build ${{ runner.workspace }}\BrickSim\InstallBuilder.xml windows-x64 --setvars project.version=$VERSION project.outputDirectory=${{runner.workspace}}\installbuilder\output --license ${{ runner.workspace }}\license.xml"
- name: Delete license file
shell: powershell
run: |
Remove-Item -Path "${{ runner.workspace }}/license.xml"
- name: Upload BrickSimInstaller
uses: actions/upload-artifact@v3
with:
name: BrickSimInstaller_Windows64
path: ${{runner.workspace}}\installbuilder\output\*.exe
testWindows:
runs-on: windows-latest
needs: buildWindows
strategy:
fail-fast: false
matrix:
include: [
{ arch: x86_64, bits: 64 },
#{ arch: i686, bits: 32 }
]
name: Windows Tests (64 bit / x86_64)
steps:
- name: Download test artifact
uses: actions/download-artifact@v3
with:
name: BrickSimTests_Windows64
- name: Get info about the .exe
shell: powershell
run: |
Get-Command "${{runner.workspace}}\BrickSim\BrickSimTests.exe" | Format-List
- name: Run tests with JUnit XML output
shell: powershell
run: |
Start-Process -FilePath "${{runner.workspace}}\BrickSim\BrickSimTests.exe" `
-ArgumentList "-r junit" `
-Wait `
-NoNewWindow `
-RedirectStandardOutput "${{runner.workspace}}\junitTestReport_Windows64.xml"
- name: Run tests with Catch2 XML output
shell: powershell
run: |
Start-Process -FilePath "${{runner.workspace}}\BrickSim\BrickSimTests.exe" `
-ArgumentList "-d yes -r xml" `
-Wait `
-NoNewWindow `
-RedirectStandardOutput "${{runner.workspace}}\catchTestReport_Windows64.xml"
- name: Print report to log
if: always()
shell: powershell
run: |
Get-Content "${{runner.workspace}}\catchTestReport_Windows64.xml"
- name: Run tests with Console output
if: always()
shell: powershell
run: |
Start-Process -FilePath "${{runner.workspace}}\BrickSim\BrickSimTests.exe" `
-ArgumentList "-d yes" `
-Wait `
-NoNewWindow
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: UnitTestReport_Windows64
path: ${{runner.workspace}}/*TestReport*.xml
buildMac:
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'skip mac ci')"
runs-on: macos-latest
name: MacOS Build (${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include: [
{ arch: x86_64, name: 64 },
{ arch: arm64, name: ARM }
]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup Workspace
run: ./setup_workspace.sh
- name: Create Build Environment
run: mkdir -p $GITHUB_WORKSPACE/cmake-build/release${{ matrix.name }}
- name: Install ccache
run: brew install ccache
- name: Get timestamp
id: get_timestamp
run: echo "timestamp=$(date --iso-8601=seconds)" >> "$GITHUB_OUTPUT"
- name: Setup Cache
uses: actions/cache@v3
with:
path: ${{runner.workspace}}/.ccache
key: ccache-${{ runner.os }}-${{ matrix.arch }}-${{ steps.get_timestamp.outputs.timestamp }}
restore-keys: |
ccache-${{ runner.os }}-${{ matrix.arch }}-
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/BrickSim/cmake-build/release${{ matrix.name }}
run: |
cmake $GITHUB_WORKSPACE \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_OSX_ARCHITECTURES="${{ matrix.arch }}" \
-G Ninja
env:
CC: clang
CXX: clang++
CCACHE_BASEDIR: ${{runner.workspace}}
CCACHE_DIR: ${{runner.workspace}}/.ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6
CCACHE_MAXSIZE: 500M
- name: Build
working-directory: ${{runner.workspace}}/BrickSim/cmake-build/release${{ matrix.name }}
shell: bash
run: |
ccache -z # zero statistics
cmake --build . --target BrickSim BrickSimTests --config $BUILD_TYPE -j $(sysctl -n hw.logicalcpu)
ccache -s # print statistics
env:
CCACHE_BASEDIR: ${{runner.workspace}}
CCACHE_DIR: ${{runner.workspace}}/.ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6
CCACHE_MAXSIZE: 500M
- name: Upload Application Binary
uses: actions/upload-artifact@v3
with:
name: BrickSimRawBinary_Mac${{ matrix.name }}
path: ${{runner.workspace}}/BrickSim/cmake-build/release${{ matrix.name }}/BrickSim
- name: Upload Tests Binary
uses: actions/upload-artifact@v3
with:
name: BrickSimTests_Mac${{ matrix.name }}
path: ${{runner.workspace}}/BrickSim/cmake-build/release${{ matrix.name }}/BrickSimTests
buildInstallerMac:
needs: buildMac
runs-on: macos-latest
name: MacOS Installer (${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include: [
{ arch: x86_64, name: 64 },
{ arch: arm64, name: ARM }
]
steps:
- name: Setup cache of InstallBuilder installer
id: installbuilder-installer-cache
uses: actions/cache@v3
with:
path: ${{ runner.workspace }}/installbuilder_installer.dmg
key: installbuilder-enterprise-${{ env.INSTALLBUILDER_VERSION }}-osx-installer
- name: Download InstallBuilder installer on cache miss
if: steps.installbuilder-installer-cache.outputs.cache-hit != 'true'
working-directory: ${{ runner.workspace }}
#WARNING: if you change the version here, also change it in the cache key
run: |
brew install wget
wget -nv https://releases.installbuilder.com/installbuilder/installbuilder-enterprise-${{ env.INSTALLBUILDER_VERSION }}-osx-installer.dmg -O installbuilder_installer.dmg
- name: Install InstallBuilder
working-directory: ${{ runner.workspace }}
run: |
hdiutil attach -noverify installbuilder_installer.dmg
ls -l -R "/Volumes/InstallBuilder Enterprise"
/Volumes/InstallBuilder\ Enterprise/installbuilder-enterprise-${{ env.INSTALLBUILDER_VERSION }}-osx-installer.app/Contents/MacOS/installbuilder.sh \
--mode unattended --prefix ${{ runner.workspace }}/installbuilder
#sudo hdiutil detach "/Volumes/InstallBuilder Enterprise"
#todo find out why the previous line causes error "hdiutil: couldn't unmount "disk2" - Resource busy"
- uses: actions/checkout@v3
with:
submodules: false
fetch-depth: 0
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: BrickSimRawBinary_Mac${{ matrix.name }}
path: ${{ runner.workspace }}/artifacts
- name: Create build directory and copy raw binary to it
run: |
mkdir -p $GITHUB_WORKSPACE/cmake-build/release${{ matrix.name }}
cp ${{ runner.workspace }}/artifacts/BrickSim $GITHUB_WORKSPACE/cmake-build/release${{ matrix.name }}
chmod a+x $GITHUB_WORKSPACE/cmake-build/release${{ matrix.name }}/BrickSim
- name: Save license to file
run: echo "${{ secrets.INSTALLBUILDER_LICENSE_XML_BASE64 }}" | base64 --decode > ${{ runner.workspace }}/license.xml
- name: Build Installer
run: |
${{ runner.workspace }}/installbuilder/bin/builder build $GITHUB_WORKSPACE/InstallBuilder.xml osx \
--setvars project.version=$($GITHUB_WORKSPACE/scripts/get_git_tag.sh | tr -d v) \
--license ${{ runner.workspace }}/license.xml
- name: Delete license file
run: rm ${{ runner.workspace }}/license.xml
- name: Upload BrickSimInstaller
uses: actions/upload-artifact@v3
with:
name: BrickSimInstaller_Mac${{ matrix.name }}
path: ${{runner.workspace}}/installbuilder/output/*.dmg
testMac:
needs: buildMac
runs-on: macos-latest
name: MacOS Tests (${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include: [
{ arch: x86_64, name: 64 },
# todo re-enable ARM when there is a GitHub-hosted runner for M1 (https://github.com/github/roadmap/issues/528)
# { arch: arm64, name: ARM }
]
steps:
- uses: actions/checkout@v3
with:
submodules: false
fetch-depth: 0
- name: Setup Workspace
run: ./setup_workspace.sh
- name: Download test artifact
uses: actions/download-artifact@v3
with:
name: BrickSimTests_Mac${{ matrix.name }}
- name: Make tests executable
run: chmod a+x ${{runner.workspace}}/BrickSim/BrickSimTests
- name: Run tests with JUnit XML output
run: ${{runner.workspace}}/BrickSim/BrickSimTests -r junit > ${{runner.workspace}}/junitTestReport_Mac${{ matrix.name }}.xml
- name: Run tests with Catch2 XML output
if: always()
run: ${{runner.workspace}}/BrickSim/BrickSimTests -d yes -r xml > ${{runner.workspace}}/catchTestReport_Mac${{ matrix.name }}.xml
- name: Print report to log
run: cat ${{runner.workspace}}/catchTestReport_Mac${{ matrix.name }}.xml
if: always()
- name: Run tests with Console output
if: failure()
run: ${{runner.workspace}}/BrickSim/BrickSimTests -d yes >> $GITHUB_STEP_SUMMARY
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: UnitTestReport_Mac${{ matrix.name }}
path: ${{runner.workspace}}/*TestReport*.xml
publishTestResults:
name: Publish Catch2 Test Results
needs:
- testLinux
- testWindows
- testMac
runs-on: ubuntu-latest
if: success() || failure()
steps:
- if: needs.testLinux.result == 'success'
name: Download UnitTestReport_Linux64
uses: actions/download-artifact@v3
with:
name: UnitTestReport_Linux64
path: artifacts
- if: needs.testWindows.result == 'success'
name: Download UnitTestReport_Windows64
uses: actions/download-artifact@v3
with:
name: UnitTestReport_Windows64
path: artifacts
- if: needs.testMac.result == 'success'
name: Download UnitTestReport_Mac64
uses: actions/download-artifact@v3
with:
name: UnitTestReport_Mac64
path: artifacts
# - name: Download UnitTestReport_MacARM
# uses: actions/download-artifact@v3
# with:
# name: UnitTestReport_MacARM
# path: artifacts
- name: Split files by format
run: |
mkdir junitReports
mkdir catchReports
mv artifacts/*junit* junitReports
mv artifacts/*catch* catchReports
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1.28
with:
files: junitReports/*.xml
check_name: Catch2 Test Results
comment_title: Catch2 Test Results