Skip to content

Commit

Permalink
github ci: also, only execute if binary compiled; some exit code tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmjacobs committed Sep 17, 2023
1 parent 31156a6 commit 0051463
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,16 @@
name: CI
run-name: continuous integration
on: [push]
jobs:
test:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-latest]
cc: [gcc, clang]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- run: ./tests/test.sh
shell: bash
env:
CC: ${{ matrix.cc }}
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

13 changes: 9 additions & 4 deletions c
Expand Up @@ -34,7 +34,7 @@ cleanup() {

# Handle --help, -h, and zero args
[[ "$1" == "--help" || "$1" == "-h" ]] && { help_msg 1; exit 0; }
[[ "$#" -lt 1 ]] && { help_msg 2; exit 1; }
[[ "$#" -lt 1 ]] && { help_msg 2; exit 2; }

# ensure our $CC and $CXX variables are set
[[ -z "$CC" ]] && CC=cc
Expand Down Expand Up @@ -155,9 +155,14 @@ binname="$tmproot/$id.bin"
run() {
trap cleanup SIGINT

shift
(exec -a "$fname" "$binname" "$@")
ret=$?
if [ -x "$binname" ]; then
shift
(exec -a "$fname" "$binname" "$@")
ret=$?
else
echo
ret=4
fi

trap - SIGINT
cleanup
Expand Down
5 changes: 5 additions & 0 deletions tests/test.sh
Expand Up @@ -6,6 +6,11 @@ cd "$(dirname "$BASH_SOURCE")"
# Load helpers
source "./test_helpers.sh"

[ -n "$CC" ] && "$CC" --version
[ -n "$CXX" ] && "$CXX" --version
[ -n "$FC" ] && "$FC" --version
$c --version

# Run tests
source ./argument_and_link_test/test.sh
source ./complex_arguments/test.sh
Expand Down

0 comments on commit 0051463

Please sign in to comment.