Skip to content

Commit 494ab42

Browse files
committed
BLD/DEV: add and use Pixi package definitions
1 parent 024a64e commit 494ab42

13 files changed

Lines changed: 8412 additions & 5009 deletions

File tree

.github/workflows/format.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on: [ push, pull_request ]
55
permissions:
66
contents: read # to fetch code (actions/checkout)
77

8-
env:
9-
CCACHE_DIR: "${{ github.workspace }}/.ccache"
10-
118
concurrency:
129
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1310
cancel-in-progress: true
@@ -16,17 +13,15 @@ jobs:
1613
format:
1714
name: Check formatting
1815
runs-on: ubuntu-latest
19-
strategy:
20-
fail-fast: false
21-
matrix:
22-
environment: [lint]
2316
steps:
2417
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2518
- uses: prefix-dev/setup-pixi@v0.10.0
2619
with:
2720
pixi-version: v0.75.0
2821
cache: true
29-
environments: ${{ matrix.environment }}
22+
environments: lint
23+
# https://github.com/prefix-dev/pixi/issues/6727
24+
locked: false
3025
- name: Check for formatting violations
3126
run: |
3227
pixi run format-dry-error

.github/workflows/gpu_tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ jobs:
4545
pixi-version: v0.75.0
4646
manifest-path: pixi.toml
4747
cache: false
48+
environments: cupy-tests
49+
# https://github.com/prefix-dev/pixi/issues/6727
50+
locked: false
4851

4952
- name: Run CuPy tests
5053
run: pixi run test-cupy

.github/workflows/tests.yml

Lines changed: 74 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ on: [ push, pull_request ]
55
permissions:
66
contents: read # to fetch code (actions/checkout)
77

8-
env:
9-
CCACHE_DIR: "${{ github.workspace }}/.ccache"
10-
# Needed because Pixi doesn't set mtime for compilers
11-
CCACHE_COMPILERCHECK: "content"
8+
# env:
9+
# CCACHE_DIR: "${{ github.workspace }}/.ccache"
10+
# # Needed because Pixi doesn't set mtime for compilers
11+
# CCACHE_COMPILERCHECK: "content"
1212

1313
concurrency:
1414
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -29,78 +29,77 @@ jobs:
2929
pixi-version: v0.75.0
3030
cache: true
3131
environments: coverage
32-
- name: Prepare compiler cache
33-
id: prep-ccache
34-
shell: bash
35-
run: |
36-
mkdir -p "${CCACHE_DIR}"
37-
echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
38-
NOW=$(date -u +"%F-%T")
39-
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
40-
- name: Setup compiler cache
41-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
42-
id: cache-ccache
43-
with:
44-
path: ${{ steps.prep-ccache.outputs.dir }}
45-
key: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-${{ steps.prep-ccache.outputs.timestamp }}
46-
restore-keys: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-
32+
# https://github.com/prefix-dev/pixi/issues/6727
33+
locked: false
34+
# - name: Prepare compiler cache
35+
# id: prep-ccache
36+
# shell: bash
37+
# run: |
38+
# mkdir -p "${CCACHE_DIR}"
39+
# echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
40+
# NOW=$(date -u +"%F-%T")
41+
# echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
42+
# - name: Setup compiler cache
43+
# uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
44+
# id: cache-ccache
45+
# with:
46+
# path: ${{ steps.prep-ccache.outputs.dir }}
47+
# key: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-${{ steps.prep-ccache.outputs.timestamp }}
48+
# restore-keys: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-
4749
- name: Determine number of workers
4850
run: |
4951
if [[ "$RUNNER_OS" == "Linux" ]]; then
5052
echo "NUM_WORKERS=$(nproc)" >> $GITHUB_ENV
5153
elif [[ "$RUNNER_OS" == "macOS" ]]; then
5254
echo "NUM_WORKERS=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
53-
elif [[ "$RUNNER_OS" == "Windows" ]]; then
54-
echo "NUM_WORKERS=$NUMBER_OF_PROCESSORS" >> "$GITHUB_ENV"
5555
fi
5656
shell: bash
57-
- name: Build xsf
58-
run: pixi run build-tests-cov
5957
- name: Run tests
60-
run: pixi run --skip-deps tests-only $NUM_WORKERS
58+
run: pixi run --environment=coverage tests $NUM_WORKERS
6159
- name: Generate coverage report
62-
if: runner.os != 'Windows'
63-
run: pixi run --skip-deps coverage $NUM_WORKERS
60+
run: pixi run --skip-deps coverage
6461
- name: Upload HTML coverage report
65-
if: runner.os != 'Windows'
6662
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
6763
with:
6864
name: cov-html-${{ matrix.runs-on }}
69-
path: build/coverage_report/**
70-
- name: Ccache performance
71-
shell: bash -l {0}
72-
run: pixi run ccache -s
65+
path: .pixi/envs/coverage/share/xsf/cov/coverage_report/**
66+
# - name: Ccache performance
67+
# shell: bash -l {0}
68+
# run: pixi run ccache -s
7369

74-
release:
70+
tests-release:
7571
# for platforms without coverage support
7672
name: Release
7773
runs-on: ${{ matrix.runs-on }}
7874
strategy:
7975
fail-fast: false
8076
matrix:
8177
runs-on: [windows-latest]
78+
environment: [tests-release]
8279
steps:
8380
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8481
- uses: prefix-dev/setup-pixi@v0.10.0
8582
with:
8683
pixi-version: v0.75.0
8784
cache: true
88-
environments: default
89-
- name: Prepare compiler cache
90-
id: prep-ccache
91-
shell: bash
92-
run: |
93-
mkdir -p "${CCACHE_DIR}"
94-
echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
95-
NOW=$(date -u +"%F-%T")
96-
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
97-
- name: Setup compiler cache
98-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
99-
id: cache-ccache
100-
with:
101-
path: ${{ steps.prep-ccache.outputs.dir }}
102-
key: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-${{ steps.prep-ccache.outputs.timestamp }}
103-
restore-keys: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-
85+
environments: ${{ matrix.environment }}
86+
# https://github.com/prefix-dev/pixi/issues/6727
87+
locked: false
88+
# - name: Prepare compiler cache
89+
# id: prep-ccache
90+
# shell: bash
91+
# run: |
92+
# mkdir -p "${CCACHE_DIR}"
93+
# echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
94+
# NOW=$(date -u +"%F-%T")
95+
# echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
96+
# - name: Setup compiler cache
97+
# uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
98+
# id: cache-ccache
99+
# with:
100+
# path: ${{ steps.prep-ccache.outputs.dir }}
101+
# key: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-${{ steps.prep-ccache.outputs.timestamp }}
102+
# restore-keys: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-
104103
- name: Determine number of workers
105104
run: |
106105
if [[ "$RUNNER_OS" == "Linux" ]]; then
@@ -111,13 +110,11 @@ jobs:
111110
echo "NUM_WORKERS=$NUMBER_OF_PROCESSORS" >> "$GITHUB_ENV"
112111
fi
113112
shell: bash
114-
- name: Build xsf
115-
run: pixi run build-tests
116113
- name: Run tests
117-
run: pixi run --skip-deps tests-only $NUM_WORKERS
118-
- name: Ccache performance
119-
shell: bash -l {0}
120-
run: pixi run ccache -s
114+
run: pixi run --environment=${{ matrix.environment }} tests $NUM_WORKERS
115+
# - name: Ccache performance
116+
# shell: bash -l {0}
117+
# run: pixi run ccache -s
121118

122119
tests-debug:
123120
name: Debug ${{ matrix.runs-on }}
@@ -126,28 +123,31 @@ jobs:
126123
fail-fast: false
127124
matrix:
128125
runs-on: [ubuntu-latest, ubuntu-24.04-arm]
126+
environment: [tests-debug]
129127
steps:
130128
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
131129
- uses: prefix-dev/setup-pixi@v0.10.0
132130
with:
133131
pixi-version: v0.75.0
134132
cache: true
135-
environments: default
136-
- name: Prepare compiler cache
137-
id: prep-ccache
138-
shell: bash
139-
run: |
140-
mkdir -p "${CCACHE_DIR}"
141-
echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
142-
NOW=$(date -u +"%F-%T")
143-
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
144-
- name: Setup compiler cache
145-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
146-
id: cache-ccache
147-
with:
148-
path: ${{ steps.prep-ccache.outputs.dir }}
149-
key: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-debug-${{ steps.prep-ccache.outputs.timestamp }}
150-
restore-keys: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-debug-
133+
environments: ${{ matrix.environment }}
134+
# https://github.com/prefix-dev/pixi/issues/6727
135+
locked: false
136+
# - name: Prepare compiler cache
137+
# id: prep-ccache
138+
# shell: bash
139+
# run: |
140+
# mkdir -p "${CCACHE_DIR}"
141+
# echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
142+
# NOW=$(date -u +"%F-%T")
143+
# echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
144+
# - name: Setup compiler cache
145+
# uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
146+
# id: cache-ccache
147+
# with:
148+
# path: ${{ steps.prep-ccache.outputs.dir }}
149+
# key: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-debug-${{ steps.prep-ccache.outputs.timestamp }}
150+
# restore-keys: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-debug-
151151
- name: Determine number of workers
152152
run: |
153153
if [[ "$RUNNER_OS" == "Linux" ]]; then
@@ -158,10 +158,8 @@ jobs:
158158
echo "NUM_WORKERS=$NUMBER_OF_PROCESSORS" >> "$GITHUB_ENV"
159159
fi
160160
shell: bash
161-
- name: Build xsf
162-
run: pixi run build-tests-debug
163161
- name: Run tests
164-
run: pixi run --skip-deps tests-debug $NUM_WORKERS
165-
- name: Ccache performance
166-
shell: bash -l {0}
167-
run: pixi run ccache -s
162+
run: pixi run --environment=${{ matrix.environment }} tests $NUM_WORKERS
163+
# - name: Ccache performance
164+
# shell: bash -l {0}
165+
# run: pixi run ccache -s

CMakeLists.txt

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
11
cmake_minimum_required(VERSION 3.14)
22
project(xsf)
33

4+
add_library(xsf INTERFACE)
5+
46
# Scipy is restricted to C++17
57
# https://docs.scipy.org/doc/scipy/dev/toolchain.html#c-language-standards
6-
set(CMAKE_CXX_STANDARD 17)
7-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
8+
target_compile_features(xsf INTERFACE cxx_std_17)
9+
10+
target_include_directories(xsf
11+
INTERFACE
12+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
13+
$<INSTALL_INTERFACE:include>
14+
)
15+
16+
install(
17+
TARGETS xsf
18+
EXPORT xsfTargets
19+
)
20+
21+
install(
22+
DIRECTORY include/
23+
DESTINATION include
24+
)
25+
26+
install(
27+
EXPORT xsfTargets
28+
FILE xsfTargets.cmake
29+
NAMESPACE xsf::
30+
DESTINATION lib/cmake/xsf
31+
)
832

933
find_program(CCACHE_PROGRAM ccache)
1034
if(CCACHE_PROGRAM)

packages/coverage/pixi.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[package]
2+
name = { workspace = true }
3+
version = { workspace = true }
4+
build = {
5+
backend.name = "pixi-build-cmake",
6+
config.extra-args = [
7+
"-DBUILD_TESTS=ON",
8+
"-DCMAKE_BUILD_TYPE=Coverage",
9+
],
10+
flags = ["tests", "coverage"],
11+
source.path = "../..",
12+
}
13+
build-dependencies = {
14+
xsref = {
15+
git = "https://github.com/lucascolley/xsref",
16+
rev = "6b5fd6c23abadb3a60fafd14c7c3f0fdf2c1b743",
17+
},
18+
}
19+
host-dependencies = {
20+
catch2 = "*",
21+
libarrow-all = "*",
22+
}
23+
run-dependencies = {
24+
cmake = "*",
25+
lcov = "*",
26+
"if(linux)" = {
27+
gcc = "16.*", # for gcov
28+
}
29+
}

packages/tests-debug/pixi.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[package]
2+
name = { workspace = true }
3+
version = { workspace = true }
4+
build = {
5+
backend.name = "pixi-build-cmake",
6+
config.extra-args = [
7+
"-DBUILD_TESTS=ON",
8+
"-DCMAKE_BUILD_TYPE=Debug",
9+
],
10+
flags = ["tests", "debug"],
11+
source.path = "../..",
12+
}
13+
build-dependencies = {
14+
xsref = {
15+
git = "https://github.com/lucascolley/xsref",
16+
rev = "6b5fd6c23abadb3a60fafd14c7c3f0fdf2c1b743",
17+
},
18+
}
19+
host-dependencies = {
20+
catch2 = "*",
21+
libarrow-all = "*",
22+
}
23+
run-dependencies = {
24+
cmake = "*",
25+
}

packages/tests-release/pixi.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = { workspace = true }
3+
version = { workspace = true }
4+
build = {
5+
backend.name = "pixi-build-cmake",
6+
config.extra-args = ["-DBUILD_TESTS=ON"],
7+
flags = ["tests", "release"],
8+
source.path = "../..",
9+
}
10+
build-dependencies = {
11+
xsref = {
12+
git = "https://github.com/lucascolley/xsref",
13+
rev = "6b5fd6c23abadb3a60fafd14c7c3f0fdf2c1b743",
14+
},
15+
}
16+
host-dependencies = {
17+
catch2 = "*",
18+
libarrow-all = "*",
19+
}
20+
run-dependencies = {
21+
cmake = "*",
22+
}

0 commit comments

Comments
 (0)