Merge pull request #1954 from NNPDF/poldb #3959
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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/ |