Skip to content

Commit 7d3939b

Browse files
authored
Merge pull request #70 from bonachea/ci-output-check
CI: Check assertion output more rigorously, and add LFortran:latest
2 parents 71c30d9 + 39ab9dc commit 7d3939b

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ jobs:
77
build:
88
name: ${{ matrix.compiler }}-${{ matrix.version }} (${{ matrix.os }})
99
runs-on: ${{ matrix.os }}
10+
defaults:
11+
run:
12+
shell: bash
1013
strategy:
1114
fail-fast: false
1215
matrix:
@@ -81,6 +84,12 @@ jobs:
8184
version: 0.54.0
8285
container: phhargrove/lfortran:0.54.0-1
8386

87+
# https://github.com/lfortran/lfortran/pkgs/container/lfortran
88+
- os: ubuntu-22.04
89+
compiler: lfortran
90+
version: latest
91+
container: ghcr.io/lfortran/lfortran:latest
92+
8493
container:
8594
image: ${{ matrix.container }}
8695

@@ -89,6 +98,7 @@ jobs:
8998
FC: ${{ matrix.compiler }}
9099
FFLAGS: ${{ matrix.extra_flags }}
91100
FPM_FLAGS: --profile release --verbose
101+
CHECK_ASSERT: --flag -DASSERTIONS 2>&1 | tee output ; test ${PIPESTATUS[0]} = $ERROR_STOP_CODE && grep -q "Assertion failure" output
92102

93103
steps:
94104
- name: Checkout code
@@ -109,7 +119,13 @@ jobs:
109119
run: |
110120
set -x
111121
apt update
112-
apt install -y build-essential pkg-config make git curl
122+
apt install -y build-essential # pkg-config make git curl
123+
# Add container lfortran to PATH:
124+
if test "$FC" = "lfortran"; then \
125+
echo "/app/bin" >> "$GITHUB_PATH" ; \
126+
ls -alh /app/bin ; \
127+
ls -alh /app/share/lfortran/lib/ ; \
128+
fi
113129
114130
- name: Install macOS Dependencies
115131
if: contains(matrix.os, 'macos') && matrix.compiler == 'flang'
@@ -162,8 +178,9 @@ jobs:
162178
163179
- name: Version info
164180
run: |
165-
set -x
166181
echo == TOOL VERSIONS ==
182+
echo PATH="$PATH"
183+
set -x
167184
uname -a
168185
if test -r /etc/os-release ; then cat /etc/os-release ; fi
169186
${FPM_FC} --version
@@ -178,22 +195,20 @@ jobs:
178195
fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "$FFLAGS"
179196
180197
- name: Build and Test (Assertions ON)
181-
env:
182-
FPM_FLAGS: ${{ env.FPM_FLAGS }} --flag -DASSERTIONS
183198
run: |
184199
set -x
185-
fpm test ${FPM_FLAGS} --flag "$FFLAGS"
186-
( set +e ; fpm run --example false-assertion ${FPM_FLAGS} --flag "$FFLAGS" ; test $? = $ERROR_STOP_CODE )
187-
( set +e ; fpm run --example simple-assertions ${FPM_FLAGS} --flag "$FFLAGS" ; test $? = $ERROR_STOP_CODE )
188-
( set +e ; fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "$FFLAGS" ; test $? = $ERROR_STOP_CODE )
200+
fpm test ${FPM_FLAGS} --flag "$FFLAGS" --flag -DASSERTIONS
201+
( set +e ; eval fpm run --example false-assertion ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
202+
( set +e ; eval fpm run --example simple-assertions ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
203+
( set +e ; eval fpm run --example invoke-via-macro ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
189204
190205
- name: Test Assertions w/ Parallel Callbacks
191-
if: ${{ matrix.compiler != 'lfortran' }} # issue #68
206+
if: ${{ matrix.compiler != 'lfortran' || matrix.version == 'latest' }} # issue #68
192207
env:
193208
FPM_FLAGS: ${{ env.FPM_FLAGS }} --flag -DASSERT_MULTI_IMAGE --flag -DASSERT_PARALLEL_CALLBACKS
194209
run: |
195210
set -x
196211
fpm run --example false-assertion ${FPM_FLAGS} --flag "$FFLAGS"
197212
fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "$FFLAGS"
198-
( set +e ; fpm run --example false-assertion ${FPM_FLAGS} --flag "$FFLAGS -DASSERTIONS" ; test $? = $ERROR_STOP_CODE )
199-
( set +e ; fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "$FFLAGS -DASSERTIONS" ; test $? = $ERROR_STOP_CODE )
213+
( set +e ; eval fpm run --example false-assertion ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
214+
( set +e ; eval fpm run --example invoke-via-macro ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )

0 commit comments

Comments
 (0)