From cbce4794496a3b3822b08091a7d78a330fc3b6b0 Mon Sep 17 00:00:00 2001 From: mantinhas <54488939+mantinhas@users.noreply.github.com> Date: Sun, 26 Oct 2025 01:12:54 +0100 Subject: [PATCH] Add github action for tests Enable submodule checkout in CI workflow Updated checkout step to include submodules. Add each unit tests as a github action Added multiple unit test steps to the workflow. Setup Git config for unit tests Added Git global configuration for testing environment. --- .github/workflows/unittests.yml | 54 +++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/unittests.yml diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml new file mode 100644 index 0000000..58a9f19 --- /dev/null +++ b/.github/workflows/unittests.yml @@ -0,0 +1,54 @@ +name: Run Unit Tests + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + unittests: + + runs-on: ubuntu-latest + + steps: + - name: Checkout repository (with submodules) + uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup Git Global Config for tests + run: | + git config --global user.name "Test User" + git config --global user.email "test@example.com" + git config --global init.defaultBranch main + + - name: Run Unit tests for "Clean" + run: ./test/bats/bin/bats test/test_cases/clean.bats + + - name: Run Unit tests for "Declare" + run: ./test/bats/bin/bats test/test_cases/declare.bats + + - name: Run Unit tests for "Diff" + run: ./test/bats/bin/bats test/test_cases/diff.bats + + - name: Run Unit tests for "Export" + run: ./test/bats/bin/bats test/test_cases/export.bats + + - name: Run Unit tests for "Generate" + run: ./test/bats/bin/bats test/test_cases/generate.bats + + - name: Run Unit tests for "Import" + run: ./test/bats/bin/bats test/test_cases/import.bats + + - name: Run Unit tests for "Install-config" + run: ./test/bats/bin/bats test/test_cases/install-config.bats + + - name: Run Unit tests for "List" + run: ./test/bats/bin/bats test/test_cases/list.bats + + - name: Run Unit tests for "Status" + run: ./test/bats/bin/bats test/test_cases/status.bats + + - name: Run Unit tests for "Utils" + run: ./test/bats/bin/bats test/test_cases/utils.bats