7.improve CIworkflow #29
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
name: conda-env-create-and-pytest | |
on: [pull_request] | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Add conda to system path | |
run: | | |
# $CONDA is an environment variable pointing to the root of the miniconda directory | |
echo $CONDA/bin >> $GITHUB_PATH | |
- name: Create catalogbuilder environment | |
run: | | |
# create environment catalogbuilder will be installed into | |
conda env create -f environment.yml --name catalogbuilder | |
# put conda env binaries in GITHUB_PATH | |
echo $CONDA/envs/catalogbuilder/bin >> $GITHUB_PATH | |
# install catalogbuilder | |
$CONDA/envs/catalogbuilder/bin/python -m pip install --prefix $CONDA/envs/catalogbuilder/bin . | |
- name: Run pytest in catalogbuilder environment | |
run: | | |
which python | |
python --version | |
$CONDA/envs/catalogbuilder/bin/python --version | |
# which pytest | |
$CONDA/envs/catalogbuilder/bin/pytest catalogbuilder | |
- name: Make sample data | |
run: | | |
which python | |
python catalogbuilder/tests/make_sample_data.py | |
- name: Generate catalog | |
run: | | |
which python | |
python catalogbuilder/scripts/gen_intake_gfdl.py archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp gfdl_autotest | |
- name: Generate catalog with yaml | |
run: | | |
which python | |
python catalogbuilder/scripts/gen_intake_gfdl.py --config catalogbuilder/tests/test_config.yaml | |
- name: upload-artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: workflow-artifacts1 | |
path: | | |
gfdl_autotest.csv | |
gfdl_autotest.json | |
cats/gfdl_autotest_from_yaml.csv | |
cats/gfdl_autotest_from_yaml.json | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@v4 | |
- name: Run pytest with downloaded artifacts | |
run: | | |
$CONDA/envs/catalogbuilder/bin/pytest -v --runxfail catalogbuilder | |
- name: Test for completeness | |
run: | | |
which python | |
python catalogbuilder/scripts/test_catalog.py -tf gfdl_autotest.json catalogbuilder/cats/gfdl_template.json | |
python catalogbuilder/scripts/test_catalog.py -tf catalogbuilder/cats/gfdl_autotest_from_yaml.json |