From 0051463192a14407a814c02ec7efd24622026c95 Mon Sep 17 00:00:00 2001 From: Ryan Jacobs Date: Sat, 16 Sep 2023 17:07:51 -0700 Subject: [PATCH] github ci: also, only execute if binary compiled; some exit code tuning --- .github/workflows/ci.yml | 16 ++++++++++++++++ .travis.yml | 6 ------ c | 13 +++++++++---- tests/test.sh | 5 +++++ 4 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fc8c8de --- /dev/null +++ b/.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 }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 35f979c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: c -compiler: - - gcc - - clang - - gfortran -script: (cd tests; ./test.sh) diff --git a/c b/c index 3980e21..3621cb9 100755 --- a/c +++ b/c @@ -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 @@ -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 diff --git a/tests/test.sh b/tests/test.sh index 3972959..3711835 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -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