Skip to content

Commit 8a96101

Browse files
authored
Merge pull request #170 from NCAR/github_actions
Added Github Actions workflow for CI tests
2 parents b196383 + 0043f75 commit 8a96101

File tree

10 files changed

+16549
-71
lines changed

10 files changed

+16549
-71
lines changed

.build/Site.local.template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
${CAIROLIB}
2222
${CAIROLIBUSER}
2323

24+
#undef CCompiler
25+
#undef FCompiler
26+
#undef CxxCompiler
27+
#undef CppCommand
28+
#undef LdCommand
29+
2430
#define CCompiler "${CC}"
2531
#define FCompiler "${FC}"
2632
#define CxxCompiler "${CXX}"

.build/conda_build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ export RECIPE_DIR="${SRC_DIR}/$(basename "${RECIPE_DIR}")"
77

88
cd ${SRC_DIR}
99

10-
conda env create -f "${RECIPE_DIR}/envs/`uname`.yml" 2>/dev/null
10+
#conda env create -f "${RECIPE_DIR}/envs/`uname`.yml" 2>/dev/null
11+
. "$(conda info --base)/etc/profile.d/conda.sh"
12+
#eval "$(micromamba shell hook --shell=bash)"
13+
#micromamba shell init --shell=bash --prefix=~/micromamba
1114
source activate ncl_build 2>/dev/null || conda activate ncl_build
1215

16+
conda list
1317

1418
export PREFIX="${CONDA_PREFIX}"
1519
export CXXFLAGS="-fPIC $CXXFLAGS"
@@ -75,3 +79,5 @@ mkdir -p "$DEACTIVATE_DIR"
7579

7680
cp "$RECIPE_DIR/scripts/activate.sh" "$ACTIVATE_DIR/ncl-activate.sh"
7781
cp "$RECIPE_DIR/scripts/deactivate.sh" "$DEACTIVATE_DIR/ncl-deactivate.sh"
82+
83+
conda list

.build/envs/Darwin.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ channels:
33
- conda-forge
44
dependencies:
55
- clang_osx-64
6-
- clangcxx_osx-64
6+
- clangxx_osx-64
7+
- esmf
78
- gfortran_osx-64
89
- pkg-config
910
- blas=1.1=openblas
@@ -14,6 +15,7 @@ dependencies:
1415
- hdf5
1516
- hdfeos2
1617
- hdfeos5
18+
- imagemagick
1719
- jasper
1820
- jpeg
1921
- libgdal

.build/envs/Linux.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ dependencies:
1010
- bzip2
1111
- cairo
1212
- curl
13+
- esmf
1314
- freetype
1415
- gsl
1516
- hdf4
1617
- hdf5
1718
- hdfeos2
1819
- hdfeos5
20+
- imagemagick
1921
- jasper
2022
- jpeg
2123
- libgdal

.build/mamba_build.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/sh
2+
unsetopt EQUALS 2>/dev/null
3+
4+
RECIPE_DIR="$(dirname "$0")"
5+
export SRC_DIR="$(cd `dirname ${RECIPE_DIR}`; pwd)"
6+
export RECIPE_DIR="${SRC_DIR}/$(basename "${RECIPE_DIR}")"
7+
8+
cd ${SRC_DIR}
9+
10+
#. "$(conda info --base)/etc/profile.d/conda.sh"
11+
eval "$(micromamba shell hook --shell=bash)"
12+
micromamba shell init --shell=bash --prefix=~/micromamba
13+
source activate ncl_build 2>/dev/null || micromamba activate ncl_build
14+
15+
export PREFIX="${CONDA_PREFIX}"
16+
export CXXFLAGS="-fPIC $CXXFLAGS"
17+
export LDFLAGS="-L${PREFIX}/lib $LDFLAGS"
18+
export CPPFLAGS="-I${PREFIX}/include $CPPFLAGS"
19+
export CFLAGS="-I${PREFIX}/include $CFLAGS"
20+
21+
if [ "$(uname)" = "Darwin" ]; then
22+
export CC="${CLANG}"
23+
export CPP="${CLANG} -E -traditional"
24+
export CXX="${CLANG}++"
25+
export FC
26+
27+
if [ -d "/opt/X11" ]; then
28+
x11_lib="-L/opt/X11/lib"
29+
x11_inc="-I/opt/X11/include -I/opt/X11/include/freetype2"
30+
31+
CAIROLIB="#define CAIROlib /opt/X11/lib/libcairo.2.dylib /opt/X11/lib/libfontconfig.1.dylib /opt/X11/lib/libpixman-1.0.dylib /opt/X11/lib/libfreetype.6.dylib -lXrender -lexpat -lpng -lz -liconv -lbz2 -lpthread"
32+
CAIROLIBUSER="#define CAIROlibuser /opt/X11/lib/libcairo.2.dylib /opt/X11/lib/libfontconfig.1.dylib /opt/X11/lib/libpixman-1.0.dylib /opt/X11/lib/libfreetype.6.dylib -lXrender -lexpat -lpng -lz -liconv -lbz2 -lpthread"
33+
else
34+
echo "No X11 libs found. Exiting..." 1>&2
35+
exit
36+
fi
37+
38+
LDFLAGS="-headerpad_max_install_names $LDFLAGS"
39+
conf_file=config/Darwin_Intel
40+
elif [ "$(uname)" = "Linux" ]; then
41+
export CC="$GCC"
42+
export CPP="${CPP} -traditional"
43+
export CXX="$GXX"
44+
export FC
45+
46+
conf_file=config/LINUX
47+
fi
48+
49+
export EXTRA_LDFLAGS="$LDFLAGS"
50+
51+
export grib2_dir=${SRC_DIR}/external/g2clib-1.6.0
52+
export EXTRA_INCLUDES=-I${grib2_dir}
53+
54+
# fix malformed sed subsitutions
55+
sed -e 's/+/|/g' -i.backup ni/src/scripts/yMakefile
56+
sed -e 's/+/|/g' -i.backup ni/src/ncl/yMakefile
57+
58+
59+
# fix path to cpp in ymake -- we should fix this in NCL
60+
sed -e "s|^\( set cpp = \)/lib/cpp$|\1'$CPP'|g" -i.backup config/ymake
61+
62+
63+
# generate Site.local
64+
sed -e "s|\${PREFIX}|${PREFIX}|g" -e "s|\${x11_inc}|${x11_inc}|g" -e "s|\${x11_lib}|${x11_lib}|g" -e "s|\${CAIROLIB}|${CAIROLIB}|g" -e "s|\${CAIROLIBUSER}|${CAIROLIBUSER}|g" -e "s|\${grib2_dir}|${grib2_dir}|g" -e "s|\${CC}|${CC}|g" -e "s|\${FC}|${FC}|g" -e "s|\${CPP}|${CPP}|g" -e "s|\${CXX}|${CXX}|g" -e "s|\${LD}|${LD}|g" "${RECIPE_DIR}/Site.local.template" > config/Site.local
65+
66+
patch -N -p1 < ${RECIPE_DIR}/grib2.patch >/dev/null 2>&1
67+
68+
echo -e "n\n" | ./Configure
69+
make Everything
70+
71+
ACTIVATE_DIR="$PREFIX/etc/conda/activate.d"
72+
DEACTIVATE_DIR="$PREFIX/etc/conda/deactivate.d"
73+
74+
mkdir -p "$ACTIVATE_DIR"
75+
mkdir -p "$DEACTIVATE_DIR"
76+
77+
cp "$RECIPE_DIR/scripts/activate.sh" "$ACTIVATE_DIR/ncl-activate.sh"
78+
cp "$RECIPE_DIR/scripts/deactivate.sh" "$DEACTIVATE_DIR/ncl-deactivate.sh"
79+
80+
conda list

.circleci/config.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: CI (conda)
2+
on:
3+
push:
4+
branches:
5+
- 'develop'
6+
- 'master'
7+
pull_request:
8+
workflow_dispatch:
9+
schedule:
10+
- cron: '0 0 * * *' # Daily “At 00:00”
11+
12+
jobs:
13+
test:
14+
name: (${{ matrix.os }})
15+
runs-on: ${{ matrix.os }}
16+
defaults:
17+
run:
18+
shell: bash -l {0}
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [ "ubuntu-latest", "macos-latest"]
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
28+
- name: Cancel previous runs
29+
uses: styfle/[email protected]
30+
with:
31+
access_token: ${{ github.token }}
32+
33+
- name: Install tcsh and byacc (Linux)
34+
if: matrix.os == 'ubuntu-latest'
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install tcsh
38+
sudo apt-get install byacc
39+
40+
- name: Install dependencies (Darwin)
41+
if: matrix.os == 'macos-latest'
42+
run: |
43+
brew update
44+
brew install --cask xquartz
45+
46+
- name: Conda setup
47+
uses: conda-incubator/setup-miniconda@v2
48+
with:
49+
activate-environment: ncl_build
50+
python-version: 3.7
51+
channels: conda-forge
52+
53+
- name: Conda install (Darwin)
54+
if: matrix.os == 'macos-latest'
55+
run: |
56+
conda env update --file .build/envs/Darwin.yml --prune
57+
58+
- name: Conda install (Linux)
59+
if: matrix.os == 'ubuntu-latest'
60+
run: |
61+
conda env update --file .build/envs/Linux.yml --prune
62+
63+
- name: Conda install additional dependencies
64+
run: |
65+
conda install -n ncl_build -c conda-forge imagemagick esmf
66+
67+
- name: Conda install libgdal=2.4
68+
run: |
69+
conda install -n ncl_build -c conda-forge libgdal=2.4
70+
71+
- name: Build ncl
72+
run: |
73+
bash .build/conda_build.sh
74+
75+
- name: Run tests
76+
run: |
77+
test "`ncl -V`" = "`cat version`"
78+
git clone https://github.com/NCAR/ncl_ci_test
79+
cd ncl_ci_test
80+
source run_tests.bash

.github/workflows/ci_mamba.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: CI (mamba)
2+
on:
3+
push:
4+
branches:
5+
- 'develop'
6+
- 'master'
7+
pull_request:
8+
workflow_dispatch:
9+
schedule:
10+
- cron: '0 0 * * *' # Daily “At 00:00”
11+
12+
jobs:
13+
test:
14+
name: (${{ matrix.os }})
15+
runs-on: ${{ matrix.os }}
16+
defaults:
17+
run:
18+
shell: bash -l {0}
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [ "ubuntu-latest", "macos-latest"]
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
28+
- name: Cancel previous runs
29+
uses: styfle/[email protected]
30+
with:
31+
access_token: ${{ github.token }}
32+
33+
- name: Install tcsh and byacc (Linux)
34+
if: matrix.os == 'ubuntu-latest'
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install tcsh
38+
sudo apt-get install byacc
39+
40+
- name: Install dependencies (Darwin)
41+
if: matrix.os == 'macos-latest'
42+
run: |
43+
brew update
44+
brew install --cask xquartz
45+
46+
- name: Create mamba environment (Darwin)
47+
if: matrix.os == 'macos-latest'
48+
env:
49+
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
50+
uses: mamba-org/provision-with-micromamba@main
51+
with:
52+
micromamba-version: "latest"
53+
environment-name: ncl_build
54+
environment-file: .build/envs/Darwin.yml
55+
56+
- name: Create mamba environment (Linux)
57+
if: matrix.os == 'ubuntu-latest'
58+
env:
59+
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
60+
uses: mamba-org/provision-with-micromamba@main
61+
with:
62+
micromamba-version: "latest"
63+
environment-name: ncl_build
64+
environment-file: .build/envs/Linux.yml
65+
66+
- name: Build ncl
67+
run: |
68+
bash .build/mamba_build.sh
69+
70+
- name: Run tests
71+
run: |
72+
ncl -V
73+
test "`ncl -V`" = "`cat version`"
74+
git clone https://github.com/NCAR/ncl_ci_test
75+
cd ncl_ci_test
76+
bash run_tests.bash

0 commit comments

Comments
 (0)