Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 75 additions & 31 deletions .github/actions/openvic-sim-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,35 @@ inputs:
run-tests:
description: Whether to run the unit tests after building
default: 'true'
enable-cache:
description: Whether to enable the cache for building
default: 'true'

runs:
using: composite
steps:
- name: Install ccache and restore cache
if: inputs.enable-cache == 'true'
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
# Disables sporadic job summary behavior
job-summary:
append-timestamp: false
max-size: 1G
key: ${{ inputs.identifier }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ inputs.identifier }}-${{ github.ref }}
${{ inputs.identifier }}
install: yes

- name: Allow ccache to cache precompiled headers
if: inputs.enable-cache == 'true'
shell: bash
run: |
ccache --version | head -n 1
ccache --set-config=sloppiness=pch_defines,time_macros
ccache -p | grep sloppiness

- name: Setup MSVC environment
if: ${{ runner.os == 'Windows' }}
shell: pwsh
Expand All @@ -34,21 +59,8 @@ runs:
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments '-arch=x64 -host_arch=x64'
Get-ChildItem env: | ForEach-Object { Add-Content -Path $env:GITHUB_ENV -Value "$($_.Name)=$($_.Value)" }

- name: Setup Ninja
shell: bash
run: |
# Ninja is preinstalled on GitHub-hosted images; fall back to the
# image's package manager if a future image drops it.
if ! command -v ninja >/dev/null 2>&1; then
if [ "$RUNNER_OS" = "macOS" ]; then
brew install ninja
elif [ "$RUNNER_OS" = "Windows" ]; then
choco install ninja -y
else
sudo apt-get update -y && sudo apt-get install -y ninja-build
fi
fi
ninja --version
- name: Get CMake and Ninja
uses: lukka/get-cmake@e6906078ebd1ccb8ce51ab4626ac46a1b5a517e3 # v4.4.0

- name: Install APT dependencies
if: ${{ runner.os == 'Linux' }}
Expand All @@ -68,25 +80,57 @@ runs:
sudo update-alternatives --set g++ /usr/bin/g++-13
g++ --version

- name: Configure
shell: bash
run: |
cmake --preset ${{ inputs.preset }} \
-DGODOTCPP_TARGET=${{ inputs.target }} \
${{ inputs.cmake-args }}

- name: Build
shell: bash
run: |
CONFIG_LOWER=$(echo "${{ inputs.configuration }}" | tr '[:upper:]' '[:lower:]')
cmake --build --preset ${{ inputs.preset }}-$CONFIG_LOWER
uses: lukka/run-cmake@5d55ea7949e25f69f0ecb516d8d572297e03a956 # v10.9
if: ${{ inputs.run-tests != 'true' }}
env:
INPUTS_CONFIGURATION: ${{ inputs.configuration }}
INPUTS_TARGET: ${{ inputs.target }}
INPUTS_COMPLIANCE_TYPE: ${{ inputs.compliance-type }}
INPUTS_CMAKE_ARGS: ${{ inputs.cmake-args }}
INPUTS_ENABLE_CACHE: ${{ inputs.enable-cache }}
# Disables vcpkg on Windows
VCPKG_ROOT:
with:
configurePreset: ${{ inputs.preset }}
buildPreset: ${{ inputs.preset }}
# Arguments are evaluated by Javascript's eval function
configurePresetAdditionalArgs: |
[
`-DGODOTCPP_TARGET=$[env.INPUTS_TARGET]`,
$[env.INPUTS_ENABLE_CACHE] ? `-DCMAKE_C_COMPILER_LAUNCHER=ccache` : ``,
$[env.INPUTS_ENABLE_CACHE] ? `-DCMAKE_CXX_COMPILER_LAUNCHER=ccache` : ``,
$[env.INPUTS_ENABLE_CACHE] ? `-DOPENVIC_USE_PCH=OFF` : ``,
$[env.INPUTS_ENABLE_CACHE] && `$[env.RUNNER_OS]` == 'Windows' ? `-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>` : ``
].concat(`$[env.INPUTS_CMAKE_ARGS]`.split(/\s+/)).filter((v) => v.length > 0)
buildPresetCmdString: "[`--build`, `--preset`, `$[env.BUILD_PRESET_NAME]-` + `$[env.INPUTS_CONFIGURATION]`.toLowerCase()]"

- name: Run tests
- name: Build and Test
uses: lukka/run-cmake@5d55ea7949e25f69f0ecb516d8d572297e03a956 # v10.9
if: ${{ inputs.run-tests == 'true' }}
shell: bash
run: |
CONFIG_LOWER=$(echo "${{ inputs.configuration }}" | tr '[:upper:]' '[:lower:]')
ctest --preset ${{ inputs.preset }}-$CONFIG_LOWER
env:
INPUTS_CONFIGURATION: ${{ inputs.configuration }}
INPUTS_TARGET: ${{ inputs.target }}
INPUTS_COMPLIANCE_TYPE: ${{ inputs.compliance-type }}
INPUTS_CMAKE_ARGS: ${{ inputs.cmake-args }}
INPUTS_ENABLE_CACHE: ${{ inputs.enable-cache }}
# Disables vcpkg on Windows
VCPKG_ROOT:
with:
configurePreset: ${{ inputs.preset }}
buildPreset: ${{ inputs.preset }}
testPreset: ${{ inputs.preset }}
# Arguments are evaluated by Javascript's eval function
configurePresetAdditionalArgs: |
[
`-DGODOTCPP_TARGET=$[env.INPUTS_TARGET]`,
$[env.INPUTS_ENABLE_CACHE] ? `-DCMAKE_C_COMPILER_LAUNCHER=ccache` : ``,
$[env.INPUTS_ENABLE_CACHE] ? `-DCMAKE_CXX_COMPILER_LAUNCHER=ccache` : ``,
$[env.INPUTS_ENABLE_CACHE] ? `-DOPENVIC_USE_PCH=OFF` : ``,
$[env.INPUTS_ENABLE_CACHE] && `$[env.RUNNER_OS]` == 'Windows' ? `-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>` : ``
].concat(`$[env.INPUTS_CMAKE_ARGS]`.split(/\s+/)).filter((v) => v.length > 0)
buildPresetCmdString: "[`--build`, `--preset`, `$[env.BUILD_PRESET_NAME]-` + `$[env.INPUTS_CONFIGURATION]`.toLowerCase()]"
testPresetCmdString: "[`--preset`, `$[env.BUILD_PRESET_NAME]-` + `$[env.INPUTS_CONFIGURATION]`.toLowerCase()]"

- name: Upload library artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nightly-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ jobs:
target: template_release
run-tests: false
cmake-args: -DOPENVIC_SIM_BUILD_TESTS=OFF ${{ matrix.cmake-args }}
enable-cache: false

publish-nightly-release:
name: Publish Release
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
target: template_release
run-tests: false
cmake-args: -DOPENVIC_SIM_BUILD_TESTS=OFF ${{ matrix.cmake-args }}
enable-cache: false

publish-release:
name: Publish Release
Expand Down
2 changes: 2 additions & 0 deletions src/openvic-simulation/core/memory/Formatting.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <iterator>

#include <fmt/base.h>
#include <fmt/format.h>

Expand Down
Loading