Skip to content

Commit

Permalink
Merge pull request #1 from jacobwilliams/develop
Browse files Browse the repository at this point in the history
added FPM support
  • Loading branch information
jacobwilliams authored Apr 16, 2022
2 parents 73402e4 + 9cce1e6 commit 39cec21
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 184 deletions.
44 changes: 30 additions & 14 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
gcc_v: [9] # Version of GFortran we want to use.
python-version: [3.7]
gcc_v: [10] # Version of GFortran we want to use.
python-version: [3.9]
env:
FC: gfortran-${{ matrix.gcc_v }}
GCC_V: ${{ matrix.gcc_v }}
Expand All @@ -20,38 +20,54 @@ jobs:
with:
submodules: recursive

- name: Install Python
- name: Set up Python 3.x
uses: actions/setup-python@v1 # Use pip to install latest CMake, & FORD/Jin2For, etc.
with:
python-version: ${{ matrix.python-version }}

- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1

- name: Setup Fortran Package Manager
uses: fortran-lang/setup-fpm@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Python dependencies
if: contains( matrix.os, 'ubuntu')
run: |
python -m pip install --upgrade pip
pip install ford FoBiS.py
pip install matplotlib ford
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install GFortran Linux
if: contains( matrix.os, 'ubuntu')
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-${GCC_V} gfortran-${GCC_V}
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
--slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V}
sudo apt-get install lcov
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc_v }} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.gcc_v }} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.gcc_v }}
- name: Compile
run: |
FoBiS.py build -f astro-fortran.fobis -mode tests-gnu
# - name: Compile
# run: fpm build --profile release

- name: Run tests
run: fpm test --profile debug --flag -coverage

- name: Create coverage report
run: |
./bin/t_sofa_f
mkdir -p ${{ env.COV_DIR }}
lcov --capture --initial --base-directory . --directory build/gfortran_*/ --output-file ${{ env.COV_DIR }}/coverage.base
lcov --capture --base-directory . --directory build/gfortran_*/ --output-file ${{ env.COV_DIR }}/coverage.capture
lcov --add-tracefile ${{ env.COV_DIR }}/coverage.base --add-tracefile ${{ env.COV_DIR }}/coverage.capture --output-file ${{ env.COV_DIR }}/coverage.info
env:
COV_DIR: build/coverage

- name: Upload coverage report
uses: codecov/codecov-action@v2
with:
files: build/coverage/coverage.info

- name: Build documentation
run: ford ./astro-fortran.md
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ASTRO-FORTRAN: Modern Fortran implementations of standard models used in fundamental astronomy
https://github.com/jacobwilliams/astro-fortran

Copyright (c) 2019-2021, Jacob Williams
Copyright (c) 2019-2022, Jacob Williams
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
35 changes: 22 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,35 @@ This is based on the 2019-07-22 Fortran 77 SOFA Release.

### Status

![CI Status](https://github.com/jacobwilliams/astro-fortran/actions/workflows/CI.yml/badge.svg)
[![GitHub release](https://img.shields.io/github/release/jacobwilliams/astro-fortran.svg)](https://github.com/jacobwilliams/astro-fortran/releases/latest)
[![Build Status](https://github.com/jacobwilliams/astro-fortran/actions/workflows/CI.yml/badge.svg)](https://github.com/jacobwilliams/astro-fortran/actions)
[![codecov](https://codecov.io/gh/jacobwilliams/astro-fortran/branch/master/graph/badge.svg?token=43HK33CSMY)](https://codecov.io/gh/jacobwilliams/astro-fortran)
[![last-commit](https://img.shields.io/github/last-commit/jacobwilliams/astro-fortran)](https://github.com/jacobwilliams/astro-fortran/commits/master)

## Building
### Compiling

A [FoBiS](https://github.com/szaghi/FoBiS) configuration file (`astro-fortran.fobis`) is also provided that can also build the library and examples. Use the `mode` flag to indicate what to build. For example:
A [Fortran Package Manager](https://github.com/fortran-lang/fpm) manifest file is included, so that the library and tests cases can be compiled with FPM. For example:

* To build all the examples using gfortran: `FoBiS.py build -f astro-fortran.fobis -mode tests-gnu`
* To build all the examples using ifort: `FoBiS.py build -f astro-fortran.fobis -mode tests-intel`
* To build a static library using gfortran: `FoBiS.py build -f astro-fortran.fobis -mode static-gnu`
* To build a static library using ifort: `FoBiS.py build -f astro-fortran.fobis -mode static-intel`
```
fpm build --profile release
fpm test --profile release
```

The full set of modes are: `static-gnu`, `static-gnu-debug`, `static-intel`, `static-intel-debug`, `shared-gnu`, `shared-gnu-debug`, `shared-intel`, `shared-intel-debug`, `tests-gnu`, `tests-gnu-debug`, `tests-intel`, `tests-intel-debug`
To use `astro-fortran` within your FPM project, add the following to your `fpm.toml` file:
```toml
[dependencies]
astro-fortran = { git="https://github.com/jacobwilliams/astro-fortran.git" }
```

To generate the documentation using [ford](https://github.com/Fortran-FOSS-Programmers/ford), run: ```FoBis.py rule --execute makedoc -f astro-fortran.fobis```
To generate the documentation using [FORD](https://github.com/Fortran-FOSS-Programmers/ford), run:

To run the test programs, run: ```FoBis.py rule --execute tests -f astro-fortran.fobis```
```
ford astro-fortran.md
```

## Documentation
### Documentation

The latest API documentation can be found [here](http://jacobwilliams.github.io/astro-fortran/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford).
The latest API documentation can be found [here](https://jacobwilliams.github.io/astro-fortran/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford).

### License

Expand All @@ -37,4 +46,4 @@ The astro-fortran source code and related files and documentation are distribute
* [SPICE](http://naif.jpl.nasa.gov/naif/toolkit.html)
* [NOVAS](http://aa.usno.navy.mil/software/novas/novas_info.php)
* [SOFA](http://www.iausofa.org)
* [Fortran Astrodynamics Toolkit](https://github.com/jacobwilliams/Fortran-Astrodynamics-Toolkit)
* [Fortran Astrodynamics Toolkit](https://github.com/jacobwilliams/Fortran-Astrodynamics-Toolkit)
156 changes: 0 additions & 156 deletions astro-fortran.fobis

This file was deleted.

13 changes: 13 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
comment:
layout: header, changes, diff, sunburst
coverage:
ignore:
- test
- doc
status:
patch:
default:
target: 70%
project:
default:
target: 60%
18 changes: 18 additions & 0 deletions fpm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name = "astro-fortran"
author = "Jacob Williams"
copyright = "Copyright (c) 2019-2022, Jacob Williams. Copyright (C) 2019 Standards Of Fundamental Astronomy Board of the International Astronomical Union."
license = "BSD-3"
description = "A refactoring of the IAU SOFA library to modern Fortran standards"
homepage = "https://github.com/jacobwilliams/astro-fortran"
keywords = ["astrometry"]

[build]
auto-executables = false
auto-examples = false
auto-tests = true

[library]
source-dir = "src"

[install]
library = true
File renamed without changes.

0 comments on commit 39cec21

Please sign in to comment.