Skip to content

Commit d2d9164

Browse files
committed
revisions
1 parent b9bc758 commit d2d9164

4 files changed

Lines changed: 65 additions & 74 deletions

File tree

.github/ccache/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ runs:
2626
- name: Install Pixi
2727
uses: prefix-dev/setup-pixi@a09b6247153796b190642a2b53fac4241043cf6f # v0.10.0
2828
with:
29-
pixi-version: v0.77.0
29+
pixi-version: ${{ env.PIXI_VERSION }}
3030
run-install: false
3131
cache: false
3232
- name: Reset ccache stats

.github/num-workers/action.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Determine Number of Workers
2+
description: Set NUM_WORKERS to the runner's core count
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Determine number of workers
8+
shell: bash
9+
run: |
10+
if [[ "$RUNNER_OS" == "Linux" ]]; then
11+
echo "NUM_WORKERS=$(nproc)" >> $GITHUB_ENV
12+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
13+
echo "NUM_WORKERS=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
14+
elif [[ "$RUNNER_OS" == "Windows" ]]; then
15+
echo "NUM_WORKERS=$NUMBER_OF_PROCESSORS" >> "$GITHUB_ENV"
16+
fi

.github/setup-test-env/action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Setup Test Environment
2+
description: Restore ccache, install the pixi environment, and report ccache stats
3+
inputs:
4+
environment:
5+
description: "Pixi environment to install"
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Set CCACHE_DIR
12+
shell: bash
13+
run: echo "CCACHE_DIR=${{ github.workspace }}/packages/${{ inputs.environment }}/.ccache" >> $GITHUB_ENV
14+
- uses: ./.github/ccache
15+
with:
16+
key_segment: ${{ github.workflow }}-${{ inputs.environment }}-${{ runner.os }}-${{ runner.arch }}
17+
- name: Setup ${{ inputs.environment }} environment
18+
uses: prefix-dev/setup-pixi@a09b6247153796b190642a2b53fac4241043cf6f # v0.10.0
19+
with:
20+
pixi-version: ${{ env.PIXI_VERSION }}
21+
cache: true
22+
cache-key: pixi-v0-${{ github.job }}
23+
environments: ${{ inputs.environment }}
24+
- name: Ccache performance
25+
shell: bash
26+
run: pixi exec ccache -s

.github/workflows/tests.yml

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

8+
env:
9+
PIXI_VERSION: v0.77.0
10+
811
concurrency:
912
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1013
cancel-in-progress: true
@@ -18,35 +21,17 @@ jobs:
1821
matrix:
1922
runs-on: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
2023
environment: [coverage]
21-
env:
22-
CCACHE_DIR: ${{ github.workspace }}/packages/coverage/.ccache
2324
steps:
24-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
25-
- uses: ./.github/ccache
26-
with:
27-
key_segment: ${{ github.workflow }}-${{ matrix.environment }}-${{ matrix.runs-on }}
28-
- name: Setup ${{ matrix.environment }} environment
29-
uses: prefix-dev/setup-pixi@a09b6247153796b190642a2b53fac4241043cf6f # v0.10.0
25+
- name: Checkout xsf
26+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
27+
- name: Setup test environment
28+
uses: ./.github/setup-test-env
3029
with:
31-
pixi-version: v0.77.0
32-
cache: true
33-
cache-key: pixi-v0-${{ github.job }}
34-
environments: ${{ matrix.environment }}
35-
- name: Ccache performance
36-
shell: bash
37-
run: pixi exec ccache -s
30+
environment: ${{ matrix.environment }}
3831
- name: Determine number of workers
39-
run: |
40-
if [[ "$RUNNER_OS" == "Linux" ]]; then
41-
echo "NUM_WORKERS=$(nproc)" >> $GITHUB_ENV
42-
elif [[ "$RUNNER_OS" == "macOS" ]]; then
43-
echo "NUM_WORKERS=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
44-
elif [[ "$RUNNER_OS" == "Windows" ]]; then
45-
echo "NUM_WORKERS=$NUMBER_OF_PROCESSORS" >> "$GITHUB_ENV"
46-
fi
47-
shell: bash
32+
uses: ./.github/num-workers
4833
- name: Run tests
49-
run: pixi run --environment=coverage tests $NUM_WORKERS
34+
run: pixi run --environment=${{ matrix.environment }} tests $NUM_WORKERS
5035
- name: Generate coverage report
5136
run: pixi run --skip-deps coverage
5237
- name: Upload HTML coverage report
@@ -64,33 +49,15 @@ jobs:
6449
matrix:
6550
runs-on: [windows-latest]
6651
environment: [tests-release]
67-
env:
68-
CCACHE_DIR: ${{ github.workspace }}/packages/tests-release/.ccache
6952
steps:
70-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
71-
- uses: ./.github/ccache
53+
- name: Checkout xsf
54+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
55+
- name: Setup test environment
56+
uses: ./.github/setup-test-env
7257
with:
73-
key_segment: ${{ github.workflow }}-${{ matrix.environment }}-${{ matrix.runs-on }}
74-
- name: Setup ${{ matrix.environment }} environment
75-
uses: prefix-dev/setup-pixi@a09b6247153796b190642a2b53fac4241043cf6f # v0.10.0
76-
with:
77-
pixi-version: v0.77.0
78-
cache: true
79-
cache-key: pixi-v0-${{ github.job }}
80-
environments: ${{ matrix.environment }}
81-
- name: Ccache performance
82-
shell: bash
83-
run: pixi exec ccache -s
58+
environment: ${{ matrix.environment }}
8459
- name: Determine number of workers
85-
run: |
86-
if [[ "$RUNNER_OS" == "Linux" ]]; then
87-
echo "NUM_WORKERS=$(nproc)" >> $GITHUB_ENV
88-
elif [[ "$RUNNER_OS" == "macOS" ]]; then
89-
echo "NUM_WORKERS=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
90-
elif [[ "$RUNNER_OS" == "Windows" ]]; then
91-
echo "NUM_WORKERS=$NUMBER_OF_PROCESSORS" >> "$GITHUB_ENV"
92-
fi
93-
shell: bash
60+
uses: ./.github/num-workers
9461
- name: Run tests
9562
run: pixi run --environment=${{ matrix.environment }} tests $NUM_WORKERS
9663

@@ -102,32 +69,14 @@ jobs:
10269
matrix:
10370
runs-on: [ubuntu-latest, ubuntu-24.04-arm]
10471
environment: [tests-debug]
105-
env:
106-
CCACHE_DIR: ${{ github.workspace }}/packages/tests-debug/.ccache
10772
steps:
108-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
109-
- uses: ./.github/ccache
110-
with:
111-
key_segment: ${{ github.workflow }}-${{ matrix.environment }}-${{ matrix.runs-on }}
112-
- name: Setup ${{ matrix.environment }} environment
113-
uses: prefix-dev/setup-pixi@a09b6247153796b190642a2b53fac4241043cf6f # v0.10.0
73+
- name: Checkout xsf
74+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
75+
- name: Setup test environment
76+
uses: ./.github/setup-test-env
11477
with:
115-
pixi-version: v0.77.0
116-
cache: true
117-
cache-key: pixi-v0-${{ github.job }}
118-
environments: ${{ matrix.environment }}
119-
- name: Ccache performance
120-
shell: bash
121-
run: pixi exec ccache -s
78+
environment: ${{ matrix.environment }}
12279
- name: Determine number of workers
123-
run: |
124-
if [[ "$RUNNER_OS" == "Linux" ]]; then
125-
echo "NUM_WORKERS=$(nproc)" >> $GITHUB_ENV
126-
elif [[ "$RUNNER_OS" == "macOS" ]]; then
127-
echo "NUM_WORKERS=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
128-
elif [[ "$RUNNER_OS" == "Windows" ]]; then
129-
echo "NUM_WORKERS=$NUMBER_OF_PROCESSORS" >> "$GITHUB_ENV"
130-
fi
131-
shell: bash
80+
uses: ./.github/num-workers
13281
- name: Run tests
13382
run: pixi run --environment=${{ matrix.environment }} tests $NUM_WORKERS

0 commit comments

Comments
 (0)