Change position of comment #851
Workflow file for this run
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
on: [push] | |
name: "Conda packaging" | |
jobs: | |
build-conda: | |
name: Build conda packages | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
# This is necessary for the conda action. It replaces `conda init` as | |
# the shell does not load ,profile or .bashrc. | |
shell: bash -el {0} | |
env: | |
build_command: "conda-build --prefix-length=100 --no-test --no-anaconda-upload " | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # We need all the history to figure out the version number | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
miniforge-version: latest | |
- name: Set environment variables | |
run: | | |
echo NANOVER_DOC_URL="https://irl2.github.io/nanover/" >> "$GITHUB_ENV" | |
echo NANOVER_REPO_URL="https://github.com/IRL2/nanover-protocol" >> "$GITHUB_ENV" | |
echo NANOVER_BUILD_VERSION="0.1.$(git rev-list --count HEAD)" >> "$GITHUB_ENV" | |
echo NANOVER_LICENSE_PATH="$(readlink -f LICENSE)" >> "$GITHUB_ENV" | |
echo MIN_PYTHON_VERSION=3.11 >> "$GITHUB_ENV" | |
- name: Test that the repo is sane and does not contain superfluous __init__ file | |
run: bash ./maintainers/check_extra_init_files.sh | |
- name: Install dependencies | |
run: conda install -y python conda-build "grpcio-tools<1.62" conda-verify | |
- name: Compiling the prototypes | |
run: python ./python-libraries/compile_proto.py --proto-dir=./protocol --python-dir=./python-libraries/nanover-core/src | |
- name: Building the Conda packages | |
run: | | |
$build_command \ | |
python-libraries/nanover-essd/conda \ | |
python-libraries/nanover-core/conda \ | |
python-libraries/nanover-openmm/conda \ | |
python-libraries/nanover-ase/conda \ | |
python-libraries/nanover-mdanalysis/conda \ | |
python-libraries/nanover-lammps/conda \ | |
python-libraries/nanover-omni/conda \ | |
python-libraries/nanover-jupyter/conda \ | |
python-libraries/nanover-server/conda | |
- run: | | |
mkdir artifacts | |
cp -r ${CONDA_PREFIX}/conda-bld ./artifacts | |
ls ./artifacts | |
- name: Save the artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: conda-packages | |
path: ./artifacts | |
test-conda: | |
name: Python tests | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
continue-on-error: true | |
needs: build-conda | |
defaults: | |
run: | |
# This is necessary for the conda action. It replaces `conda init` as | |
# the shell does not load ,profile or .bashrc. | |
shell: bash -el {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
miniforge-version: latest | |
- name: Retrieve conda packages | |
uses: actions/download-artifact@v3 | |
with: | |
name: conda-packages | |
- name: Install NanoVer | |
run: conda install -y -c conda-forge -c ./conda-bld mpi4py nanover-server nanover-lammps | |
- name: Install tests dependancies | |
run: python -m pip install -r python-libraries/requirements.test | |
- name: Parallel tests | |
run: python -m pytest --cov nanover python-libraries -n auto -m 'not serial' | |
- name: Serial tests | |
run: python -m pytest --cov nanover python-libraries -n 1 -m 'serial' | |
publish-conda: | |
name: Publish the conda packages on Anaconda cloud | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: test-conda | |
defaults: | |
run: | |
# This is necessary for the conda action. It replaces `conda init` as | |
# the shell does not load ,profile or .bashrc. | |
shell: bash -el {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
# WARNING! On the contrary to all the other places where we install | |
# conda, we install miniconda and NOT miniforge! | |
# This is because we do not need packages to RUN nanover, but packages | |
# from the default (anaconda) channel to upload to anaconda. | |
miniconda-version: latest | |
- name: Retrieve conda packages | |
uses: actions/download-artifact@v3 | |
with: | |
name: conda-packages | |
- name: Install Anaconda | |
run: conda install -y anaconda-client | |
- name: Connect to Anaconda cloud | |
# The login token may be used by a failed build already. If we are asked | |
# if we want it back, we say yes. Hence the echo Y. | |
run: echo Y | anaconda login --username irl_bot --password ${{ secrets.ANACONDA_PASSWORD }} | |
- name: Upload packages | |
# Anaconda will complain if the given version of a package is already | |
# there. Until we have some versioning, we force the upload. | |
run: anaconda upload --user irl conda-bld/noarch/nanover-*.tar.bz2 --force | |
- name: Disconnect from Anaconda cloud | |
# Do not fail the build if we cannot logout. | |
run: anaconda logout || echo "Could not logout. Too bad." |