Skip to content

Commit a0f4708

Browse files
authored
add ruby CI - or try to (#50)
* add ruby CI - or try to * Updated config.yml * add semverse (ruby) * check conda image * fix conda image name * check archlinux * check conda installation of recent CDO version for testing * freudscher vertipper I guess * ☠ * debug why ruby-netcdf fails to load * use recent ruby version as default * build ruby-netcdf against system libnetcdf instead of conda * switch off python tests for now to save energy * forgot to use non-interactive installation (conda) * further check paths for binary stuff from rnetcdf * thatsIt * cleanup ruby ci * make number a bit verion/host indepentent * add tests for multiple versions of python and ruby
1 parent 61bcc5a commit a0f4708

File tree

2 files changed

+130
-2
lines changed

2 files changed

+130
-2
lines changed

.circleci/config.yml

Lines changed: 129 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22

33
jobs:
4-
build:
4+
python-3.9:
55
docker:
66
- image: cimg/python:3.9
77
steps:
@@ -41,3 +41,131 @@ jobs:
4141
cd cdo-bindings
4242
pip uninstall -y xarray netcdf4
4343
rake testPython3 CDO=$(type -p cdo) NO_COLOR=1
44+
python-3.11:
45+
docker:
46+
- image: cimg/python:3.11
47+
steps:
48+
- run:
49+
name: Install dependencies (debian)
50+
command: |
51+
sudo apt-get update
52+
sudo apt-get install gcc gfortran make binutils binutils-dev libc6-dev libbsd-dev
53+
sudo apt-get install libnetcdf-dev libhdf5-dev
54+
sudo apt-get install colorize
55+
sudo apt-get install cdo
56+
sudo apt-get install rake ruby-dev
57+
- run:
58+
name: Install dependencies (testing)
59+
command: |
60+
pip install xarray netcdf4 six numpy unittest2
61+
gem install parallel --version '<= 1.12' --user -N
62+
gem install minitest colorize facets --user -N
63+
- run:
64+
name: Checkout cdo-bindings
65+
command: |
66+
git clone -b ${CIRCLE_BRANCH} https://github.com/Try2Code/cdo-bindings.git
67+
- run:
68+
name: Run Tests Python 3.9
69+
command: |
70+
cdo -V
71+
type -p cdo
72+
python3 --version
73+
cd cdo-bindings
74+
rake testPython3 CDO=$(type -p cdo) NO_COLOR=1
75+
- run:
76+
name: Run Tests Python 3.9 - no netCDF4/Xarray
77+
command: |
78+
cdo -V
79+
type -p cdo
80+
python3 --version
81+
cd cdo-bindings
82+
pip uninstall -y xarray netcdf4
83+
rake testPython3 CDO=$(type -p cdo) NO_COLOR=1
84+
ruby-3.2:
85+
docker:
86+
- image: cimg/ruby:3.2
87+
steps:
88+
- run:
89+
name: Install dependencies (debian)
90+
command: |
91+
sudo apt-get update
92+
sudo apt-get install gcc gfortran make binutils binutils-dev libc6-dev libbsd-dev
93+
sudo apt-get install libnetcdf-dev libhdf5-dev
94+
sudo apt-get install colorize
95+
sudo apt-get install rake ruby-dev
96+
- run:
97+
name: Install cdo via conda and testing tools
98+
command: |
99+
gem install semverse --user -N
100+
gem install narray --user -N
101+
gem install narray_miss --user -N
102+
gem install ruby-netcdf --development --user -N
103+
gem install parallel --version '<= 1.12' --user -N
104+
gem install minitest colorize facets --user -N
105+
wget https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh
106+
bash Miniconda3-py310_23.1.0-1-Linux-x86_64.sh -b -p $HOME/miniconda3-3.10
107+
$HOME/miniconda3-3.10/bin/conda create -n new -y
108+
source $HOME/miniconda3-3.10/bin/activate new
109+
conda install -y mamba -c conda-forge
110+
mamba install -y cdo -c conda-forge
111+
- run:
112+
name: Checkout cdo-bindings
113+
command: |
114+
git clone -b ${CIRCLE_BRANCH} https://github.com/Try2Code/cdo-bindings.git
115+
- run:
116+
name: Run Tests Ruby 3
117+
command: |
118+
source $HOME/miniconda3-3.10/bin/activate new
119+
cdo -V
120+
type -p cdo
121+
ruby --version
122+
cd cdo-bindings
123+
rake testRuby CDO=$(type -p cdo) NO_COLOR=1
124+
ruby-3.0:
125+
docker:
126+
- image: cimg/ruby:3.0
127+
steps:
128+
- run:
129+
name: Install dependencies (debian)
130+
command: |
131+
sudo apt-get update
132+
sudo apt-get install gcc gfortran make binutils binutils-dev libc6-dev libbsd-dev
133+
sudo apt-get install libnetcdf-dev libhdf5-dev
134+
sudo apt-get install colorize
135+
sudo apt-get install rake ruby-dev
136+
- run:
137+
name: Install cdo via conda and testing tools
138+
command: |
139+
gem install semverse --user -N
140+
gem install narray --user -N
141+
gem install narray_miss --user -N
142+
gem install ruby-netcdf --development --user -N
143+
gem install parallel --version '<= 1.12' --user -N
144+
gem install minitest colorize facets --user -N
145+
wget https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh
146+
bash Miniconda3-py310_23.1.0-1-Linux-x86_64.sh -b -p $HOME/miniconda3-3.10
147+
$HOME/miniconda3-3.10/bin/conda create -n new -y
148+
source $HOME/miniconda3-3.10/bin/activate new
149+
conda install -y mamba -c conda-forge
150+
mamba install -y cdo -c conda-forge
151+
- run:
152+
name: Checkout cdo-bindings
153+
command: |
154+
git clone -b ${CIRCLE_BRANCH} https://github.com/Try2Code/cdo-bindings.git
155+
- run:
156+
name: Run Tests Ruby 3
157+
command: |
158+
source $HOME/miniconda3-3.10/bin/activate new
159+
cdo -V
160+
type -p cdo
161+
ruby --version
162+
cd cdo-bindings
163+
rake testRuby CDO=$(type -p cdo) NO_COLOR=1
164+
workflows:
165+
version: 2
166+
build_and_test:
167+
jobs:
168+
- ruby-3.2
169+
- ruby-3.0
170+
- python-3.9
171+
- python-3.11

ruby/test/test_cdo.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def test_returnArray
411411
temperature = @cdo.stdatm(0,:returnArray => 'T')
412412
assert_equal(288.0,temperature.flatten[0])
413413
pressure = @cdo.stdatm(0,1000,:options => '-b F64',:returnArray => 'P')
414-
assert_equal("1013.25 898.543456035875",pressure.flatten.to_a.join(' '))
414+
assert_equal("1013.25 898.54",pressure.flatten.to_a.map {|v| v.round(2)}.join(' '))
415415
else
416416
assert_raises LoadError do
417417
temperature = @cdo.stdatm(0,:returnCdf => true).var('T').get.flatten[0]

0 commit comments

Comments
 (0)