1- name : cypari2
1+ name : CI
22
33on :
44 pull_request :
@@ -15,78 +15,106 @@ concurrency:
1515
1616jobs :
1717 build :
18+ name : Build and Test (${{ matrix.os }}, Python ${{ matrix.python-version }}, PARI ${{ matrix.pari-version }})
1819 runs-on : ${{ matrix.os }}
1920 strategy :
2021 fail-fast : false
2122 matrix :
2223 os : [ubuntu-latest]
23- python-version : ['3.10', '3.11', '3.12', '3.13']
24- pari-version : ['pari-2.13.0', 'pari-2.15.4', 'pari-2.15.5', '2.17.2']
24+ python-version : ['3.12', '3.13']
25+ pari-version : ['2.13.0', '2.15.4', '2.15.5', '2.17.2']
26+ include :
27+ - os : macos-latest
28+ python-version : ' 3.12'
29+ pari-version : ' 2.17.2' # Whatever comes with homebrew
30+ - os : macos-latest
31+ python-version : ' 3.13'
32+ pari-version : ' 2.17.2' # Whatever comes with homebrew
2533 env :
2634 LC_ALL : C
2735 PARI_VERSION : ${{ matrix.pari-version }}
36+ defaults :
37+ run :
38+ shell : ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash' }}
2839 steps :
2940 - name : Set up the repository
3041 uses : actions/checkout@v4
42+ - name : Setup MSYS2
43+ if : runner.os == 'Windows'
44+ id : msys2
45+ uses : msys2/setup-msys2@v2
46+ with :
47+ msystem : UCRT64
48+ update : true
49+ install : >-
50+ base-devel
51+ m4
52+ bison
53+ make
54+ patch
55+ sed
56+ wget
57+ mingw-w64-ucrt-x86_64-toolchain
58+ mingw-w64-ucrt-x86_64-gmp
59+ mingw-w64-ucrt-x86_64-python
60+ mingw-w64-ucrt-x86_64-python-pip
61+ mingw-w64-ucrt-x86_64-meson-python
62+ mingw-w64-ucrt-x86_64-cython
63+ path-type : inherit
3164 - name : Set up Python ${{ matrix.python-version }}
65+ if : runner.os != 'Windows'
3266 uses : actions/setup-python@v4
3367 with :
3468 python-version : ${{ matrix.python-version }}
35- - name : Install pari
69+ - name : Install PARI
70+ if : matrix.os != 'macos-latest'
71+ run : |
72+ bash -x .install-pari.sh
73+ - name : Install PARI
74+ if : matrix.os == 'macos-latest'
3675 run : |
37- bash -x . install- pari.sh
38- - name : Local build
76+ brew install pari
77+ - name : Smoke test PARI
3978 run : |
40- make install
41- make check
42- pip install sphinx
43- (cd docs && make html)
44-
45- dist :
46- runs-on : ubuntu-latest
47- steps :
48- - name : Check out ${{ env.SPKG }}
49- uses : actions/checkout@v4
50- with :
51- path : build/pkgs/${{ env.SPKG }}/src
52- - name : Set up Python ${{ matrix.python-version }}
53- uses : actions/setup-python@v4
54- - name : Install prerequisites
55- run : |
56- sudo DEBIAN_FRONTEND=noninteractive apt-get update
57- sudo DEBIAN_FRONTEND=noninteractive apt-get install $DIST_PREREQ
58- python3 -m pip install build
59- - name : Run make dist, prepare upstream artifact
60- run : |
61- (cd build/pkgs/${{ env.SPKG }}/src && python3 -m build --sdist) \
62- && mkdir -p upstream && cp build/pkgs/${{ env.SPKG }}/src/dist/*.tar.gz upstream/${{ env.SPKG }}-git.tar.gz \
63- && echo "sage-package create ${{ env.SPKG }} --version git --tarball ${{ env.SPKG }}-git.tar.gz --type=standard" > upstream/update-pkgs.sh \
64- && if [ -n "${{ env.REMOVE_PATCHES }}" ]; then echo "(cd ../build/pkgs/${{ env.SPKG }}/patches && rm -f ${{ env.REMOVE_PATCHES }}; :)" >> upstream/update-pkgs.sh; fi \
65- && ls -l upstream/
66- - uses : actions/upload-artifact@v4
67- with :
68- path : upstream
69- name : upstream
79+ if [ ${{ runner.os }} = macOS ]; then
80+ HOMEBREW=`brew --prefix`
81+ clang -v tests/test.c -o test -I$HOMEBREW/include -L$HOMEBREW/lib -lpari -lgmp
82+ else
83+ gcc -v tests/test.c -o test -I/usr/local/include -L/usr/local/bin -lpari -lgmp
84+ fi
85+ expected="zeta(2) = 1.6449340668482264364
86+ p = x^3 + x^2 + x - 1
87+ modulus = y^3 + y^2 + y - 1
88+ centerlift(lift(fq)) = [x - y, 1; x + (y^2 + y - 1), 1; x + (-y^2 - 1), 1]"
89+ output="$(./test)"
90+ # Normalize newlines for comparison
91+ output="$(echo "$output" | tr -d '\r')"
92+ expected="$(echo "$expected" | tr -d '\r')"
93+ echo -e "Got:\n$output"
94+ if [ "$output" != "$expected" ]; then
95+ echo "Unexpected output from test.c"
96+ echo -e "Expected:\n$expected"
97+ exit 1
98+ fi
7099
71- sage :
72- uses : sagemath/sage/.github/workflows/docker.yml@develop
73- with :
74- targets : SAGE_CHECK=no SAGE_CHECK_PACKAGES="cypari" cypari
75- targets_optional : build/make/Makefile
76- sage_repo : sagemath/sage
77- sage_ref : develop
78- upstream_artifact : upstream
79- # We prefix the image name with the SPKG name ("cypari2-") to avoid the error
80- # 'Package "sage-docker-..." is already associated with another repository.'
81- docker_push_repository : ghcr.io/${{ github.repository }}/cypari2-
82- tox_packages_factors : >-
83- ["standard"]
84- needs : [dist]
100+ - name : Setup uv
101+ uses : astral-sh/setup-uv@v6
85102
86- env :
87- # Ubuntu packages to install so that building the sdist can succeed
88- DIST_PREREQ : libpari-dev pari-doc libbz2-dev bzip2
89- # Name of this project in the Sage distribution
90- SPKG : cypari
91- # Remove all downstream patches
92- REMOVE_PATCHES : " *"
103+ - name : Build
104+ run : |
105+ if [ ${{ runner.os }} = Windows ]; then
106+ export C_INCLUDE_PATH=$(cygpath -am "${{ steps.msys2.outputs.msys2-location }}")/usr/local/include
107+ export LIBRARY_PATH=$(cygpath -am "${{ steps.msys2.outputs.msys2-location }}")/usr/local/bin
108+ fi
109+ echo $PATH
110+ echo $C_INCLUDE_PATH
111+ echo $LIBRARY_PATH
112+ uv sync --frozen --inexact -v --no-install-project
113+ uv sync --frozen --inexact -v --no-build-isolation --no-editable --config-settings=builddir=builddir
114+ - name : Test
115+ run : |
116+ uv run make check
117+ - name : Build docs
118+ run : |
119+ uv sync --frozen --inexact -v --group doc
120+ (cd docs && uv run make html)
0 commit comments