Skip to content

Commit 2e3cd4b

Browse files
authored
Merge pull request #6 from Iximiel/feature/testmultipleversion
Setting up a test on multiple python versions
2 parents dbdee92 + 71d2723 commit 2e3cd4b

File tree

1 file changed

+98
-53
lines changed

1 file changed

+98
-53
lines changed

.github/workflows/main.yml

Lines changed: 98 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,76 +3,121 @@ name: CI
33
on: [push, pull_request]
44

55
jobs:
6-
build:
6+
#this is setting up a new "test workflow" following the one we use for the plumed-testcenter
7+
setup-plumed:
78
runs-on: ubuntu-latest
8-
99
steps:
10-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
11-
- uses: actions/checkout@v2
12-
13-
- uses: actions/cache@v2
10+
- name: calculate cache key for the compilation
11+
id: get-key
12+
env:
13+
GH_TOKEN: ${{ github.token }}
14+
run: |
15+
mastersha=$(gh api repos/plumed/plumed2/branches --paginate --jq '.[] | select( .name | match("^master$")) | .commit.sha')
16+
echo "key=$mastersha" >> $GITHUB_OUTPUT
17+
- uses: actions/cache@v4
1418
with:
1519
path: |
16-
~/opt
1720
~/.ccache
18-
key: ccache-${{ runner.os }}-${{ github.sha }}
19-
restore-keys: ccache-${{ runner.os }}-
20-
21-
- name: Set up Python 3.8
22-
uses: actions/setup-python@v2
23-
with:
24-
python-version: 3.8
25-
21+
~/opt
22+
key: ccache-${{ runner.os }}-master-${{ steps.get-key.outputs.key }}
23+
restore-keys: ccache-${{ runner.os }}-master
2624
- name: Set paths
2725
run: |
28-
echo "$HOME/opt/bin" >> $GITHUB_PATH
29-
echo "CPATH=$HOME/opt/include:$HOME/opt/libtorch/include/torch/csrc/api/include/:$HOME/opt/libtorch/include/:$HOME/opt/libtorch/include/torch:$CPATH" >> $GITHUB_ENV
30-
echo "INCLUDE=$HOME/opt/include:$HOME/opt/libtorch/include/torch/csrc/api/include/:$HOME/opt/libtorch/include/:$HOME/opt/libtorch/include/torch:$INCLUDE" >> $GITHUB_ENV
31-
echo "LIBRARY_PATH=$HOME/opt/lib:$HOME/opt/libtorch/lib:$LIBRARY_PATH" >> $GITHUB_ENV
32-
echo "LD_LIBRARY_PATH=$HOME/opt/lib:$HOME/opt/libtorch/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
33-
echo "PYTHONPATH=$HOME/opt/lib/plumed/python:$PYTHONPATH" >> $GITHUB_ENV
34-
# needed to avoid MPI warning
35-
echo "OMPI_MCA_btl=^openib" >> $GITHUB_ENV
36-
37-
- name: Install plumed
26+
echo "$HOME/opt/bin" >> $GITHUB_PATH
27+
echo "CPATH=$HOME/opt/include:$HOME/opt/libtorch/include/torch/csrc/api/include/:$HOME/opt/libtorch/include/:$HOME/opt/libtorch/include/torch:$CPATH" >> $GITHUB_ENV
28+
echo "INCLUDE=$HOME/opt/include:$HOME/opt/libtorch/include/torch/csrc/api/include/:$HOME/opt/libtorch/include/:$HOME/opt/libtorch/include/torch:$INCLUDE" >> $GITHUB_ENV
29+
echo "LIBRARY_PATH=$HOME/opt/lib:$HOME/opt/libtorch/lib:$LIBRARY_PATH" >> $GITHUB_ENV
30+
echo "LD_LIBRARY_PATH=$HOME/opt/lib:$HOME/opt/libtorch/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
31+
echo "PYTHONPATH=$HOME/opt/lib/plumed/python:$PYTHONPATH" >> $GITHUB_ENV
32+
# needed to avoid MPI warning
33+
echo "OMPI_MCA_btl=^openib" >> $GITHUB_ENV
34+
#we need to checkout to access .ci/install.libtorch
35+
# - uses: actions/checkout@v4
36+
# with:
37+
# persist-credentials: false
38+
39+
- name: Install dependencies
3840
run: |
3941
sudo apt update
4042
sudo apt install mpi-default-bin mpi-default-dev
4143
sudo apt install libfftw3-dev gsl-bin libgsl0-dev libboost-serialization-dev
4244
sudo apt install ccache
43-
sudo apt-get update
44-
pip install PyYAML pytz
45-
git clone --bare https://github.com/plumed/plumed2.git
46-
sudo ln -s ccache /usr/local/bin/mpic++
47-
export PATH=/usr/lib/ccache:${PATH}
45+
ccache -p
4846
ccache -s
49-
# .ci/install.libtorch
50-
# version=master or version=f123f12f3 to select a specific version
51-
# pick newest release branch (alphabetic, will fail at v2.10)
52-
# CXX="mpic++" .ci/install.plumed version="$(cd plumed2.git ; git branch | sed "s/^ *//" | grep '^v2\.[0-9]$' | tail -n 1)" repo=$PWD/plumed2.git
53-
# GB: in addition, we install master version as plumed_master
54-
CXX="mpic++" .ci/install.plumed version=master repo=$PWD/plumed2.git
55-
ccache -s
56-
57-
- name: Copy json syntax to directory to upload
47+
mkdir -p ~/.ccache/ccache
48+
- name: Install plumed
49+
uses: plumed/install-plumed@v1
50+
with:
51+
CC: "ccache mpicc"
52+
CXX: "ccache mpic++"
53+
version: master
54+
extra_options: --enable-modules=all --enable-boost_serialization --enable-fftw --enable-libtorch LDFLAGS=-Wl,-rpath,$LD_LIBRARY_PATH --disable-basic-warnings
55+
- name: prepare plumed tar
5856
run: |
59-
mkdir json
60-
cp /home/runner/opt/lib/plumed/json/syntax.json json
61-
62-
- name: Put json file so it can be downloaded
57+
cd $HOME
58+
tar cf plumed-master.tar opt/
59+
60+
- name: Upload artifact
6361
uses: actions/upload-artifact@v4
6462
with:
65-
name: json-syntax
66-
path: json
67-
68-
- name: Install PlumedToHTML
69-
# And install the package
70-
run: python setup.py install
71-
63+
name: plumed-master
64+
path: ~/plumed-master.tar
65+
retention-days: 1
66+
67+
build-and-test:
68+
needs: setup-plumed
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
# as now the various plumed support sites use 3.9 and 3.8 (and with 3.10 starts to fail...)
73+
python-version: ["3.8", "3.9"] #, "3.10", "3.11", "3.12"]
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@v4
77+
with:
78+
persist-credentials: false
79+
- name: Install plumed dependencies
80+
run: |
81+
sudo apt update
82+
sudo apt install mpi-default-bin mpi-default-dev
83+
sudo apt install libfftw3-dev gsl-bin libgsl0-dev libboost-serialization-dev
84+
85+
- name: Set paths
86+
run: |
87+
echo "$HOME/opt/bin" >> $GITHUB_PATH
88+
echo "CPATH=$HOME/opt/include:$HOME/opt/libtorch/include/torch/csrc/api/include/:$HOME/opt/libtorch/include/:$HOME/opt/libtorch/include/torch:$CPATH" >> $GITHUB_ENV
89+
echo "INCLUDE=$HOME/opt/include:$HOME/opt/libtorch/include/torch/csrc/api/include/:$HOME/opt/libtorch/include/:$HOME/opt/libtorch/include/torch:$INCLUDE" >> $GITHUB_ENV
90+
echo "LIBRARY_PATH=$HOME/opt/lib:$HOME/opt/libtorch/lib:$LIBRARY_PATH" >> $GITHUB_ENV
91+
echo "LD_LIBRARY_PATH=$HOME/opt/lib:$HOME/opt/libtorch/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
92+
echo "PYTHONPATH=$HOME/opt/lib/plumed/python:$PYTHONPATH" >> $GITHUB_ENV
93+
# needed to avoid MPI warning
94+
echo "OMPI_MCA_btl=^openib" >> $GITHUB_ENV
95+
- name: Download artifacts with plumed
96+
uses: actions/download-artifact@v4
97+
with:
98+
name: plumed-master
99+
path: ~
100+
- name: Unpacking the artifacts
101+
run: |
102+
cd $HOME
103+
tar xf ${GITHUB_WORKSPACE}/plumed-master.tar
104+
- name: Confirming that plumed can execute
105+
run: |
106+
plumed info --root
107+
cat $(plumed info --root)/json/syntax.json | jq '.["ENDPLUMED"]'
108+
- name: Set up Python ${{ matrix.python-version }}
109+
uses: actions/setup-python@v4
110+
with:
111+
python-version: ${{ matrix.python-version }}
112+
cache: 'pip'
113+
cache-dependency-path: setup.py
114+
- name: Install dependencies
115+
run: |
116+
python -m pip install --upgrade pip
117+
python -m pip install tox
72118
- name: Run tests
73119
run: |
74-
pip install tox
75-
tox
120+
python -m tox
76121
77122
- name: Upload Coverage to Codecov
78-
uses: codecov/codecov-action@v2
123+
uses: codecov/codecov-action@v2

0 commit comments

Comments
 (0)