Skip to content

Commit

Permalink
Add CI tests via GitHub actions.
Browse files Browse the repository at this point in the history
Add CI tests via GitHub actions.
  • Loading branch information
alperaltuntas authored Mar 27, 2024
1 parent 4be1f1e commit 9ba1a39
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 48 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This workflow will install CESM, create visualCaseGen conda env, and run all CI tests.

name: visualCaseGen CI

on:
push:
branches: [ "main", "ci" ]
pull_request:
branches: [ "main", "ci" ]

jobs:
ci_tests:
name: visualCaseGen CI tests
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -el {0}
steps:

- name: Install xmllint
run: sudo apt-get install -y libxml2-utils

# clone CESM
- uses: actions/checkout@v4
with:
repository: alperaltuntas/CESM
ref: cesm2_3_alpha17b_gui
#submodules: recursive

# Run manage_Externals
- name: checkout CESM
run: |
./manage_externals/checkout_externals -o
# set up conda
- uses: conda-incubator/setup-miniconda@v3

# visualCaseGen conda env
- name: Create visualCaseGen conda env
run: |
cd visualCaseGen/
conda env create --file environment.yml
conda activate visualCaseGen
# Run all tests
- name: Run tests
env:
CIME_MODEL: "cesm"
CIME_DRIVER: "nuopc"
CIME_TEST_PLATFORM: ubuntu-latest
run: |
export SRC_PATH="${GITHUB_WORKSPACE}"
mkdir -p /home/runner/cesm/scratch
cd visualCaseGen/
conda activate visualCaseGen
pytest tests
45 changes: 0 additions & 45 deletions .github/workflows/python-app.yml

This file was deleted.

8 changes: 5 additions & 3 deletions visualCaseGen/cime_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,11 @@ def _retrieve_machines(self):
f"Couldn't determine CIME_OUTPUT_ROOT for {self.machine}"
)
if not os.path.exists(self.cime_output_root):
logger.error(
f"CIME_OUTPUT_ROOT doesn't exist: {self.cime_output_root}"
logger.warning(
f"CIME_OUTPUT_ROOT doesn't exist. Creating it at {self.cime_output_root}"
)
# recursively create the directory
os.makedirs(self.cime_output_root)

# Determine DIN_LOC_ROOT
din_loc_root_node = machines_obj.get_child(
Expand All @@ -542,7 +544,7 @@ def _retrieve_machines(self):
logger.error(f"DIN_LOC_ROOT doesn't exist: {self.din_loc_root}")

break

# Keep a record of whether a project id is required for each machine
for machine in self.machines:
machines_obj = Machines(machs_file, machine=machine)
Expand Down

0 comments on commit 9ba1a39

Please sign in to comment.