ci: enable testing on Windows with GCC #1656
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches-ignore: | |
- documentation | |
workflow_dispatch: | |
jobs: | |
CI: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
fpmodel: [DP, SP] | |
toolchain: | |
- {compiler: gcc, version: 10} | |
- {compiler: gcc, version: 11} | |
- {compiler: gcc, version: 12} | |
include: | |
- os: ubuntu-latest | |
shell: bash -leo pipefail {0} | |
make: make | |
- os: windows-latest | |
shell: "msys2 -leo pipefail {0}" | |
make: mingw32-make.exe | |
exclude: | |
- os: windows-latest | |
toolchain: | |
compiler: gcc | |
version: 12 | |
defaults: | |
run: | |
shell: ${{ matrix.shell }} | |
env: | |
# Core variables: | |
FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -g -DRTE_USE_CBOOL -DRTE_USE_${{ matrix.fpmodel }}" | |
# Make variables: | |
RRTMGP_ROOT: ${{ github.workspace }} | |
RRTMGP_DATA: ${{ github.workspace }}/rrtmgp-data | |
RUN_CMD: | |
FAILURE_THRESHOLD: 7.e-4 | |
steps: | |
# | |
# Setup MSYS2 on Windows | |
# | |
- if: runner.os == 'Windows' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW64 | |
path-type: inherit | |
install: >- | |
mingw-w64-x86_64-make | |
mingw-w64-x86_64-netcdf-fortran | |
# | |
# Setup Fortran compiler | |
# | |
- uses: fortran-lang/[email protected] | |
id: setup-fortran | |
with: | |
compiler: ${{ matrix.toolchain.compiler }} | |
version: ${{ matrix.toolchain.version }} | |
# | |
# Relax failure thresholds for single precision | |
# | |
- name: Relax failure threshold for single precision | |
if: matrix.fpmodel == 'SP' | |
run: echo "FAILURE_THRESHOLD=3.5e-1" >> $GITHUB_ENV | |
# | |
# Check out repository under $GITHUB_WORKSPACE | |
# | |
- name: Check out code | |
uses: actions/checkout@v4 | |
# | |
# Check out data | |
# | |
- name: Check out data | |
uses: actions/checkout@v4 | |
with: | |
repository: earth-system-radiation/rrtmgp-data | |
path: rrtmgp-data | |
ref: v1.8.1 | |
# | |
# Cache Conda packages | |
# | |
- name: Cache Conda packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-conda-${{ hashFiles('environment-ci.yml') }} | |
# | |
# Set up Conda | |
# | |
- name: Set up Conda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
activate-environment: rte_rrtmgp_ci | |
environment-file: environment-ci.yml | |
auto-activate-base: false | |
use-mamba: true | |
# Use the cache properly: | |
use-only-tar-bz2: true | |
# | |
# Install NetCDF-Fortran | |
# | |
- name: Install NetCDF-Fortran via Conda | |
if: runner.os == 'Linux' | |
run: conda install -y -c conda-forge netcdf-fortran | |
# | |
# Setup Linux environment variables | |
# | |
- name: Setup env variables - Linux | |
if: runner.os == 'Linux' | |
run: | | |
echo FCINCLUDE=-I ${CONDA_PREFIX}/include >> $GITHUB_ENV | |
echo LDFLAGS=-L ${CONDA_PREFIX}/lib >> $GITHUB_ENV | |
echo LD_LIBRARY_PATH=${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH} >> $GITHUB_ENV | |
# | |
# Setup Windows environment variables | |
# | |
- name: Setup env variables - Windows | |
if: runner.os == 'Windows' | |
run: | | |
echo FCINCLUDE="-I/mingw64/include" >> $GITHUB_ENV | |
echo LDFLAGS="-L/mingw64/lib" >> $GITHUB_ENV | |
echo LD_LIBRARY_PATH="/mingw64/lib:/mingw64/bin:${LD_LIBRARY_PATH}" >> $GITHUB_ENV | |
# | |
# Build libraries, examples and tests | |
# | |
- name: Build libraries | |
run: | | |
$FC --version | |
${{ matrix.make }} -j4 libs | |
# | |
# Run examples and tests | |
# | |
- name: Build and run examples and tests | |
run: | | |
${{ matrix.make }} -j4 tests | |
# | |
# Compare the results | |
# | |
- name: Compare the results | |
run: | | |
${{ matrix.make }} -j4 check |