Skip to content

Commit ac1a481

Browse files
committed
Add github action configuration for build test
Add a compilation test configuration file for continuous integration, similar to Travis-CI (file .travis.yaml in project root directory), but running as a github action instead. This action in turns triggers an action to check the coding style.
1 parent 2c11e39 commit ac1a481

File tree

3 files changed

+106
-1
lines changed

3 files changed

+106
-1
lines changed

.github/workflows/check-build.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Configure and build
2+
3+
on:
4+
5+
push:
6+
branches:
7+
- master
8+
- develop
9+
10+
pull_request:
11+
branches:
12+
- master
13+
- develop
14+
15+
jobs:
16+
17+
style:
18+
19+
name: coding style
20+
uses: ./.github/workflows/check-coding-style.yaml
21+
22+
build:
23+
24+
strategy:
25+
matrix:
26+
os: [ubuntu-latest] #[ubuntu-latest, macos-latest]
27+
28+
runs-on: ${{ matrix.os }}
29+
30+
steps:
31+
32+
- name: Install linux dependencies
33+
if: matrix.os == 'ubuntu-latest'
34+
run: |
35+
sudo apt-get update -q
36+
sudo apt-get install -qy gfortran gcc g++
37+
sudo apt-get install -qy expect
38+
sudo apt-get install -qy libmotif-dev
39+
40+
- name: Install macOS dependencies
41+
if: matrix.os == 'macos-latest'
42+
run: |
43+
brew install gcc
44+
brew install tcl-tk
45+
brew install openmotif
46+
47+
- name: Check versions
48+
run: |
49+
gfortran --version
50+
gcc --version
51+
g++ --version
52+
make --version
53+
54+
- name: Checkout
55+
uses: actions/checkout@v3
56+
57+
- name: Build EGSnrc
58+
run: |
59+
HEN_HOUSE/scripts/configure.expect ${{ runner.os }}.conf | tee configure.log
60+
cat *.log log/*.log
61+
(! grep -i fail *.log log/*.log)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Coding style
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
8+
eol:
9+
name: eol whitespace
10+
runs-on: ubuntu-latest
11+
steps:
12+
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Check whitespace
17+
run: |
18+
for f in $(grep -ERl -I '\s+$' HEN_HOUSE | grep -v "^HEN_HOUSE/spectra/lnhb/ensdf"); do
19+
echo $f;
20+
sed -i -e's/[[:space:]]*$//' $f;
21+
done
22+
git diff
23+
(! git status | grep "modified")
24+
25+
astyle:
26+
27+
name: astyle standard
28+
runs-on: ubuntu-latest
29+
steps:
30+
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
34+
- name: Install astyle
35+
run: |
36+
wget https://sourceforge.net/projects/astyle/files/astyle/astyle%203.1/astyle_3.1_linux.tar.gz
37+
tar -xzf astyle_3.1_linux.tar.gz
38+
(cd astyle/build/gcc; make)
39+
40+
- name: Check astyle formatting standard
41+
run: |
42+
astyle/build/gcc/bin/astyle --options=HEN_HOUSE/scripts/egs_style_standard --recursive "HEN_HOUSE/egs++/*.cpp,*.h"
43+
git diff
44+
(! git status | grep ".orig")

HEN_HOUSE/scripts/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ read response
125125

126126
printf $format "Checking system type ... " >&2
127127
canonical_system=$($my_dir/config.guess)
128-
system_name=$(uname -s | sed ":/:_:g" | tr '[:upper:]' '[:lower:]')
128+
system_name=$(uname -s | sed "s|/|_|g" | tr '[:upper:]' '[:lower:]')
129129
if test "x$system_name" = xdarwin; then
130130
system_name="osx"
131131
fi

0 commit comments

Comments
 (0)