Skip to content

Commit dbbecc6

Browse files
authored
Add Working Build and Test Workflow (Mac/PC/Linux) (#1029)
* feat: enhance build workflow with caching and Boost setup for Linux, macOS, and Windows * feat: add ccache setup for improved build performance on all platforms * Add dependency caching and ccache support to build workflow * feat: add Copilot instructions and improve Boost setup in build workflow * Fix duplicate step IDs in build workflow and add copilot instructions * Add unique step IDs for Boost setup on each platform * Fix Windows Boost installation by switching to windows-2019 - Changed from windows-latest to windows-2019 to avoid 7-Zip 25.01 symlink security restrictions - Updated platform_version from 2022 to 2019 for Boost installation - 7-Zip 25.01 blocks symlinks needed for Boost header structure with 'dangerous link path' errors
1 parent 19fd8be commit dbbecc6

File tree

2 files changed

+85
-3
lines changed

2 files changed

+85
-3
lines changed

.github/copilot-instructions.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copilot Instructions for Element
2+
3+
## General Conventions
4+
5+
- **Always check documentation**: Before making assumptions about APIs, libraries, or tools, consult the official documentation first.
6+
- **Do not make assumptions and guesses**: When uncertain about implementation details, research or ask rather than guessing.
7+
- **KISS (Keep It Simple, Stupid)**: Favor simple, straightforward solutions over complex ones.
8+
- **DRY (Don't Repeat Yourself)**: Avoid code duplication. Extract common functionality into reusable functions or components.
9+
10+
## Code Quality
11+
12+
- Write clear, readable code with descriptive names for variables, functions, and classes.
13+
- Maintain consistency with the existing codebase style and patterns.
14+
- Consider maintainability and future developers who will read the code.

.github/workflows/build.yml

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
build-and-test:
1212
strategy:
1313
matrix:
14-
os: [ubuntu-22.04, macos-latest, windows-latest]
14+
os: [ubuntu-22.04, macos-latest, windows-2019]
1515
fail-fast: false
1616

1717
runs-on: ${{ matrix.os }}
@@ -22,6 +22,15 @@ jobs:
2222
with:
2323
submodules: recursive
2424

25+
- name: Cache apt packages (Linux)
26+
if: runner.os == 'Linux'
27+
uses: actions/cache@v4
28+
with:
29+
path: /var/cache/apt/archives
30+
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/build.yml') }}
31+
restore-keys: |
32+
${{ runner.os }}-apt-
33+
2534
- name: Install dependencies (Linux)
2635
if: runner.os == 'Linux'
2736
run: |
@@ -47,27 +56,86 @@ jobs:
4756
libglu1-mesa-dev \
4857
mesa-common-dev
4958
59+
- name: Setup Boost (Linux)
60+
if: runner.os == 'Linux'
61+
id: install-boost-linux
62+
uses: MarkusJx/[email protected]
63+
with:
64+
boost_version: 1.83.0
65+
platform_version: 22.04
66+
toolset: gcc
67+
68+
- name: Cache Homebrew (macOS)
69+
if: runner.os == 'macOS'
70+
uses: actions/cache@v4
71+
with:
72+
path: |
73+
~/Library/Caches/Homebrew
74+
/usr/local/Cellar
75+
key: ${{ runner.os }}-brew-${{ hashFiles('.github/workflows/build.yml') }}
76+
restore-keys: |
77+
${{ runner.os }}-brew-
78+
5079
- name: Install dependencies (macOS)
5180
if: runner.os == 'macOS'
5281
run: |
53-
brew install cmake ninja pandoc boost
82+
brew install cmake ninja pandoc
83+
84+
- name: Setup Boost (macOS)
85+
if: runner.os == 'macOS'
86+
id: install-boost-macos
87+
uses: MarkusJx/[email protected]
88+
with:
89+
boost_version: 1.83.0
90+
platform_version: 11
91+
toolset: clang
92+
93+
- name: Cache Chocolatey (Windows)
94+
if: runner.os == 'Windows'
95+
uses: actions/cache@v4
96+
with:
97+
path: ~\AppData\Local\Temp\chocolatey
98+
key: ${{ runner.os }}-choco-${{ hashFiles('.github/workflows/build.yml') }}
99+
restore-keys: |
100+
${{ runner.os }}-choco-
54101
55102
- name: Install dependencies (Windows)
56103
if: runner.os == 'Windows'
57104
run: |
58-
choco install cmake ninja pandoc boost -y
105+
choco install cmake ninja pandoc -y
106+
107+
- name: Setup Boost (Windows)
108+
if: runner.os == 'Windows'
109+
id: install-boost-windows
110+
uses: MarkusJx/[email protected]
111+
with:
112+
boost_version: 1.83.0
113+
platform_version: 2019
114+
toolset: msvc
115+
link: static
59116

60117
- name: Setup MSVC environment (Windows)
61118
if: runner.os == 'Windows'
62119
uses: ilammy/msvc-dev-cmd@v1
63120

121+
- name: Setup ccache
122+
uses: hendrikmuhs/[email protected]
123+
with:
124+
key: ${{ matrix.os }}-ccache-${{ github.sha }}
125+
restore-keys: |
126+
${{ matrix.os }}-ccache-
127+
64128
- name: Configure CMake (Windows)
65129
if: runner.os == 'Windows'
66130
run: cmake -B build -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=Release -DELEMENT_BUILD_PLUGINS=ON
131+
env:
132+
BOOST_ROOT: ${{ steps.install-boost-windows.outputs.BOOST_ROOT }}
67133

68134
- name: Configure CMake (Unix)
69135
if: runner.os != 'Windows'
70136
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DELEMENT_BUILD_PLUGINS=ON
137+
env:
138+
BOOST_ROOT: ${{ steps.install-boost-linux.outputs.BOOST_ROOT || steps.install-boost-macos.outputs.BOOST_ROOT }}
71139

72140
- name: Build
73141
run: cmake --build build --config Release

0 commit comments

Comments
 (0)