-
Notifications
You must be signed in to change notification settings - Fork 7
102 lines (95 loc) · 4.5 KB
/
Copy pathpython-package.yml
File metadata and controls
102 lines (95 loc) · 4.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ master, meson ]
pull_request:
branches: [ master, meson ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y libpcre2-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest ase
# In-tree extxyz reports 0.2.2.devN+gSHA until the v0.3.0 tag,
# which is < 0.3.0 by PEP 440. ase-extxyz declares
# extxyz>=0.3.0 — install it with --no-deps so pip doesn't try
# to satisfy that from PyPI (where 0.3.0 isn't published yet).
python -m pip install . --verbose
python -m pip install --no-deps ./python/ase-extxyz
- name: Assert C-API fast read path is active
# numpy is a build-time dependency, so a source build must produce the
# C-API read path; fail loudly if it silently fell back to ctypes.
run: python tools/assert_c_read_path.py
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude .git,QUIP
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=.git,QUIP
- name: Build QUIP/libAtoms via Meson
run: |
sudo apt-get update -y
sudo apt-get install -y gfortran libopenblas-dev \
openmpi-bin libopenmpi-dev netcdf-bin libnetcdf-dev libhdf5-serial-dev
python -m pip install --upgrade meson ninja
git clone --recursive https://github.com/libAtoms/QUIP QUIP
# QUIP's meson.build currently references GAP unconditionally
# (Potentials/meson.build), so we have to set -Dgap=true even
# though we only build the libAtoms target.
meson setup QUIP/builddir QUIP -Dgap=true -Dmpi=false
# f90wrap_stub provides f90wrap_abort_, which libAtoms references
# via f90wrap_abort hooks; needed when linking standalone Fortran.
meson compile -C QUIP/builddir libAtoms f90wrap_stub
- name: Build libextxyz, cextxyz and fextxyz via Meson
run: |
# Meson library('libAtoms', ...) outputs liblibAtoms.so under the
# target's build subdirectory. Fortran .mod files land in a
# target-private "*.p" dir alongside the library.
QUIP_LIB_DIR=${PWD}/QUIP/builddir/src/libAtoms
QUIP_MOD_DIR=$(find ${PWD}/QUIP/builddir -iname 'libatoms_module.mod' -printf '%h\n' | head -1)
echo "QUIP_LIB_DIR=$QUIP_LIB_DIR"
echo "QUIP_MOD_DIR=$QUIP_MOD_DIR"
test -n "$QUIP_MOD_DIR" || { echo "libatoms_module.mod not found"; exit 1; }
meson setup builddir \
-Dquip_lib_dir="$QUIP_LIB_DIR" \
-Dquip_mod_dir="$QUIP_MOD_DIR"
meson compile -C builddir extxyz cextxyz fextxyz
# Make fextxyz visible at the path tests/conftest.py expects.
ln -sf "${PWD}/builddir/libextxyz/fextxyz" libextxyz/fextxyz
- name: Test extxyz core (no ASE imports)
run: pytest -v tests/
- name: Test ase-extxyz (incl. fextxyz Fortran round-trip)
run: USE_FORTRAN=T pytest -v python/ase-extxyz/tests/
- name: Test with the first-char dispatch comment parser (use_cleri=False)
# Run the whole C-backend suite through the dispatcher so every fixture
# exercises it, in addition to the differential parity test.
run: |
USE_CLERI=false USE_CEXTXYZ=true pytest -v python/ase-extxyz/tests/
pytest -v tests/test_dispatch_parity.py
# Uncomment to get SSH access for testing
# - name: Setup tmate session
# if: failure()
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 15