Skip to content

Commit

Permalink
Merge pull request atmtools#209 from lkluft/update-build
Browse files Browse the repository at this point in the history
Update build workflow
  • Loading branch information
lkluft authored Nov 23, 2022
2 parents 31e8861 + e3d2083 commit fb65fc9
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 31 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/build-book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8]
python-version: ["3.9"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies with pip
Expand All @@ -26,19 +26,20 @@ jobs:
conda info
jupyter-book build -W -n --keep-going howto
- name: Archive build artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: always()
with:
name: build
path: |
howto/_build
path: howto/_build
retention-days: 1

publish:
needs: build
if: "github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'atmtools'"
runs-on: ubuntu-latest
steps:
- name: Download compiled book
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: build
path: _build
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,38 @@ jobs:
fail-fast: false
matrix:
name: [ubuntu, macos]
python-version: [3.7, 3.8, 3.9]
python-version: ["3.8", "3.9", "3.10"]

include:
- name: ubuntu
os: ubuntu-18.04
os: ubuntu-22.04

- name: macos
os: macos-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install GCC (MacOS)
if: matrix.name == 'macos'
run: |
brew install gcc@10
echo "CC=gcc-10" >> $GITHUB_ENV
echo "FC=gfortran-10" >> $GITHUB_ENV
brew install gcc@12
echo "CC=gcc-12" >> $GITHUB_ENV
echo "FC=gfortran-12" >> $GITHUB_ENV
- name: Install
run: |
python -m pip install --upgrade pip
# We need to install a suitable NumPy version prior to CliMT
# because their internal dependency handling is broken.
python -m pip install wheel "numpy>=1.20.0,<1.22.0"
python -m pip install --upgrade pip wheel
TARGET=HASWELL python -m pip install -v .[docs,tests]
python -m pip list
- name: Lint with flake8
if: matrix.name == 'ubuntu' && matrix.python-version == '3.7'
if: matrix.name == 'ubuntu' && matrix.python-version == '3.9'
continue-on-error: true
run: |
python -m pip install flake8
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on:

jobs:
deploy:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ CC=gcc FC=gfortran TARGET=HASWELL python -m pip install konrad
On macOS, you may need to install the GCC compiler suite beforehand:
```bash
# Install GCC 11 and set it as C and Fortran compiler.
brew install gcc@11
CC=gcc-11 FC=gfortran-11
brew install gcc@12
CC=gcc-12 FC=gfortran-12

# Set the target architecture (different for Apple M1 [arm64]).
[[ $(uname -p) == arm64 ]] && TARGET=ARMV8 || TARGET=HASWELL
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dependencies:
- python>=3.6
- matplotlib>=2.0.0
- netcdf4>=1.2.7
- numpy>=1.20.0,<1.22.0
- numpy>1.22.0
- scipy>=0.19.0
- typhon>=0.7.0
- xarray>=0.9.1
Expand Down
11 changes: 9 additions & 2 deletions konrad/test/test_rce.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ def test_init(self, atmosphere_obj):
RCE(atmosphere_obj)

def test_run(self, atmosphere_obj):
"""Integrate an RCE simulation for four time steps.."""
rce = RCE(atmosphere_obj, timestep="12h", max_duration="48h")
"""Run a full RCE simulation and check some outputs."""
rce = RCE(atmosphere_obj, timestep="12h", max_duration="200d")
rce.run()

# Check some basic atmospheric and radiative properties.
assert 255.5 < rce.radiation["lw_flxu"][-1, -1] < 256.5
assert rce.atmosphere["T"][-1].min() > 150.0
assert rce.atmosphere["T"][-1].max() < 288.0
assert np.all(rce.atmosphere["H2O"] > 0.0)
assert np.all(rce.atmosphere["H2O"] < 0.015)
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
python_requires='>=3.6',
python_requires='>=3.8',
include_package_data=True,
install_requires=[
'matplotlib>=2.0.0',
'netcdf4>=1.2.7',
'numpy>=1.20.0,<1.22.0',
'numpy>1.22.0',
'scipy>=0.19.0',
'typhon>=0.7.0',
'xarray>=0.9.1',
Expand Down

0 comments on commit fb65fc9

Please sign in to comment.