Skip to content

Commit cba9a6e

Browse files
committed
ci: reduce memory usage to prevent job cancellations
- Add max-parallel: 4 to limit concurrent matrix jobs - Reduce pytest parallelism from auto to 4 workers - Add --dist loadfile for better memory efficiency - Add 10GB swap space to all CI jobs
1 parent 963a727 commit cba9a6e

3 files changed

Lines changed: 22 additions & 4 deletions

File tree

.github/workflows/build-ultraplot.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ jobs:
3232
env:
3333
TEST_MODE: ${{ inputs.test-mode }}
3434
TEST_NODEIDS: ${{ inputs.test-nodeids }}
35+
PYTEST_WORKERS: 4
3536
steps:
37+
- name: Set up swap space
38+
uses: pierotofy/set-swap-space@master
39+
with:
40+
swap-size-gb: 10
41+
3642
- uses: actions/checkout@v6
3743
with:
3844
fetch-depth: 0
@@ -62,10 +68,16 @@ jobs:
6268
IS_PR: ${{ github.event_name == 'pull_request' }}
6369
TEST_MODE: ${{ inputs.test-mode }}
6470
TEST_NODEIDS: ${{ inputs.test-nodeids }}
71+
PYTEST_WORKERS: 4
6572
defaults:
6673
run:
6774
shell: bash -el {0}
6875
steps:
76+
- name: Set up swap space
77+
uses: pierotofy/set-swap-space@master
78+
with:
79+
swap-size-gb: 10
80+
6981
- uses: actions/checkout@v6
7082

7183
- uses: mamba-org/setup-micromamba@v2.0.7
@@ -138,7 +150,7 @@ jobs:
138150
echo "No valid nodeids found on base; skipping baseline generation."
139151
exit 0
140152
else
141-
pytest -n auto --tb=short --disable-warnings -W ignore \
153+
pytest -n ${PYTEST_WORKERS} --dist loadfile --tb=short --disable-warnings -W ignore \
142154
--mpl-generate-path=./ultraplot/tests/baseline/ \
143155
--mpl-default-style="./ultraplot.yml" \
144156
${FILTERED_NODEIDS} || status=$?
@@ -149,7 +161,7 @@ jobs:
149161
fi
150162
exit "$status"
151163
else
152-
pytest -n auto --tb=short --disable-warnings -W ignore \
164+
pytest -n ${PYTEST_WORKERS} --dist loadfile --tb=short --disable-warnings -W ignore \
153165
--mpl-generate-path=./ultraplot/tests/baseline/ \
154166
--mpl-default-style="./ultraplot.yml" \
155167
ultraplot/tests
@@ -188,7 +200,7 @@ jobs:
188200
echo "No valid nodeids found on PR branch; skipping image comparison."
189201
exit 0
190202
else
191-
pytest -n auto --tb=short --disable-warnings -W ignore \
203+
pytest -n ${PYTEST_WORKERS} --dist loadfile --tb=short --disable-warnings -W ignore \
192204
--mpl \
193205
--mpl-baseline-path=./ultraplot/tests/baseline \
194206
--mpl-results-path=./results/ \
@@ -202,7 +214,7 @@ jobs:
202214
fi
203215
exit "$status"
204216
else
205-
pytest -n auto --tb=short --disable-warnings -W ignore \
217+
pytest -n ${PYTEST_WORKERS} --dist loadfile --tb=short --disable-warnings -W ignore \
206218
--mpl \
207219
--mpl-baseline-path=./ultraplot/tests/baseline \
208220
--mpl-results-path=./results/ \

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ jobs:
217217
python-version: ${{ fromJson(needs.get-versions.outputs.python-versions) }}
218218
matplotlib-version: ${{ fromJson(needs.get-versions.outputs.matplotlib-versions) }}
219219
fail-fast: false
220+
max-parallel: 4
220221
uses: ./.github/workflows/build-ultraplot.yml
221222
concurrency:
222223
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.python-version }}-${{ matrix.matplotlib-version }}

.github/workflows/test-map.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ jobs:
1414
run:
1515
shell: bash -el {0}
1616
steps:
17+
- name: Set up swap space
18+
uses: pierotofy/set-swap-space@master
19+
with:
20+
swap-size-gb: 10
21+
1722
- uses: actions/checkout@v6
1823
with:
1924
fetch-depth: 0

0 commit comments

Comments
 (0)