Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

separating build into docker and gcc #54

Merged
merged 5 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Docker

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
docker-build-and-test:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: Build and Test - ${{ matrix.dockerfile }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
dockerfile:
- Dockerfile
- Dockerfile.coverage
- Dockerfile.memcheck
- Dockerfile.mpi
- Dockerfile.mpi.memcheck
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Build Docker image
run: docker build -t tuvx -f docker/${{ matrix.dockerfile }} .

- name: Run tests in container
if: matrix.dockerfile != 'Dockerfile.coverage'
run: docker run --name test-container -t tuvx bash -c 'make test ARGS="--rerun-failed --output-on-failure"'

- name: Run coverage tests in container
if: matrix.dockerfile == 'Dockerfile.coverage'
run: docker run --name test-container -t tuvx bash -c 'make coverage ARGS="--rerun-failed --output-on-failure"'

- name: Copy coverage from container
if: matrix.dockerfile == 'Dockerfile.coverage'
run: docker cp test-container:build/coverage.info .

- name: Upload coverage report
if: matrix.dockerfile == 'Dockerfile.coverage'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.info
6 changes: 3 additions & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:

# create two copies of the documentaiton
# 1. the frozen version, represented as vX.X in the version switcher
docker build -t tuvx -f Dockerfile.docs .
docker build -t tuvx -f docker/Dockerfile.docs .
id=$(docker create tuvx)
docker cp $id:/build/docs/sphinx tmpdocs
docker rm -v $id
Expand All @@ -63,7 +63,7 @@ jobs:

# 2. stable, represented as vX.X (stable) in the version switcher
# edit conf.py to produce a version string that looks like vX.X (stable)
docker build -t tuvx -f Dockerfile.docs --build-arg SUFFIX=" (stable)" .
docker build -t tuvx -f docker/Dockerfile.docs --build-arg SUFFIX=" (stable)" .
id=$(docker create tuvx)
docker cp $id:/build/docs/sphinx tmpdocs
docker rm -v $id
Expand All @@ -84,7 +84,7 @@ jobs:
!contains(github.ref, env.DEFAULT_BRANCH)
run: |
set -x
docker build -t tuvx -f Dockerfile.docs .
docker build -t tuvx -f docker/Dockerfile.docs .
id=$(docker create tuvx)
docker cp $id:/build/docs/sphinx tmpdocs
docker rm -v $id
Expand Down
85 changes: 0 additions & 85 deletions .github/workflows/test.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Ubuntu

on: [ push, pull_request ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
gcc:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
matrix:
gcc_version: [11, 12, 13]
env:
FC: gfortran-${{ matrix.gcc_version }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libnetcdf-dev netcdf-bin libnetcdff-dev
- name: Install python dependencies
run: pip install numpy scipy
- name: Run Cmake
run: cmake -S . -B build
- name: Build
run: cmake --build build --parallel
- name: Run tests
run: |
cd build
ctest --rerun-failed --output-on-failure . --verbose
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ option(ENABLE_MPI "Enable MPI parallel support" OFF)
cmake_dependent_option(ENABLE_OPENMP "Enable OpenMP support" OFF "ENABLE_MPI" OFF)
option(ENABLE_TESTS "Build tests" ON)
option(ENABLE_COVERAGE "Enable code coverage output" OFF)
option(ENABLE_MEMCHECK "Enable memory checking in tests" ON)
option(ENABLE_MEMCHECK "Enable memory checking in tests" OFF)
option(ENABLE_NC_CONFIG "Use nc-config to determine NetCDF libraries" OFF)
option(BUILD_DOCS "Build the documentation" OFF)

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
Tropospheric ultraviolet-extended (TUV-x): A photolysis rate calculator

[![License](https://img.shields.io/github/license/NCAR/tuv-x.svg)](https://github.com/NCAR/tuv-x/blob/main/LICENSE)
[![CI Status](https://github.com/NCAR/tuv-x/actions/workflows/test.yml/badge.svg)](https://github.com/NCAR/tuv-x/actions/workflows/test.yml)
[![Ubuntu](https://github.com/NCAR/tuv-x/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/NCAR/tuv-x/actions/workflows/ubuntu.yml)
[![Docker](https://github.com/NCAR/tuv-x/actions/workflows/docker.yml/badge.svg)](https://github.com/NCAR/tuv-x/actions/workflows/docker.yml)
[![codecov](https://codecov.io/gh/NCAR/tuv-x/branch/main/graph/badge.svg?token=H46AAEAQF9)](https://codecov.io/gh/NCAR/tuv-x)
[![DOI](https://zenodo.org/badge/396946468.svg)](https://zenodo.org/badge/latestdoi/396946468)
[![](https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/NCAR/tuv-x)
Expand Down
1 change: 0 additions & 1 deletion Dockerfile → docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ COPY . /tuv-x/
RUN mkdir /build \
&& cd /build \
&& cmake -D CMAKE_BUILD_TYPE=release \
-D ENABLE_MEMCHECK=OFF \
/tuv-x \
&& make install -j 8

Expand Down
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions docker/Dockerfile.memcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM fedora:37

RUN dnf -y update \
&& dnf -y install \
gcc-fortran \
gcc-c++ \
gcc \
gdb \
git \
netcdf-fortran-devel \
cmake \
make \
lcov \
valgrind \
python3 \
python3-pip \
lapack-devel \
yaml-cpp-devel \
&& dnf clean all

RUN pip3 install numpy scipy

# build the tuv-x tool
COPY . /tuv-x/
RUN mkdir /build \
&& cd /build \
&& cmake /tuv-x \
&& make -j 8
K20shores marked this conversation as resolved.
Show resolved Hide resolved

WORKDIR /build
1 change: 0 additions & 1 deletion Dockerfile.mpi → docker/Dockerfile.mpi
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ RUN mkdir build \
-D CMAKE_CXX_COMPILER=/usr/lib64/openmpi/bin/mpicxx \
-D ENABLE_OPENMP:BOOL=TRUE \
-D ENABLE_MPI:BOOL=TRUE \
-D ENABLE_MEMCHECK:BOOL=FALSE \
../tuv-x \
&& make -j 8

Expand Down
File renamed without changes.
Loading