Skip to content

Commit

Permalink
Update CI (#46)
Browse files Browse the repository at this point in the history
* add test-fortran github action

* install gfortran

based on https://github.com/fortran-lang/fpm/blob/master/.github/workflows/CI.yml

* fix workflow

* fix workflow (2)

* fix workflow (3)

* add windows to test matrix

* use ninja on windows build

* fix workflow (4)

* try nmake generator

* fix quotes?

* refactor workflow

* fix workflow (x)

* fix workflow (y)

* add mingw build

* do not install git and fypp

* add doc test build workflow

* add deploy doc github action

* add test python bindings workflow

* add python build on windows

* fix wrong compiler conda package name

* try fix python build on windows

* try fix python build on windows (2)

* windooows

* use cmd shell and use conda instead of mamba

mamba-org/mamba#897

* WTF

* use cmd shell (really)

* cmd multiline run doesn't work

https://github.community/t/windows-multi-line-step-run/16136/8

* ...

* back to bash

* back to cmmmmddd

* next try

* fix FC?

* WTF2

* remove travis ci

* update README badges
  • Loading branch information
benbovy authored Apr 23, 2021
1 parent b392e86 commit 508d4c3
Show file tree
Hide file tree
Showing 6 changed files with 212 additions and 66 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/deploy-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: deploy-doc

on:
push:
branches:
- 'master'

jobs:
adoc-build-deploy:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build docs
uses: avattathil/asciidoctor-action@v2
with:
program: "asciidoctor docs/index.adoc -o docs/index.html"
- name: Deploy docs to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./docs
20 changes: 20 additions & 0 deletions .github/workflows/test-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: test-doc

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

jobs:
adoc-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build docs
uses: avattathil/asciidoctor-action@v2
with:
program: "asciidoctor docs/index.adoc -o docs/index.html"
86 changes: 86 additions & 0 deletions .github/workflows/test-fortran.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: test-fortran

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

env:
HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker
HOMEBREW_NO_AUTO_UPDATE: "ON"
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
HOMEBREW_NO_GITHUB_API: "ON"
HOMEBREW_NO_INSTALL_CLEANUP: "ON"
BUILD_DIR: _build
CMAKE_OPTIONS: >-
-DBUILD_EXAMPLES=ON -DBUILD_FASTSCAPELIB_SHARED=ON -DCMAKE_BUILD_TYPE=Debug
jobs:
gcc-build:
name: gcc (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set Compiler (Linux)
if: contains(matrix.os, 'ubuntu')
run: |
echo "FC=gfortran" >> $GITHUB_ENV
echo "CC=gcc" >> $GITHUB_ENV
- name: Set Compiler (MacOS)
if: contains(matrix.os, 'macos')
run: |
echo "FC=gfortran-9" >> $GITHUB_ENV
echo "CC=gcc-9" >> $GITHUB_ENV
- name: Configure build
run: cmake -B ${BUILD_DIR} ${CMAKE_OPTIONS}

- name: Build project
run: cmake --build ${BUILD_DIR}

- name: Run Fan example
run: |
cd ${BUILD_DIR}/examples
./Fan
mingw-build:
name: mingw (windows-latest)
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2

- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: >-
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
- name: Configure build
run: cmake -B ${BUILD_DIR} -G Ninja ${CMAKE_OPTIONS}
env:
FC: gfortran
CC: gcc

- name: Build project
run: cmake --build ${BUILD_DIR}

- name: Run Fan example
run: |
cd ${BUILD_DIR}/examples
./Fan.exe
80 changes: 80 additions & 0 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: test-python

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

jobs:
unix:
name: 3.8 (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install numpy scikit-build ninja
- name: Set Compiler (Linux)
if: contains(matrix.os, 'ubuntu')
run: |
echo "FC=gfortran" >> $GITHUB_ENV
echo "CC=gcc" >> $GITHUB_ENV
- name: Set Compiler (MacOS)
if: contains(matrix.os, 'macos')
run: |
echo "FC=gfortran-9" >> $GITHUB_ENV
echo "CC=gcc-9" >> $GITHUB_ENV
- name: Build and install Python bindings
run: python -m pip install . -v --no-build-isolation --no-deps --ignore-installed --no-cache-dir

- name: Test import Python module
run: python -c "import sys; sys.path.pop(0); import fastscapelib_fortran"

windows:
name: 3.8 (windows-latest)
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.8
miniforge-version: latest

- name: Install dependencies
shell: cmd
run: |
conda create -n test python=3.8 cmake c-compiler fortran-compiler scikit-build pip wheel setuptools numpy
- name: Build and install project
shell: cmd
run: >-
conda activate test &&
ls %CONDA%\envs\test &&
ls %CONDA%\envs\test\Library\bin &&
set FC="C:/Miniconda3/envs/test/Library/bin/flang.exe" &&
python setup.py bdist_wheel --dist-dir="dist" -G "NMake Makefiles" -- -DCMAKE_Fortran_COMPILER:FILEPATH="%FC%" &&
python -m pip install --no-index --find-links="dist" fastscapelib_fortran -vvv
- name: Test import Python module
run: python -c "import sys; sys.path.pop(0); import fastscapelib_fortran"
65 changes: 0 additions & 65 deletions .travis.yml

This file was deleted.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Fastscapelib-fortran

[![Build Status](https://travis-ci.org/fastscape-lem/fastscapelib-fortran.svg?branch=master)](https://travis-ci.org/fastscape-lem/fastscapelib-fortran)
[![Build Status](https://github.com/fastscape-lem/fastscapelib-fortran/workflows/test-fortran/badge.svg)](https://github.com/fastscape-lem/fastscapelib-fortran/actions)
[![Build Status](https://github.com/fastscape-lem/fastscapelib-fortran/workflows/test-python/badge.svg)](https://github.com/fastscape-lem/fastscapelib-fortran/actions)
[![Build status](https://ci.appveyor.com/api/projects/status/c0wfit5kj1gpo1a7/branch/master?svg=true)](https://ci.appveyor.com/project/benbovy/fastscapelib-fortran/branch/master)
[![Build Doc](https://github.com/fastscape-lem/fastscapelib-fortran/workflows/deploy-doc/badge.svg)](https://github.com/fastscape-lem/fastscapelib-fortran/actions)
[![DOI](https://zenodo.org/badge/167184498.svg)](https://zenodo.org/badge/latestdoi/167184498)

A Fortran (+ Python bindings) library of efficient algorithms for
Expand Down

0 comments on commit 508d4c3

Please sign in to comment.