Copy only necessary cmake macros to case #526
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: cime testing | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'doc/**' | |
pull_request: | |
branches: | |
- master | |
paths-ignore: | |
- 'doc/**' | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
# Offical action is deprecated in favor of pre-commit.ci | |
# Should evaulate switching or just running manually. | |
# - name: Runs pre-commit action | |
# # Do not run if using act tooling (https://github.com/nektos/act) | |
# if: ${{ !env.ACT }} | |
# uses: pre-commit/action@v2.0.3 | |
- name: Runs pre-commit | |
run: | | |
pip install pre-commit | |
pre-commit run -a | |
# Check if there has been a change to any file under docker/ | |
get-docker-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
any_changed: ${{ steps.get-changed-files.outputs.any_changed }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Get changed files | |
id: get-changed-files | |
uses: tj-actions/changed-files@v29 | |
with: | |
files: docker | |
# Only build container if there has been a change. | |
build-containers: | |
runs-on: ubuntu-latest | |
needs: get-docker-changes | |
if: ${{ needs.get-docker-changes.outputs.any_changed == 'true' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: jasonb87/cime | |
tags: | | |
type=raw,value=latest | |
type=sha,prefix={{ date 'YYYYMMDD' }}_,format=short | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
target: base | |
context: docker/ | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=registry,ref=jasonb87/cime:buildcache | |
cache-to: type=registry,ref=jasonb87/cime:buildcache,mode=max | |
# Runs unit testing under different python versions. | |
unit-testing: | |
runs-on: ubuntu-latest | |
needs: build-containers | |
if: ${{ always() && ! cancelled() }} | |
container: jasonb87/cime:latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Run tests | |
shell: bash | |
env: | |
INIT: "false" | |
CIME_MODEL: "cesm" | |
CIME_DRIVER: "mct" | |
UPDATE_CIME: "true" | |
GIT_SHALLOW: "true" | |
CIME_TEST_PLATFORM: ubuntu-latest | |
run: | | |
export INSTALL_PATH="${PWD}" | |
export CIME_REPO=https://github.com/${{ github.event.pull_request.head.repo.full_name || github.repository }} | |
export CIME_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF##*/}} | |
mamba install -y python=${{ matrix.python-version }} | |
source /entrypoint.sh | |
git config --global --add safe.directory /__w/cime/cime | |
init_cime | |
pytest -vvv --machine docker --no-fortran-run CIME/tests/test_unit* | |
# Run system tests | |
system-testing: | |
runs-on: ubuntu-latest | |
needs: build-containers | |
if: ${{ always() && ! cancelled() }} | |
container: jasonb87/cime:latest | |
strategy: | |
matrix: | |
model: ["e3sm", "cesm"] | |
driver: ["mct", "nuopc"] | |
exclude: | |
# exclude nuopc driver when running e3sm tests | |
- model: "e3sm" | |
driver: "nuopc" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Cache inputdata | |
uses: actions/cache@v2 | |
with: | |
path: /storage/inputdata | |
key: inputdata-2 | |
- name: Run tests | |
shell: bash | |
env: | |
INIT: "false" | |
CIME_MODEL: ${{ matrix.model }} | |
CIME_DRIVER: ${{ matrix.driver }} | |
UPDATE_CIME: "true" | |
GIT_SHALLOW: "true" | |
CIME_TEST_PLATFORM: ubuntu-latest | |
run: | | |
export INSTALL_PATH="${PWD}/cime" | |
export CIME_REPO=https://github.com/${{ github.event.pull_request.head.repo.full_name || github.repository }} | |
export CIME_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF##*/}} | |
source /entrypoint.sh | |
git config --global --add safe.directory /__w/cime/cime | |
if [[ "${CIME_MODEL}" == "e3sm" ]] | |
then | |
init_e3sm | |
else | |
init_cime | |
fi | |
source /opt/conda/etc/profile.d/conda.sh | |
conda activate base | |
pytest -vvv --machine docker --no-fortran-run --no-teardown CIME/tests/test_sys* | |
- name: Create testing log archive | |
if: ${{ failure() }} | |
shell: bash | |
run: tar -czvf /testing-logs-${GITHUB_RUN_NUMBER}.tar.gz /storage/cases/ | |
# How to download artifacts: | |
# https://docs.github.com/en/actions/managing-workflow-runs/downloading-workflow-artifacts | |
- name: Upload testing logs | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: testing-logs-${{ github.run_number }} | |
path: /testing-logs-${{ github.run_number}}.tar.gz | |
retention-days: 4 |