From acf0c79e580213ad4ed55f6e85eac6e2982df900 Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Tue, 17 Dec 2024 22:35:47 +0100 Subject: [PATCH] Initial action to run CLI tests with Bats Signed-off-by: Christoph Niethammer --- .github/workflows/bats.yml | 74 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/bats.yml diff --git a/.github/workflows/bats.yml b/.github/workflows/bats.yml new file mode 100644 index 0000000..74bbe5f --- /dev/null +++ b/.github/workflows/bats.yml @@ -0,0 +1,74 @@ +name: "Bats CLI tests" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + # allow manual triggering of the workflow in the github UI + workflow_dispatch: + +jobs: + analyze: + name: CLI tests + runs-on: 'ubuntu-latest' + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - cmake_preset: ["debug", "release"] + + steps: + - name: Install additional OS package dependencies to build hpc-workspace + run: | + sudo apt install \ + libboost-system-dev \ + libboost-program-options-dev \ + libcap-dev + + - name: Install Bats and its support libraries for testing + run: | + sudo apt update + sudo apt install bats + sudo apt install \ + bats-assert \ + bats-file + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Fetch external sources + run: | + cd external + ./get_externals.sh + + - name: Configure and build code + run: | + cmake --preset ${{ matrix.cmake_preset }} + cmake --build --preset ${{ matrix.cmake_preset }} + + - name: Run bats non-sudo tests + run: | + bats --filter-tag \!sudo bats/test/ > bats-results-user.log 2&1 + + - name: Run bats sudo tests + run: | + sudo bats --filter-tag sudo bats/test/ > bats-results-sudo.log 2&1 + + - name: Upload full loc as a Build Artifact + uses: actions/upload-artifact@v4 + with: + name: bats-results + path: bats-results-*.log + retention-days: 1 \ No newline at end of file