Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github action for compilation and coding style #897

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/check-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Configure and build

on:

push:
branches:
- master
- develop

pull_request:
branches:
- master
- develop

jobs:

style:

name: coding style
uses: ./.github/workflows/check-coding-style.yaml

build:

strategy:
matrix:
os: [ubuntu-latest] #[ubuntu-latest, macos-latest]

runs-on: ${{ matrix.os }}

steps:

- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update -q
sudo apt-get install -qy gfortran gcc g++
sudo apt-get install -qy expect
sudo apt-get install -qy libmotif-dev

- name: Install macOS dependencies
if: matrix.os == 'macos-latest'
run: |
brew install gcc
brew install tcl-tk
brew install openmotif

- name: Compiler versions
run: |
gfortran --version
gcc --version
g++ --version
make --version

- name: Checkout
uses: actions/checkout@v3

- name: Build EGSnrc
run: |
HEN_HOUSE/scripts/configure.expect ${{ runner.os }}.conf | tee configure.log
for f in HEN_HOUSE/log/*.log configure.log; do echo $f; cat $f; done
(! grep -i fail configure.log)
44 changes: 44 additions & 0 deletions .github/workflows/check-coding-style.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Coding style

on:
workflow_call:

jobs:

eol:
name: eol whitespace
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3

- name: Check whitespace
run: |
for f in $(grep -ERl -I '\s+$' HEN_HOUSE | grep -v "^HEN_HOUSE/spectra/lnhb/ensdf"); do
echo $f;
sed -i -e's/[[:space:]]*$//' $f;
done
git diff
(! git status | grep "modified")

astyle:

name: astyle standard
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3

- name: Install astyle
run: |
wget https://sourceforge.net/projects/astyle/files/astyle/astyle%203.1/astyle_3.1_linux.tar.gz
tar -xzf astyle_3.1_linux.tar.gz
(cd astyle/build/gcc; make)

- name: Check astyle formatting standard
run: |
astyle/build/gcc/bin/astyle --options=HEN_HOUSE/scripts/egs_style_standard --recursive "HEN_HOUSE/egs++/*.cpp,*.h"
git diff
(! git status | grep ".orig")
45 changes: 45 additions & 0 deletions .github/workflows/check-gcc-versions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Compiler versions

on:
workflow_call:

jobs:

gcc-versions:
name: gcc versions

strategy:
matrix:
gcc-version: [4.8, 5, 6, 7, 8, 9]
os: [ubuntu-18.04]

runs-on: ${{ matrix.os }}

steps:

- name: Install dependencies
if: matrix.os == 'ubuntu-18.04'
run: |
sudo apt-get update -q
sudo apt remove -qy gcc g++
sudo apt install gfortran
sudo apt install gcc-${{ matrix.gcc-version }}
sudo apt install g++-${{ matrix.gcc-version }}
sudo apt-get install -qy expect
sudo apt-get install -qy libmotif-dev

- name: Compiler versions
run: |
gfortran --version
gcc --version
g++ --version
make --version

- name: Checkout
uses: actions/checkout@v3

- name: Build EGSnrc
run: |
HEN_HOUSE/scripts/configure.expect ${{ runner.os }}.conf | tee configure.log
cat *.log log/*.log
(! grep -i fail *.log log/*.log)