Skip to content

Commit ffbf6c5

Browse files
authored
Merge pull request #4929 from ESMCI/fix-containers
- Migrates from conda to spack - Fix mixed perl environment (conda/system) - Moves to UV to manage python - Simplifies usage and testing workflow
2 parents 97dbf7a + d3fd506 commit ffbf6c5

11 files changed

Lines changed: 241 additions & 377 deletions

File tree

.github/workflows/testing.yml

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ jobs:
6262
- name: Build and push
6363
uses: docker/build-push-action@v6
6464
with:
65-
target: base
66-
context: docker/
65+
file: docker/Dockerfile
66+
context: .
6767
push: true
6868
tags: ${{ steps.meta.outputs.tags }}
6969
labels: ${{ steps.meta.outputs.labels }}
@@ -123,6 +123,8 @@ jobs:
123123
with:
124124
path: cesm/cime
125125
submodules: "true"
126+
- name: Install uv
127+
uses: astral-sh/setup-uv@v7
126128
- name: Run tests
127129
shell: bash
128130
working-directory: cesm/cime
@@ -132,18 +134,15 @@ jobs:
132134
CIME_TEST_PLATFORM: "ubuntu-latest"
133135
SKIP_ENTRYPOINT: "true"
134136
run: |
135-
source /opt/conda/etc/profile.d/conda.sh
136-
137-
conda activate cesm
138-
139-
mamba install -y 'python=${{ matrix.python-version }}'
140-
141-
pip install -r test-requirements.txt
137+
# manually run the entrypoint
138+
source /entrypoint.sh
142139
143-
# GitHub runner home is different than container
144-
cp -rf /home/cime/.cime /github/home/
140+
uv python install "${{ matrix.python-version }}"
141+
uv venv
142+
source .venv/bin/activate
143+
uv pip install -r test-requirements.txt
145144
146-
pytest -vvv --cov=CIME --cov-branch --cov-report=xml --machine docker CIME/tests/test_unit*
145+
uv run pytest -vvv --cov=CIME --cov-branch --cov-report=xml --machine docker CIME/tests/test_unit*
147146
- name: Upload coverage reports to Codecov
148147
uses: codecov/codecov-action@v4
149148
with:
@@ -214,6 +213,10 @@ jobs:
214213
with:
215214
path: /home/cime/inputdata
216215
key: inputdata-2
216+
- name: Install uv
217+
uses: astral-sh/setup-uv@v7
218+
with:
219+
python-version: "3.10"
217220
- name: Run tests
218221
shell: bash
219222
working-directory: ${{ matrix.model.name }}/cime
@@ -223,31 +226,18 @@ jobs:
223226
CIME_TEST_PLATFORM: ubuntu-latest
224227
SKIP_ENTRYPOINT: "true"
225228
run: |
226-
source /opt/conda/etc/profile.d/conda.sh
227-
228-
conda activate ${{ matrix.model.name }}
229-
230-
pip install -r test-requirements.txt
231-
229+
# manually run the entrypoint
232230
source /entrypoint.sh
233231
234-
if [[ "${{ matrix.model.name }}" == "e3sm" ]]; then
235-
fix_mct_makefiles ../externals/mct
236-
fi
237-
238-
# GitHub runner home is different than container
239-
cp -rf /home/cime/.cime /github/home/
240-
241-
if [[ "${CIME_MODEL}" == "e3sm" ]]; then
242-
ln -sf /github/home/.cime/config_machines.v2.xml /github/home/.cime/config_machines.xml
243-
else
244-
ln -sf /github/home/.cime/config_machines.v3.xml /github/home/.cime/config_machines.xml
245-
fi
232+
uv python install 3.10
233+
uv venv
234+
source .venv/bin/activate
235+
uv pip install -r test-requirements.txt
246236
247237
git config --global user.name "${{ github.actor }}"
248238
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
249239
250-
pytest -vvv --cov=CIME --cov-branch --cov-report=xml --machine docker --no-fortran-run --no-teardown CIME/tests/test_sys*
240+
uv run pytest -vvv --cov=CIME --cov-branch --cov-report=xml --machine docker --no-fortran-run --no-teardown CIME/tests/test_sys*
251241
- name: Upload coverage reports to Codecov
252242
uses: codecov/codecov-action@v4
253243
with:
@@ -259,7 +249,7 @@ jobs:
259249
- name: Create testing log archive
260250
if: ${{ failure() }}
261251
shell: bash
262-
run: tar -czvf /testing-logs-${GITHUB_RUN_NUMBER}-${{ matrix.model.name }}-${{ matrix.driver }}.tar.gz /home/cime/cases /home/cime/baselines /home/cime/archive
252+
run: tar -czvf /testing-logs-${GITHUB_RUN_NUMBER}-${{ matrix.model.name }}-${{ matrix.driver }}.tar.gz /root/storage/cases /root/storage/baselines /root/storage/archive
263253
# How to download artifacts:
264254
# https://docs.github.com/en/actions/managing-workflow-runs/downloading-workflow-artifacts
265255
- name: Upload testing logs

CONTRIBUTING.md

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ For more information on contributing to open source projects,
2020
is a great starting point. Also, checkout the [Zen of Scientific Software Maintenance](https://jrleeman.github.io/ScientificSoftwareMaintenance/)
2121
for some guiding principles on how to create high quality scientific software contributions.
2222

23+
The canonical, detailed contributing guide for this repository is included in the source tree at `doc/source/contributing-guide.rst`; please consult that file as the single source of truth for developer workflows, testing, and container usage.
24+
2325
## Getting Started
2426

2527
Interested in helping extend CIME? Have code from your research that you believe others will
26-
find useful? Have a few minutes to tackle an issue? In this guide we will get you setup and
27-
integrated into contributing to CIME!
28+
find useful? Have a few minutes to tackle an issue? This guide will get you set up to contribute
29+
to CIME.
2830

2931
## What Can I Do?
3032
* Tackle any unassigned [issues](https://github.com/ESMCI/CIME/issues) you wish!
@@ -44,7 +46,7 @@ The goal is to maintain a diverse community that's pleasant for everyone.
4446
include multiple bug fixes in a single pull request, but they should be related.
4547
For unrelated changes, please submit multiple pull requests.
4648
* Do not commit changes to files that are irrelevant to your feature or bugfix
47-
(eg: .gitignore).
49+
(e.g., .gitignore).
4850
* Be willing to accept constructive criticism as part of issuing a pull request,
4951
since the CIME developers are dedicated to ensuring that new features extend the
5052
system robustly and do not introduce new bugs.
@@ -53,7 +55,7 @@ The goal is to maintain a diverse community that's pleasant for everyone.
5355

5456
## Reporting a bug
5557
When creating a new issue, please be as specific as possible. Include the version
56-
of the code you were using, as well as what operating system you are running.
58+
of the code you were using, as well as what operating system you are running. Include the commit SHA or tag (e.g., output of `git rev-parse HEAD`) and the branch name.
5759
If possible, include complete, minimal example code that reproduces the problem.
5860

5961
## Pull Requests
@@ -62,34 +64,18 @@ We love pull requests from everyone. Fork, then clone the repo:
6264

6365
git clone git@github.com:your-username/CIME.git
6466

65-
Additionally you may need to checkout the submodules with:
67+
You will need to initialize and update submodules:
6668

6769
cd CIME
68-
git submodule update --init
69-
70-
You will need to install CIME dependencies and edit config files
71-
to tell CIME about your development machine. See the [CIME users guide](https://esmci.github.io/cime/users_guide/porting-cime.html)
72-
73-
Run the scripts_regression_tests:
74-
75-
cd CIME/tests
76-
python scripts_regression_tests.py
77-
78-
Alternatively with `pytest`:
79-
80-
pytest CIME/tests
81-
82-
Make your change. Add tests for your change. Make the tests pass to the same level as before your changes.
70+
git submodule update --init --recursive
8371

84-
cd CIME/tests
85-
python scripts_regression_tests.py
72+
From here you can edit the code and run the unit tests following this [guide](https://esmci.github.io/cime/versions/master/html/contributing-guide.html#pytest).
8673

87-
Run [pre-commit](https://pre-commit.com/#usage) before committing changes and submitting a PR.
74+
When running the ``unit`` tests you can specify any valid machine e.g. docker and the tests will run.
8875

89-
pip install pre-commit
90-
pre-commit run -a
76+
If you need to run the ``system`` tests you will need to have your respective model checked out and on a supported machine. Alternatively you can use CIME [container](https://esmci.github.io/cime/versions/master/html/contributing-guide.html#docker-container) which is used in our GitHub CI testing.
9177

92-
Commit the changes you made. Chris Beams has written a [guide](https://chris.beams.io/posts/git-commit/) on how to write good commit messages.
78+
Before creating your PR you will need to run the code quality checkers; see this [guide](https://esmci.github.io/cime/versions/master/html/contributing-guide.html#code-quality).
9379

9480
Push to your fork and [submit a pull request][pr].
9581

@@ -102,8 +88,9 @@ We may suggest some changes or improvements or alternatives.
10288
Some things that will increase the chance that your pull request is accepted:
10389

10490
* Write tests.
105-
* Follow [PEP8][pep8] for style. (The `flake8` utility can help with this.)
106-
* Write a [good commit message][commit].
91+
* Write documentation.
92+
* Follow the [Code Quality guide](https://esmci.github.io/cime/versions/master/html/contributing-guide.html#code-quality)
93+
* Write a good commit message, we recommend using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
10794

10895
Pull requests will automatically have tests run by a Github Action. This
10996
includes running both the unit tests as well as `pre-commit`, which checks

0 commit comments

Comments
 (0)