Skip to content

Commit

Permalink
♻️ Create Github Action
Browse files Browse the repository at this point in the history
  • Loading branch information
jdevera committed Jul 15, 2024
1 parent 7c46cdb commit e7361c6
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build and Test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
TERM: linux

jobs:
linux-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- name: Checks
run: make check
- name: Run tests (as root)
run: |
sudo make test
- name: Compile to a file
run: make build
- name: Run checks on the single file
run: make distcheck
14 changes: 13 additions & 1 deletion test/_build.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@ setup_file() {
PROJECT_ROOT="$( cd "$( dirname "$BATS_TEST_FILENAME" )/.." >/dev/null 2>&1 && pwd )"
export JDVLIB_COMPILED_PATH=$BATS_FILE_TMPDIR/jdvlib.sh
pushd "$PROJECT_ROOT" > /dev/null || return 1
"$PROJECT_ROOT/compile.sh" lib "${JDVLIB_COMPILED_PATH}"
{
echo "JDVLIB_COMPILED_PATH: ${JDVLIB_COMPILED_PATH}"
echo "Check if $BATS_FILE_TMPDIR exists:"
if [[ -d "$BATS_FILE_TMPDIR" ]]; then
echo "$BATS_FILE_TMPDIR exists"
else
echo "$BATS_FILE_TMPDIR does not exist"
fi
echo "PROJECT_ROOT: ${PROJECT_ROOT}"
echo "CONTENTS:"
ls -l
} | sed 's/^/# /' >&3
"$BASH" ./compile.sh lib "${JDVLIB_COMPILED_PATH}"
popd > /dev/null || return 1
}

Expand Down
2 changes: 1 addition & 1 deletion test/sys.bats
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ fake_uname() {
user=test_user

user::create "$user"
register_teardown "userdel $user"
register_teardown "userdel -f $user"

run sys::run_as root whoami
assert_success
Expand Down

0 comments on commit e7361c6

Please sign in to comment.