Skip to content

Commit 2162832

Browse files
authored
Merge pull request #274 from elbeno/uv-migration
🎨 Use `uv` for python venv
2 parents a6c3fde + 5de5091 commit 2162832

3 files changed

Lines changed: 530 additions & 26 deletions

File tree

.github/workflows/unit_tests.yml

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ env:
1515
DEFAULT_CXX_STANDARD: 23
1616
DEFAULT_LLVM_VERSION: 22
1717
DEFAULT_GCC_VERSION: 14
18+
UV_CACHE_DIR: /tmp/.uv-cache
19+
PIPX_BIN_DIR: /tmp/.pipx_bin
1820

1921
concurrency:
2022
group: ${{ github.head_ref || github.run_id }}
@@ -117,11 +119,12 @@ jobs:
117119
env:
118120
cache-name: cpm-cache-0
119121
id: cpm-cache-restore
120-
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
122+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
121123
with:
122124
path: ~/cpm-cache
123125
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
124126
restore-keys: |
127+
${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
125128
${{runner.os}}-${{env.cache-name}}-
126129
127130
- name: Configure CMake
@@ -130,16 +133,6 @@ jobs:
130133
CXX: ${{matrix.toolchain_root}}/bin/${{matrix.cxx}}
131134
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{matrix.cxx_standard}} -DCMAKE_CXX_FLAGS_INIT=${{matrix.cxx_flags}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCPM_SOURCE_CACHE=~/cpm-cache
132135

133-
- &save_cpm_cache
134-
name: Save CPM cache
135-
env:
136-
cache-name: cpm-cache-0
137-
if: steps.cpm-cache-restore.outputs.cache-hit != 'true'
138-
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
139-
with:
140-
path: ~/cpm-cache
141-
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
142-
143136
- name: Build Unit Tests
144137
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -v -t build_unit_tests
145138

@@ -162,22 +155,36 @@ jobs:
162155
- name: Checkout PR branch
163156
uses: *checkout
164157

165-
- name: Setup python venv
166-
run: |
167-
python3 -m venv ${{github.workspace}}/test_venv
168-
source ${{github.workspace}}/test_venv/bin/activate
169-
echo "${{github.workspace}}/test_venv/bin" >> "$GITHUB_PATH"
170-
171158
- name: Install build tools
172159
run: |
173160
DISTRO=$(lsb_release -cs)
174161
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
175162
sudo add-apt-repository -y deb "https://apt.llvm.org/$DISTRO/" "llvm-toolchain-$DISTRO-${{env.DEFAULT_LLVM_VERSION}}" main
176-
sudo apt update && sudo apt install -y ninja-build clang-tidy-${{env.DEFAULT_LLVM_VERSION}} clang-format-${{env.DEFAULT_LLVM_VERSION}}
163+
sudo apt update && sudo apt install -y pipx ninja-build clang-tidy-${{env.DEFAULT_LLVM_VERSION}} clang-format-${{env.DEFAULT_LLVM_VERSION}}
177164
178-
- name: Install cmake-format
165+
- name: Install uv
179166
run: |
180-
pip install cmakelang pyyaml
167+
pipx install uv
168+
echo "$PIPX_BIN_DIR" >> "$GITHUB_PATH"
169+
170+
- name: Restore uv cache
171+
env:
172+
cache-name: uv-cache-0
173+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
174+
with:
175+
path: ${{env.UV_CACHE_DIR}}
176+
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('uv.lock') }}
177+
restore-keys: |
178+
${{runner.os}}-${{env.cache-name}}-${{ hashFiles('uv.lock') }}
179+
${{runner.os}}-${{env.cache-name}}-
180+
181+
- name: Setup python venv
182+
working-directory: ${{github.workspace}}
183+
run: |
184+
uv venv -c
185+
source .venv/bin/activate
186+
uv sync
187+
echo "$(pwd)/.venv/bin" >> "$GITHUB_PATH"
181188
182189
- *restore_cpm_cache
183190

@@ -188,11 +195,12 @@ jobs:
188195
PR_TARGET_BRANCH: ${{ steps.target_branch.outputs.branch }}
189196
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache
190197

191-
- *save_cpm_cache
192-
193198
- name: Run quality checks
194199
run: cmake --build ${{github.workspace}}/build -t ci-quality
195200

201+
- name: Minimize uv cache
202+
run: uv cache prune --ci
203+
196204
sanitize:
197205
runs-on: *runner
198206
strategy:
@@ -233,8 +241,6 @@ jobs:
233241
SANITIZERS: ${{matrix.sanitizer}}
234242
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache
235243

236-
- *save_cpm_cache
237-
238244
# https://github.com/actions/runner-images/issues/9524
239245
- name: Fix kernel mmap rnd bits
240246
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
@@ -262,8 +268,6 @@ jobs:
262268
CXX: "/usr/bin/g++-${{env.DEFAULT_GCC_VERSION}}"
263269
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache
264270

265-
- *save_cpm_cache
266-
267271
- name: Build Unit Tests
268272
run: cmake --build ${{github.workspace}}/build -t build_unit_tests
269273

pyproject.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[project]
2+
name = "intel-cpp-baremetal-senders-and-receivers"
3+
version = "0.0.1"
4+
requires-python = ">=3.12"
5+
dependencies = [
6+
"intel-cicd-repo-infrastructure"
7+
]
8+
license = "BSL-1.0"
9+
10+
[project.urls]
11+
Repository = "https://github.com/intel/cpp-baremetal-senders-and-receivers/"
12+
Documentation = "https://intel.github.io/cpp-baremetal-senders-and-receivers/"
13+
14+
[tool.setuptools]
15+
packages = []
16+
17+
[tool.uv.sources]
18+
intel-cicd-repo-infrastructure = { git = "https://github.com/intel/cicd-repo-infrastructure", branch = "dev" }

0 commit comments

Comments
 (0)