Skip to content

Commit

Permalink
Re-organise ci tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rjfarmer committed Jan 24, 2024
1 parent 039a84b commit ee85f82
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 67 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml → .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: CI
name: Linux CI
on: [push, pull_request]

jobs:
CI:
linux_ci:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-latest, windows-latest]
os: [ubuntu-20.04, ubuntu-22.04]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
toolchain:
- {compiler: gcc, version: 8}
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: macOS CI
on: [push, pull_request]

jobs:
macos_ci:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
toolchain:
- {compiler: gcc, version: 8}
- {compiler: gcc, version: 9}
- {compiler: gcc, version: 10}
- {compiler: gcc, version: 11}
- {compiler: gcc, version: 12}
- {compiler: gcc, version: 13}


steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build wheel pytest
- uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

- name: Build
run: python -m pip install .


- name: Test
run: python -m pytest -v

45 changes: 45 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: windows CI
on: [push, pull_request]

jobs:
windows_ci:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
toolchain:
- {compiler: gcc, version: 8}
- {compiler: gcc, version: 9}
- {compiler: gcc, version: 10}
- {compiler: gcc, version: 11}
- {compiler: gcc, version: 12}
- {compiler: gcc, version: 13}

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build wheel pytest
- uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

- name: Build
run: python -m pip install .


- name: Test
run: python -m pytest -v

66 changes: 2 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Continuous Integration](https://github.com/rjfarmer/gfort2py/actions/workflows/ci.yml/badge.svg)](https://github.com/rjfarmer/gfort2py/actions/workflows/ci.yml)
[![Continuous Integration](https://github.com/rjfarmer/gfort2py/actions/workflows/linux.yml/badge.svg)](https://github.com/rjfarmer/gfort2py/actions/workflows/linux.yml)
[![Coverage Status](https://coveralls.io/repos/github/rjfarmer/gfort2py/badge.svg?branch=main)](https://coveralls.io/github/rjfarmer/gfort2py?branch=main)
[![PyPI version](https://badge.fury.io/py/gfort2py.svg)](https://badge.fury.io/py/gfort2py)
[![DOI](https://zenodo.org/badge/72889348.svg)](https://zenodo.org/badge/latestdoi/72889348)
Expand Down Expand Up @@ -278,13 +278,7 @@ y = x.another_function(f.callback)
## Testing

````bash
pytest
````

or

````bash
tox
pytest -v
````

To run unit tests
Expand Down Expand Up @@ -365,62 +359,6 @@ x.b
x.c
````

<!-- ### Procedure pointers:
#### Procedures as arguments
Consider:
````fortran
integer function my_func(func_arg)
integer func_arg
my_func = func_arg(5)
end function my_func
````
Assuming that func_arg is another fortran function then we can call my_func as:
````python
x.my_func(x.func_arg) # With the function itself
````
It is left the the user to make sure that the function func_arg takes the correct inputs and returns the correct output -->


<!-- Needs readding once fixed
#### Procedure pointers
Consider a procedure like:
````fortran
procedure(my_func), pointer:: func_ptr => NULL()
````
This can be set similar to how we handle functions as arguments:
````python
x.func_ptr = x.func_arg # With the function itself
````
Its left the the user to make sure that the function func_arg takes the correct inputs and returns the correct output. If you have a function
that accepts a function pointer then its the same as if the it just accepted a function argument
If func_ptr already points a a function at compile time:
````fortran
procedure(my_func), pointer:: func_ptr => my_func
````
You must still first set it to something
````python
x.func_ptr = x.func_arg # With the function itself
```` -->

## Accessing module file data

For those wanting to explore the module file format, there is a routine ``mod_info`` available from the top-level ``gfort2py`` module:
Expand Down

0 comments on commit ee85f82

Please sign in to comment.