Skip to content

369.fre-cli mkmf dependency #1476

369.fre-cli mkmf dependency

369.fre-cli mkmf dependency #1476

name: create_test_conda_env
on:
pull_request:
branches:
- main
push:
branches:
- main
# cancel running jobs if theres a newer push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-linux:
runs-on: ubuntu-latest
container:
image: ghcr.io/noaa-gfdl/fre-cli:miniconda24_gcc14_v2
options: "--privileged --cap-add=sys_admin --cap-add=mknod --device=/dev/fuse --security-opt seccomp=unconfined --security-opt label=disable --security-opt apparmor=unconfined" # needed for podman
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

Check failure on line 25 in .github/workflows/create_test_conda_env.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/create_test_conda_env.yml

Invalid workflow file

You have an error in your yaml syntax on line 25
- name: Create fre-cli environment
run: |
# create env holding all deps, the env cant be explicitly activated in CI/CD
conda env create -f environment.yml --name fre-cli
# sets CONDA to wherever it may be on the image
source /root/.bashrc
# add conda env's executables and mkmf to github's PATH equiv.
echo $CONDA/envs/fre-cli/bin >> $GITHUB_PATH
# echo $PWD/mkmf/bin >> $GITHUB_PATH
# use *conda environment's pip* to install fre-cli, called w/ full path as module for explicitness
$CONDA/envs/fre-cli/bin/python -m pip install --prefix $CONDA/envs/fre-cli .
- name: Run pytest in fre-cli environment
run: |
# add spack installed binaries to front of path so that conda's netcdf/hdf5 installs don't break compilation tests
export path_save=$PATH
export PATH="/opt/views/view/bin:$PATH"
# run pytest
coverage run -m pytest --durations=20 --log-level INFO --junit-xml=pytest_results.xml --config-file=pytest.ini --cov-config=coveragerc --cov-report=xml --cov=fre fre/
# restore original path and install genbadge to generate coverage badge based on xml
export PATH="$path_save"
# install genbadge to make badge from coverage/test stats
pip install defusedxml genbadge
# genbadge coverage
genbadge coverage -v -i coverage.xml -o docs/cov_badge.svg
# genbadge tests
genbadge tests -v -i pytest_results.xml -o docs/pytest_badge.svg
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: coverage.xml
- name: Run pylint in fre-cli environment
run: |
# run pylint, ignored modules avoid warnings arising from code internal to those modules
pylint --max-line-length 120 --max-args 6 -ry --ignored-modules netCDF4,cmor fre/ || echo "pylint returned non-zero exit code. preventing workflow from dying with this echo."
- name: Install Sphinx and Build Documentation
run: |
# pip install sphinx and themes, upgrade theme
pip install sphinx renku-sphinx-theme sphinx-rtd-theme
pip install --upgrade sphinx-rtd-theme
# have sphinx build the docs
sphinx-apidoc --ext-autodoc --output-dir docs fre/ --separate
sphinx-build -E docs build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: build/
force_orphan: true