Skip to content

Commit

Permalink
Merge pull request #28 from FluidNumerics/lint-workflow
Browse files Browse the repository at this point in the history
Add linting workflow to execute before other workflows
  • Loading branch information
fluidnumerics-joe committed Feb 12, 2024
2 parents a9b9e5b + 233a7e5 commit 0a0127c
Show file tree
Hide file tree
Showing 190 changed files with 10,323 additions and 10,083 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/fprettify-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: fprettify-lint

on:
push:
branches:
- master
- main
paths-ignore:
- 'AUTHORS.md'
- 'LICENSE.md'
- 'README.md'
pull_request:
paths-ignore:
- 'AUTHORS.md'
- 'LICENSE.md'
- 'README.md'

jobs:
fprettify:
name: fprettify-check
runs-on: ubuntu-22.04
strategy:
fail-fast: false
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install fprettify
run: |
pip3 install fprettify
- name: Check for formatting differences (src/)
run: |
if [[ $(fprettify './src/' --config-file ./fprettify.config -d --recursive --case 1 1 1 1) ]]; then
fprettify './src/' --config-file ./fprettify.config -d --recursive --case 1 1 1 1
exit 1
else
echo "src/ linting passed!"
fi
- name: Check for formatting differences (test/)
run: |
if [[ $(fprettify './test/' --config-file ./fprettify.config -d --recursive --case 1 1 1 1) ]]; then
fprettify './test/' --config-file ./fprettify.config -d --recursive --case 1 1 1 1
exit 1
else
echo "test/ linting passed!"
fi
- name: Check for formatting differences (example/)
run: |
if [[ $(fprettify './example/' --config-file ./fprettify.config -d --recursive --case 1 1 1 1) ]]; then
fprettify './example/' --config-file ./fprettify.config -d --recursive --case 1 1 1 1
exit 1
else
echo "example/ linting passed!"
fi
132 changes: 132 additions & 0 deletions .github/workflows/linux-gnu-cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: linux-gnu-cmake

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:
linux-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:
# Linux
- os: ubuntu-22.04
fcompiler: gfortran-9
ccompiler: gcc-9
shell: bash
build_type: coverage
memcheck: true

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

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

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

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


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


- name: Show version information
run: |
${{ matrix.fcompiler }} --version
${{ matrix.ccompiler }} --version
- name: Build with Cmake
run: |
mkdir build
cd build
FC=${{ matrix.fcompiler }} CC=${{ matrix.ccompiler }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ../
make VERBOSE=1
- name: Initialize coverage counters
if: ${{ matrix.build_type == 'coverage' }}
run: |
sudo apt-get update -y && sudo apt-get install lcov
lcov --no-external \
--directory /home/runner/work/feq-parse \
--zerocounters
- name: Run ctests
run: |
cd build/test
ctest || ctest --rerun-failed --output-on-failure
- name: Create coverage report
if: ${{ matrix.build_type == 'coverage' }}
run: |
lcov --no-external \
--capture \
--directory /home/runner/work/feq-parse \
--exclude '*/test/*' \
--output-file /home/runner/work/lcov.info
- name: codecov
if: ${{ matrix.build_type == 'coverage' }}
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: /home/runner/work/lcov.info
flags: ctests

- name: Run memory checks with Valgrind (only Linux and GNU compilers)
if: ${{ matrix.memcheck }}
run: |
sudo apt-get install -y valgrind
for f in $(find ./build/test/ -executable -type f)
do
echo $f
valgrind --undef-value-errors=no --error-exitcode=1 -s $f -A
done

76 changes: 76 additions & 0 deletions .github/workflows/linux-gnu-fpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: linux-gnu-fpm

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:
linux-tests:
timeout-minutes: 8
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: ${{ matrix.os }} - ${{ matrix.fcompiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux
- os: ubuntu-22.04
fcompiler: gfortran-9
ccompiler: gcc-9
shell: bash

- os: ubuntu-22.04
fcompiler: gfortran-10
ccompiler: gcc-10
shell: bash

- os: ubuntu-22.04
fcompiler: gfortran-11
ccompiler: gcc-11
shell: bash

- os: ubuntu-22.04
fcompiler: gfortran-12
ccompiler: gcc-12
shell: bash


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


- name: Show version information
run: |
${{ matrix.fcompiler }} --version
${{ matrix.ccompiler }} --version
- name: fpm tests
run: |
wget https://github.com/fortran-lang/fpm/releases/download/v0.9.0/fpm-0.9.0-linux-x86_64
chmod +x ./fpm-0.9.0-linux-x86_64 && mv ./fpm-0.9.0-linux-x86_64 fpm
./fpm install --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }}
./fpm test --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }}
./fpm run --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }} --example "*"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: linux-cmake
name: linux-intel-cmake

on:
push:
Expand All @@ -14,6 +14,7 @@ on:
- 'AUTHORS.md'
- 'LICENSE.md'
- 'README.md'

env:
# Modify this variable to change the ifort compiler version - do NOT hardcode the version
# anywhere else!
Expand All @@ -29,42 +30,6 @@ jobs:
fail-fast: false
matrix:
include:
# Linux
- os: ubuntu-22.04
fcompiler: gfortran-9
ccompiler: gcc-9
shell: bash
build_type: coverage
memcheck: true

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

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

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

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

- os: ubuntu-22.04
fcompiler: ifx
ccompiler: icx-cc
Expand All @@ -88,7 +53,6 @@ jobs:
uses: actions/checkout@v3

- name: Install Intel oneAPI Fortran compiler
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 All @@ -106,7 +70,6 @@ jobs:
env | grep oneapi >> $GITHUB_ENV
- name: Use existing Intel oneAPI Fortran compiler
if: ${{ startsWith(matrix.fcompiler,'if') }}
run: |
# set environment variables and make them persistent across steps
. /opt/intel/oneapi/setvars.sh
Expand Down
Loading

0 comments on commit 0a0127c

Please sign in to comment.