File tree Expand file tree Collapse file tree 6 files changed +37
-51
lines changed Expand file tree Collapse file tree 6 files changed +37
-51
lines changed Original file line number Diff line number Diff line change 1
1
# This file is @generated by <https://github.com/liblaf/copier-python>.
2
2
# DO NOT EDIT!
3
3
# prettier-ignore
4
- _commit : 1ca09a0
4
+ _commit : 5f6ae09
5
5
_src_path : gh:liblaf/copier-python
6
6
answers_file_shared : .config/copier/.copier-answers.shared.yaml
7
7
namespace : ' '
Original file line number Diff line number Diff line change @@ -12,11 +12,11 @@ function has() {
12
12
if [[ -f ' pixi.lock' ]]; then
13
13
pixi=' pixi'
14
14
if has pixi-wrapper.sh; then pixi=' pixi-wrapper.sh' ; fi
15
- " $pixi " install
15
+ " $pixi " install " $@ "
16
16
fi
17
17
18
18
if [[ -f ' uv.lock' ]]; then
19
19
uv=' uv'
20
20
if has uv-wrapper.sh; then uv=' uv-wrapper.sh' ; fi
21
- " $uv " sync --all-extras --all-groups
21
+ " $uv " sync --all-extras --all-groups " $@ "
22
22
fi
Original file line number Diff line number Diff line change @@ -5,27 +5,45 @@ set -o errexit
5
5
set -o nounset
6
6
set -o pipefail
7
7
8
- function is-true() {
9
- case " ${1,,} " in
8
+ function is-in-ci() {
9
+ if [[ -z ${CI:- } ]]; then
10
+ return 1
11
+ fi
12
+ case " ${CI,,} " in
10
13
1 | on | true | y | yes) return 0 ;;
11
14
0 | off | false | n | no | " " ) return 1 ;;
12
15
* )
13
- echo " Invalid boolean: $1 ." >&2
16
+ echo " Invalid boolean: $CI ." >&2
14
17
exit 1
15
18
;;
16
19
esac
17
20
}
18
21
22
+ function needs-gpu() {
23
+ for pkg in jax torch warp; do
24
+ if python -c " import $pkg " ; then
25
+ return 0
26
+ fi
27
+ done
28
+ return 1
29
+ }
30
+
19
31
# ref: <https://github.com/scientific-python/lazy-loader#early-failure>
20
32
export EAGER_IMPORT=1
21
33
22
- if is-true " ${CI-} " ; then
34
+ if needs-gpu; then
35
+ numprocesses=' 0'
36
+ else
37
+ numprocesses=' auto'
38
+ fi
39
+
40
+ if is-in-ci; then
23
41
# ref: <https://docs.codecov.com/docs/test-analytics#1-output-a-junit-xml-file-in-your-ci>
24
42
pytest \
25
43
--junit-xml=' junit.xml' --override-ini junit_family=legacy \
26
44
--cov --cov-branch \
27
- --numprocesses ' auto ' \
45
+ --numprocesses " $numprocesses " \
28
46
" $@ "
29
47
else
30
- pytest --numprocesses ' auto ' " $@ "
48
+ pytest --numprocesses " $numprocesses " " $@ "
31
49
fi
Original file line number Diff line number Diff line change @@ -13,11 +13,11 @@ function has() {
13
13
if [[ -f ' pixi.lock' ]]; then
14
14
pixi=' pixi'
15
15
if has pixi-wrapper.sh; then pixi=' pixi-wrapper.sh' ; fi
16
- " $pixi " upgrade
16
+ " $pixi " upgrade " $@ "
17
17
fi
18
18
19
19
if [[ -f ' uv.lock' ]]; then
20
20
uv=' uv'
21
21
if has uv-wrapper.sh; then uv=' uv-wrapper.sh' ; fi
22
- " $uv " sync --upgrade
22
+ " $uv " sync --upgrade " $@ "
23
23
fi
Original file line number Diff line number Diff line change @@ -23,29 +23,11 @@ jobs:
23
23
with :
24
24
cancel-others : true
25
25
26
- detect :
27
- name : Detect
28
- needs :
29
- - skip-duplicate
30
- if : needs.skip-duplicate.outputs.should-skip != 'true'
31
- runs-on : ubuntu-latest
32
- outputs :
33
- bench : ${{ steps.bench.outcome == 'success' }}
34
- steps :
35
- - name : Checkout
36
- uses : actions/checkout@v5
37
- - id : bench
38
- name : Detect Benches
39
- run : |-
40
- find "benches" -name "test_*.py" -type f -print -quit |
41
- grep --quiet "benches"
42
- continue-on-error : true
43
-
44
26
bench :
45
27
name : Bench
46
28
needs :
47
- - detect
48
- if : needs.detect .outputs.bench = = 'true'
29
+ - skip-duplicate
30
+ if : needs.skip-duplicate .outputs.should-skip ! = 'true'
49
31
runs-on : ubuntu-latest
50
32
steps :
51
33
- name : Checkout
59
41
with :
60
42
run : mise run bench
61
43
mode : instrumentation
44
+ env :
45
+ FORCE_COLOR : 1
Original file line number Diff line number Diff line change @@ -25,29 +25,11 @@ jobs:
25
25
with :
26
26
cancel-others : true
27
27
28
- detect :
29
- name : Detect
30
- needs :
31
- - skip-duplicate
32
- if : needs.skip-duplicate.outputs.should-skip != 'true'
33
- runs-on : ubuntu-latest
34
- outputs :
35
- test : ${{ steps.test.outcome == 'success' }}
36
- steps :
37
- - name : Checkout
38
- uses : actions/checkout@v5
39
- - id : test
40
- name : Detect Tests
41
- run : |-
42
- find "tests" -name "test_*.py" -type f -print -quit |
43
- grep --quiet "tests"
44
- continue-on-error : true
45
-
46
28
test :
47
29
name : Test
48
30
needs :
49
- - detect
50
- if : needs.detect .outputs.test = = 'true'
31
+ - skip-duplicate
32
+ if : needs.skip-duplicate .outputs.should-skip ! = 'true'
51
33
permissions :
52
34
id-token : write
53
35
runs-on : ubuntu-latest
62
44
uses : jdx/mise-action@v3
63
45
- name : Test
64
46
run : mise run test
47
+ env :
48
+ FORCE_COLOR : 1
65
49
- name : Upload Coverage
66
50
uses : codecov/codecov-action@v5
67
51
with :
You can’t perform that action at this time.
0 commit comments