Skip to content

Commit

Permalink
Merge pull request #21 from FluidNumerics/windows-fpm
Browse files Browse the repository at this point in the history
[WIP] Windows fpm
  • Loading branch information
fluidnumerics-joe authored Jan 26, 2024
2 parents 91f35dd + 7900cf4 commit cd8ea96
Show file tree
Hide file tree
Showing 5 changed files with 292 additions and 210 deletions.
60 changes: 20 additions & 40 deletions .github/workflows/ci.yml → .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ci
name: linux-ci

on:
push:
Expand All @@ -20,137 +20,117 @@ env:
INTEL_ONEAPI_VERSION: 2023.2.1

jobs:
test:
linux-tests:
timeout-minutes: 8
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: ${{ matrix.os_name }} - ${{ matrix.fcompiler }} - ${{ matrix.build_type }}
name: ${{ matrix.os }} - ${{ matrix.fcompiler }} - ${{ matrix.build_type }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux
- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-9
ccompiler: gcc-9
shell: bash
build_type: coverage
memcheck: true

- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-9
ccompiler: gcc-9
shell: bash
build_type: debug
memcheck: false

- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-10
ccompiler: gcc-10
shell: bash
build_type: debug
memcheck: false

- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-11
ccompiler: gcc-11
shell: bash
build_type: debug
memcheck: false

- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-12
ccompiler: gcc-12
shell: bash
build_type: debug
memcheck: false

- os: ubuntu-22.04
os_name: linux
fcompiler: ifx
ccompiler: icx-cc
shell: bash
build_type: debug
memcheck: false

- os: ubuntu-22.04
os_name: linux
fcompiler: ifort
ccompiler: icx-cc
shell: bash
build_type: debug
memcheck: false

- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-9
ccompiler: gcc-9
shell: bash
build_type: fpm
memcheck: false

- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-10
ccompiler: gcc-10
shell: bash
build_type: fpm
memcheck: false

- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-11
ccompiler: gcc-11
shell: bash
build_type: fpm
memcheck: false

- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-12
ccompiler: gcc-12
shell: bash
build_type: fpm
memcheck: false

- os: ubuntu-22.04
os_name: linux
fcompiler: ifx
ccompiler: icx-cc
shell: bash
build_type: fpm
memcheck: false

- os: ubuntu-22.04
os_name: linux
fcompiler: ifort
ccompiler: icx-cc
shell: bash
build_type: fpm
memcheck: false


# Windows
- os: windows-latest
os_name: windows
fcompiler: gfortran
ccompiler: gcc
shell: 'msys2 {0}'
test_type: debug

defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- uses: msys2/setup-msys2@v2
if: ${{ matrix.os == 'windows-latest' }}
with:
update: true
install: git base-devel mingw-w64-x86_64-toolchain cmake

# - uses: actions/cache@v3
# id: cache
# with:
# path: /opt/intel/oneapi
# key: ${{ matrix.os }}-${{ matrix.fcompiler }}-${{ env.INTEL_ONEAPI_VERSION }}

- name: Install Intel oneAPI Fortran compiler
if: ${{ startsWith(matrix.fcompiler,'if') }}
if: ${{ startsWith(matrix.fcompiler,'if') }}
run: |
# download the key to system keyring
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
Expand Down Expand Up @@ -196,7 +176,7 @@ jobs:
./fpm test --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }} --flag "-debug all -check all,nouninit -traceback"
./fpm run --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }} --flag "-debug all -check all,nouninit -traceback" --example "*"
- name: fpm tests (not ifx)
- name: fpm tests
if: ${{ (matrix.build_type == 'fpm') && (matrix.fcompiler != 'ifx') }}
run: |
wget https://github.com/fortran-lang/fpm/releases/download/v0.9.0/fpm-0.9.0-linux-x86_64
Expand Down Expand Up @@ -238,8 +218,8 @@ jobs:
files: /home/runner/work/lcov.info
flags: ctests

- name: Run memory checks with Valgrind (only Linux)
if: ${{ matrix.os_name == 'linux' && matrix.test_type == 'debug' }}
- name: Run memory checks with Valgrind (only Linux and GNU compilers)
if: ${{ matrix.memcheck }}
run: |
sudo apt-get install -y valgrind
valgrind --error-exitcode=1 -s ./build/test/testsuite -A
85 changes: 85 additions & 0 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: windows-ci

on:
push:
branches:
- master
- main
paths-ignore:
- 'AUTHORS.md'
- 'LICENSE.md'
- 'README.md'
pull_request:
paths-ignore:
- 'AUTHORS.md'
- 'LICENSE.md'
- 'README.md'
env:
# Modify this variable to change the ifort compiler version - do NOT hardcode the version
# anywhere else!
INTEL_ONEAPI_VERSION: 2023.2.1

jobs:
windows-tests:
timeout-minutes: 8
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: ${{ matrix.os }} - ${{ matrix.fcompiler }} - ${{ matrix.build_type }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:

# Windows
- os: windows-latest
fcompiler: gfortran
ccompiler: gcc
shell: 'msys2 {0}'
build_type: debug

- os: windows-latest
fcompiler: gfortran
ccompiler: gcc
shell: 'msys2 {0}'
build_type: fpm

defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install packages
uses: msys2/setup-msys2@v2
if: ${{ matrix.os == 'windows-latest' }}
with:
update: true
install: git base-devel mingw-w64-x86_64-toolchain cmake mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-fpm

- name: Show version information
run: |
${{ matrix.fcompiler }} --version
${{ matrix.ccompiler }} --version
- name: Build with Cmake
if: ${{ matrix.build_type != 'fpm' }}
run: |
mkdir build
cd build
FC=${{ matrix.fcompiler }} CC=${{ matrix.ccompiler }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ../
make VERBOSE=1
- name: fpm tests
if: ${{ (matrix.build_type == 'fpm') && (matrix.fcompiler != 'ifx') }}
run: |
fpm install --verbose --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }}
fpm test --verbose --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }}
fpm run --verbose --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }} --example="*"
- name: Run ctests
if: ${{ matrix.build_type != 'fpm' }}
run: |
cd build/test
ctest || ctest --rerun-failed --output-on-failure
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Copyright 2020 Fluid Numerics LLC
`feq-parse` can be installed using either CMake, [Fortran Package Manager (fpm)](https://github.com/fortran-lang/fpm), or with [Spack](https://spack.io).

### Prerequisites
All you need is a Fortran compiler that is compliant with the Fortran 2008 standard and supports C interoperability. You can see which compilers are regularly tested on the [Github actions page](https://github.com/FluidNumerics/feq-parse/actions/workflows/ci.yml)
All you need is a Fortran compiler that is compliant with the Fortran 2008 standard and supports C interoperability. You can see which compilers are regularly tested on the [Github actions page](https://github.com/FluidNumerics/feq-parse/actions/workflows/ci.yml). Additionally, the table below lists the [supported compilers](#supported-compilers)

If you are installing with CMake, you will need to have CMake version 3.0.2 or greated

Expand Down Expand Up @@ -53,7 +53,7 @@ fpm test --profile release

You can also run the examples included in the `example/` subdirectory :
```
fpm run --example "*"
fpm run --example="*"
```

To use `feq-parse` within your fpm project, add the following to your `fpm.toml` file:
Expand Down Expand Up @@ -91,6 +91,18 @@ spack install [email protected]

Refer to the [spack documentation](https://spack.readthedocs.io/en/latest/) for further guidance on using Spack.

## Supported Compilers

The following combinations are tested on the main branch of feq-parse:

Name | Version | Platform | Build System | Architecture
--- | --- | --- | --- | --- |
GNU Fortran | 9, 10, 11, 12 | Ubuntu 22.04.2 LTS | `fpm`, `cmake` | x86_64
GNU Fortran | 13.2.0 | Windows Server 2022 (10.0.20348 Build 1547) (MSYS2) | `fpm`, `cmake` | x86_64
Intel oneAPI (`ifx`)| 2023.2 | Ubuntu 22.04.2 LTS | `fpm`, `cmake` | x86_64
Intel oneAPI classic (`ifort`) | 2021.1 | Ubuntu 22.04.2 LTS | `fpm`, `cmake` | x86_64


## Usage

> [!NOTE]
Expand Down
5 changes: 5 additions & 0 deletions fpm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ source-dir = "src"
[install]
library = true

[[test]]
name = "unit-tests"
source-dir = "test/fpm"
main = "test.f90"

[[example]]
name = "array_with_array_eval"
source-dir = "example"
Expand Down
Loading

0 comments on commit cd8ea96

Please sign in to comment.