Skip to content

Commit

Permalink
CI: Cleanup and enable Fortran tests (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
havogt authored Feb 8, 2023
1 parent a3d536f commit 263183b
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 48 deletions.
55 changes: 7 additions & 48 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,21 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Set defaults
run: |
export GCC_VERSION=$(echo ${{ matrix.compiler }} | cut -d'-' -f2)
echo "FC=gfortran-${GCC_VERSION}" >> $GITHUB_ENV
echo "TEST_FORTRAN=OFF" >> $GITHUB_ENV # default will be overwritten in the next step
- name: Enable Fortran
if: startsWith(matrix.compiler, 'clang') == 'false'
if: startsWith(matrix.compiler, 'gcc')
run: echo "TEST_FORTRAN=ON" >> $GITHUB_ENV
- name: Install python modules
run: pip3 install --user nose-py3 numpy
- name: Cache pFUnit
id: cache-pfunit
uses: actions/cache@v1
uses: actions/cache@v3.2.4
with:
path: pfunit
key: ${{ matrix.compiler }}-pfunit
- name: Install pFUnit
if: startsWith(matrix.compiler, 'gcc') && steps.cache-pfunit.outputs.cache-hit != 'true'
env:
PFUNIT_VERSION: 4.4.1
PFUNIT_VERSION: 4.6.3
run: |
apt-get update && apt-get -y install m4
git clone --branch v${PFUNIT_VERSION} --depth 1 https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
Expand All @@ -59,8 +54,8 @@ jobs:
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
string(TIMESTAMP current_date "%Y-%m-%d-%H-%M-%S" UTC)
message("echo \"timestamp=${current_date}\" >> $GITHUB_OUTPUT")
- name: Set ccache environment
run: |
echo "CCACHE_MAXSIZE=400M" >> $GITHUB_ENV
Expand All @@ -69,10 +64,10 @@ jobs:
echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV
echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV
- name: ccache cache files
uses: actions/cache@v1
uses: actions/cache@v3.2.4
with:
path: .ccache
key: ${{ matrix.compiler }}-${{ matrix.build_type }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
key: ${{ matrix.compiler }}-${{ matrix.build_type }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ matrix.compiler }}-${{ matrix.build_type }}-ccache-
- name: Configure
Expand All @@ -93,39 +88,3 @@ jobs:
run: cmake --build build --parallel 2
- name: Execute tests
run: cd build && ctest --output-on-failure

build-python:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: install boost on macos
if: ${{ matrix.os == 'macos-latest'}}
run: |
brew install boost
- name: install boost for ubuntu
if: ${{ matrix.os == 'ubuntu-latest'}}
run: |
sudo apt-get update
sudo apt-get install libboost-all-dev
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: upgrade python tools
run: python -m pip install --upgrade pip setuptools wheel

- name: install dependencies
run: pip install -r src/serialbox-python/requirements.txt

- name: build
run: pip install src/serialbox-python

- name: run tests
run: pytest -v test/serialbox-python/serialbox >> $GITHUB_STEP_SUMMARY
46 changes: 46 additions & 0 deletions .github/workflows/pip_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: pip package

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build-python:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: install boost on macos
if: ${{ matrix.os == 'macos-latest'}}
run: |
brew install boost
- name: install boost for ubuntu
if: ${{ matrix.os == 'ubuntu-latest'}}
run: |
sudo apt-get update
sudo apt-get install libboost-all-dev
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: upgrade python tools
run: python -m pip install --upgrade pip setuptools wheel

- name: install dependencies
run: pip install -r src/serialbox-python/requirements.txt

- name: build
run: pip install src/serialbox-python

- name: run tests
run: pytest -v test/serialbox-python/serialbox >> $GITHUB_STEP_SUMMARY

0 comments on commit 263183b

Please sign in to comment.