Skip to content

Commit 0cc1aae

Browse files
rmpowell77claude
andauthored
Issue #648: Make CI go faster (#728)
Issue #689: Update wxWidgets to 3.3.1 Issue #735: Update the CI to have the release or debug in the name Add vcpkg binary caching for macOS and Windows CI builds Implement vcpkg-based dependency management with binary caching to significantly speed up CI builds on macOS and Windows. Ubuntu continues to build wxWidgets from source to avoid timeout issues. Changes: - Add vcpkg.json with project dependencies (wxWidgets, nlohmann-json, catch2, curl) - Configure workflow to use vcpkg with file-based binary caching - Cache both vcpkg installation and built packages - Extract vcpkg baseline dynamically from vcpkg.json - Fix Windows runtime library mismatch (static vs dynamic) - Configure Ubuntu to use FORCE_VENDOR_DEPENDENCIES (FetchContent) - Make the debug name show up. - Update the CI to have the release or debug in the name - Free space on Ubuntu to make caching work Performance improvements: - First run: ~10-15 minutes to build dependencies - Cached runs: ~2 minutes for configure step (90% reduction) - All platforms (Ubuntu, macOS, Windows) building successfully 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent 80ef7d1 commit 0cc1aae

File tree

14 files changed

+279
-144
lines changed

14 files changed

+279
-144
lines changed

.github/workflows/cmake.yml

Lines changed: 64 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717

1818
jobs:
1919
build:
20-
name: ${{ matrix.config.name }}
20+
name: ${{ matrix.config.name }} - ${{ matrix.build_type }}
2121
runs-on: ${{ matrix.config.os }}
2222
strategy:
2323
fail-fast: false
@@ -52,6 +52,18 @@ jobs:
5252
build_type: Debug
5353

5454
steps:
55+
- name: Free disk space (Linux)
56+
if: matrix.config.os == 'ubuntu-24.04'
57+
run: |
58+
# Free up disk space on Ubuntu runners to prevent "No space left on device" during vcpkg builds
59+
# Reference: https://github.com/actions/runner-images/issues/2840
60+
sudo rm -rf /usr/share/dotnet
61+
sudo rm -rf /usr/local/lib/android
62+
sudo rm -rf /opt/ghc
63+
sudo rm -rf /opt/hostedtoolcache/CodeQL
64+
sudo docker image prune --all --force
65+
df -h
66+
5567
- name: checkout
5668
uses: actions/checkout@v3
5769

@@ -61,6 +73,42 @@ jobs:
6173
- name: Checkout submodules
6274
run: git submodule update --init --recursive
6375

76+
- name: Get vcpkg baseline
77+
id: vcpkg-baseline
78+
run: |
79+
BASELINE=$(grep -o '"builtin-baseline": "[^"]*"' vcpkg.json | cut -d'"' -f4)
80+
echo "hash=$BASELINE" >> $GITHUB_OUTPUT
81+
shell: bash
82+
83+
- name: Cache vcpkg
84+
id: cache-vcpkg
85+
uses: actions/cache@v4
86+
with:
87+
path: ${{github.workspace}}/vcpkg
88+
key: vcpkg-install-${{ runner.os }}-${{ steps.vcpkg-baseline.outputs.hash }}
89+
90+
- name: Setup vcpkg
91+
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
92+
run: |
93+
git clone https://github.com/microsoft/vcpkg.git "$GITHUB_WORKSPACE/vcpkg"
94+
cd "$GITHUB_WORKSPACE/vcpkg"
95+
git checkout ${{ steps.vcpkg-baseline.outputs.hash }}
96+
if [ "$RUNNER_OS" == "Windows" ]; then
97+
./bootstrap-vcpkg.bat
98+
else
99+
./bootstrap-vcpkg.sh
100+
fi
101+
shell: bash
102+
103+
- name: Cache vcpkg binary cache
104+
uses: actions/cache@v4
105+
with:
106+
path: ${{github.workspace}}/vcpkg-cache
107+
key: vcpkg-archives-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('vcpkg.json') }}-${{ steps.vcpkg-baseline.outputs.hash }}
108+
restore-keys: |
109+
vcpkg-archives-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('vcpkg.json') }}-
110+
vcpkg-archives-${{ runner.os }}-${{ runner.arch }}-
111+
64112
- name: Installing Xcode (MacOS)
65113
if: matrix.config.os == 'macos-14'
66114
uses: maxim-lobanov/setup-xcode@v1
@@ -75,16 +123,15 @@ jobs:
75123
# Add NSIS to PATH for this session
76124
$env:PATH = "$env:PATH;C:\Program Files (x86)\NSIS"
77125
echo "C:\Program Files (x86)\NSIS" >> $env:GITHUB_PATH
78-
# Bootstrap vcpkg and install libcurl (x64) so CMake can find CURL on Windows
79-
git clone https://github.com/microsoft/vcpkg.git "$Env:GITHUB_WORKSPACE\vcpkg"
80-
& "$Env:GITHUB_WORKSPACE\vcpkg\bootstrap-vcpkg.bat"
81-
# Install the static curl triplet so CI builds a statically-linked libcurl
82-
& "$Env:GITHUB_WORKSPACE\vcpkg\vcpkg.exe" install curl:x64-windows-static
83-
& "$Env:GITHUB_WORKSPACE\vcpkg\vcpkg.exe" integrate install
84126
85127
- name: Installing Dependencies (Linux)
86128
if: matrix.config.os == 'ubuntu-24.04'
87-
run: sudo apt-get update && sudo apt-get install build-essential libgtk-3-dev libcurl4-openssl-dev
129+
run: |
130+
sudo apt-get update
131+
sudo apt-get install -y autoconf autoconf-archive automake libltdl-dev
132+
sudo apt-get install -y build-essential libgtk-3-dev libcurl4-openssl-dev pkg-config ninja-build
133+
# Additional dependencies for vcpkg and wxWidgets building
134+
sudo apt-get install -y bison flex zip unzip tar curl
88135
89136
- name: Updating to gcc 14 (Linux)
90137
if: matrix.config.os == 'ubuntu-24.04'
@@ -96,14 +143,17 @@ jobs:
96143
97144
- name: Configure CMake (Windows)
98145
if: matrix.config.os == 'windows-latest'
99-
# Tell vcpkg's CMake toolchain to use the static triplet so CMake finds static libs
100-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static
146+
# Use vcpkg toolchain file with static triplet; force static runtime for CalChart too
147+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>" -DCMAKE_TOOLCHAIN_FILE="${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static
148+
env:
149+
VCPKG_BINARY_SOURCES: 'clear;files,${{github.workspace}}/vcpkg-cache,readwrite'
101150

102-
- name: Configure CMake (non-Windows)
151+
- name: Configure CMake (macOS/Linux)
103152
if: matrix.config.os != 'windows-latest'
104-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
105-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
106-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
153+
# Use vcpkg toolchain; triplet auto-selected by vcpkg
154+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_TOOLCHAIN_FILE="${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake"
155+
env:
156+
VCPKG_BINARY_SOURCES: 'clear;files,${{github.workspace}}/vcpkg-cache,readwrite'
107157

108158
- name: Build
109159
# Build your program with the given configuration

.github/workflows/generate-vcpkg-lock.yml

Lines changed: 0 additions & 84 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ build*
22
contgram.output
33
contgram.tab.c
44
generated/*
5+
vcpkg*
56
.DS_Store
67
*~
78
.vagrant

CMakePresets.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"version": 8,
3+
"configurePresets": [
4+
{
5+
"name": "windows",
6+
"displayName": "Windows - Visual Studio 2022",
7+
"description": "Visual Studio generator for Windows",
8+
"generator": "Visual Studio 17 2022",
9+
"binaryDir": "${sourceDir}/build/${presetName}",
10+
"architecture": {
11+
"value": "x64",
12+
"strategy": "set"
13+
},
14+
"cacheVariables": {
15+
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
16+
}
17+
},
18+
{
19+
"name": "mac",
20+
"displayName": "Mac - Ninja",
21+
"description": "Mac generator for macOS/Linux",
22+
"generator": "Ninja",
23+
"binaryDir": "${sourceDir}/build/${presetName}",
24+
"cacheVariables": {
25+
"CMAKE_BUILD_TYPE": "Release",
26+
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
27+
}
28+
}
29+
],
30+
"buildPresets": [
31+
{
32+
"name": "windows-release",
33+
"configurePreset": "windows",
34+
"configuration": "Release"
35+
},
36+
{
37+
"name": "windows-debug",
38+
"configurePreset": "windows",
39+
"configuration": "Debug"
40+
},
41+
{
42+
"name": "mac-release",
43+
"configurePreset": "mac",
44+
"configuration": "Release"
45+
}
46+
]
47+
}

GETTING_STARTED.md

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,81 @@ Note:
2424
Avoid using macport version of cmake due to this issue:
2525
https://trac.macports.org/ticket/58450
2626

27+
#### Installing vcpkg
28+
29+
CalChart uses [vcpkg](https://vcpkg.io) to manage C++ dependencies. Install vcpkg and set up the environment variable:
30+
31+
```bash
32+
# Clone vcpkg to a location of your choice (e.g., ~/vcpkg)
33+
git clone https://github.com/microsoft/vcpkg.git ~/vcpkg
34+
cd ~/vcpkg
35+
./bootstrap-vcpkg.sh
36+
37+
# Set the VCPKG_ROOT environment variable (add to ~/.zshrc or ~/.bash_profile)
38+
echo 'export VCPKG_ROOT="$HOME/vcpkg"' >> ~/.zshrc
39+
source ~/.zshrc
40+
```
41+
42+
After setting the environment variable, restart your terminal for the changes to take effect.
43+
2744
### Windows Steps
2845

2946
We recommend using [chocolatey](https://chocolatey.org) for the package manager for Windows.
3047

31-
First, go to https://chocolatey.org/install and follow the installation instructions. Once installed, open powershell.exe and install `cmake`, `git`, and `winbisonflex`:
48+
First, go to https://chocolatey.org/install and follow the installation instructions. You'll need to run PowerShell as Administrator:
49+
1. Press Windows key, type "PowerShell"
50+
2. Right-click on "Windows PowerShell" and select "Run as administrator"
51+
3. Follow the Chocolatey installation instructions from the website
52+
53+
Once Chocolatey is installed, install the required dependencies (in an admin PowerShell):
3254

3355
```
34-
choco install cmake git winflexbison clang-format
56+
choco install cmake git winflexbison ninja clang-format
57+
```
58+
59+
**Note**: `ninja` is required for building with CMake presets. If you encounter issues with Ninja not being found, close and reopen your terminal after installation.
60+
61+
#### Installing vcpkg
62+
63+
CalChart uses [vcpkg](https://vcpkg.io) to manage C++ dependencies. Install vcpkg and set up the environment variable:
64+
65+
```powershell
66+
# Clone vcpkg to a location of your choice (e.g., C:\vcpkg)
67+
git clone https://github.com/microsoft/vcpkg.git C:\vcpkg
68+
cd C:\vcpkg
69+
.\bootstrap-vcpkg.bat
70+
71+
# Set the VCPKG_ROOT environment variable (required for CMake to find vcpkg)
72+
[System.Environment]::SetEnvironmentVariable('VCPKG_ROOT', 'C:\vcpkg', [System.EnvironmentVariableTarget]::User)
3573
```
3674

75+
After setting the environment variable, close and reopen your terminal/VS Code for the changes to take effect.
76+
3777
### Linux Steps
3878

3979
We recommend using apt-get to install `git`, `cmake`, `bison`, `flex`, and the gtk:
4080

4181
```
42-
sudo apt-get update && sudo apt-get install build-essential libgtk-3-dev git cmake bison flex clang-format
82+
sudo apt-get update && sudo apt-get install build-essential libgtk-3-dev git cmake bison flex clang-format ninja-build
83+
```
84+
85+
#### Installing vcpkg
86+
87+
CalChart uses [vcpkg](https://vcpkg.io) to manage C++ dependencies. Install vcpkg and set up the environment variable:
88+
89+
```bash
90+
# Clone vcpkg to a location of your choice (e.g., ~/vcpkg)
91+
git clone https://github.com/microsoft/vcpkg.git ~/vcpkg
92+
cd ~/vcpkg
93+
./bootstrap-vcpkg.sh
94+
95+
# Set the VCPKG_ROOT environment variable (add to ~/.bashrc)
96+
echo 'export VCPKG_ROOT="$HOME/vcpkg"' >> ~/.bashrc
97+
source ~/.bashrc
4398
```
4499

100+
After setting the environment variable, restart your terminal for the changes to take effect.
101+
45102
## Getting the CalChart3 source code -- estimated time: 5 minutes
46103

47104
The CalChart3 source code lives on [Github](https://github.com/calband/calchart). We use submodules to package several projects sources together for the final project. To get the source code to your machine, you will need to clone the repository to a local copy. You should choose a target directory that you can find easily on your machine. In this guide, we use the default directory location.

LATEST_RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ Bugs addressed in this release:
55
Other changes:
66

77
* [#635](../../issues/635) Reduce usage of wxString
8+
* [#648](../../issues/648) Make CI go faster
9+
* [#689](../../issues/689) Update wxWidgets to 3.3.1
810
* [#729](../../issues/729) Reduce the number of warnings from windows builds
911
* [#731](../../issues/731) Move tests into the right places
1012
* [#732](../../issues/732) remove wxUI::Custom
13+
* [#735](../../issues/735) Update the CI to have the release or debug in the name
1114

cmake/compiler.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ endif()
1616

1717
macro(SetupCompilerForTarget arg)
1818
if(NOT MSVC)
19-
target_compile_options(${arg} PRIVATE -Wall -Wextra)
19+
target_compile_options(${arg} PRIVATE -Wall -Wextra)
20+
else()
21+
target_compile_options(${arg} PRIVATE /MP)
2022
endif()
2123
set_target_properties(${arg} PROPERTIES CXX_STANDARD 23)
2224
endmacro()

0 commit comments

Comments
 (0)