-
Notifications
You must be signed in to change notification settings - Fork 7
95 lines (91 loc) · 3.21 KB
/
tests.yml
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
# A single CI script with github workflow to test NNPDF, and upload the conda package and documentation
name: Tests
on: [push]
concurrency:
group: ${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11"]
include:
- os: ubuntu-latest
CONDA_OS: linux-64
- os: macos-latest
CONDA_OS: osx-64
fail-fast: false
runs-on: ${{ matrix.os }}
env:
NETRC_FILE: ${{ secrets.NETRC_FILE }}
NNPDF_SSH_KEY: ${{ secrets.NNPDF_SSH_KEY }}
PYTHONHASHSEED: "0"
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
use-mamba: true
auto-update-conda: true
activate-environment: test
- name: Install macOS SDK
if: startsWith(matrix.os, 'macOS')
shell: bash -l {0}
run: |
curl -L -O https://data.nnpdf.science/MacOSX10.9.sdk.tar.xz
tar xfz MacOSX10.9.sdk.tar.xz -C $CONDA_PREFIX
- name: Setup conda
shell: bash -l {0}
run: |
echo "$NETRC_FILE" | base64 --decode > ~/.netrc
conda config --remove channels defaults
conda config --append channels conda-forge
conda config --prepend channels https://packages.nnpdf.science/public
conda config --set show_channel_urls true
- name: Install boa in Linux
if: startsWith(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
conda install boa --yes
- name: Build recipe and run tests on linux
if: startsWith(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
conda mambabuild -q conda-recipe
- name: Extra setup settings for macOS and install boa
if: startsWith(matrix.os, 'macOS')
shell: bash -l {0}
run: |
conda config --prepend channels defaults
conda install boa conda-build==3.28 --yes
- name: Build recipe and run tests on macOS
if: startsWith(matrix.os, 'macOS')
shell: bash -l {0}
run: |
export CONDA_BUILD_SYSROOT=$CONDA_PREFIX/MacOSX10.9.sdk
conda build -q conda-recipe
- name: Upload conda package to NNPDF server
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')}}
shell: bash -l {0}
run: |
KEY=$( mktemp )
echo "$NNPDF_SSH_KEY" | base64 --decode > "$KEY"
scp -i "$KEY" -o StrictHostKeyChecking=no\
$CONDA_PREFIX/conda-bld/${{matrix.CONDA_OS}}/*.tar.bz2 \
[email protected]:~/packages/conda/${{matrix.CONDA_OS}}
- name: Build and upload sphinx documentation to NNPDF server
if: startsWith(matrix.os, 'ubuntu') && github.ref == 'refs/heads/master' && matrix.python-version == '3.9'
shell: bash -l {0}
run: |
KEY=$( mktemp )
echo "$NNPDF_SSH_KEY" | base64 --decode > "$KEY"
conda install nnpdf --yes
cd doc/sphinx
make html
scp -r -i "$KEY" -o StrictHostKeyChecking=no\
build/html/* \
[email protected]:~/sphinx-docs/