Skip to content

Commit

Permalink
restructure and addition of integration-tests in the CI (#96)
Browse files Browse the repository at this point in the history
- renames and restructures all test folders consistently to the ones in
the TRLC repo
- adds the integrations-tests run to the CI
- adds make targets `make test` (system-tests, unit-tests) and `make
test-all` (integration-tests, system-tests, unit-tests) and `make
clang-tidy`that is now used in the CI to build the dependency clang-tidy
for the `lobster-cpp` tool
- it caches clang-tidy for subsequent runs of the CI. retention period
of the cache is 7 days
- fixes invoking `tail`with an outdated syntax that lead to an error on
a newer version of GNU tail
  • Loading branch information
christophkloeffel authored Nov 11, 2024
1 parent d15b705 commit f69c82b
Show file tree
Hide file tree
Showing 75 changed files with 204 additions and 161 deletions.
49 changes: 47 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ permissions:
jobs:
lint:
name: PyLint
needs: test
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
Expand All @@ -26,7 +25,7 @@ jobs:
make lint
test:
name: TestSuite
if: success()
needs: lint
strategy:
matrix:
os: [ubuntu-24.04, windows-2022, macos-13, macos-14]
Expand Down Expand Up @@ -65,3 +64,49 @@ jobs:
if: always()
run: |
util/check_local_modifications.sh
integration-tests:
name: Integration tests
needs: test
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install python version
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements_dev.txt
sudo apt install cmake ninja-build graphviz
- name: Cache clang-tidy
id: cache-clang-tidy
uses: actions/cache@v4
with:
path: ~/work/lobster/llvm-project/build/bin/clang-tidy
key: cache-clang-tidy
- if: ${{ steps.cache-clang-tidy.outputs.cache-hit != 'true' }}
name: Build clang-tidy
run: |
make clang-tidy
- if: ${{ steps.cache-clang-tidy.outputs.cache-hit != 'true' }}
name: Save cache
uses: actions/cache/save@v4
with:
path: ~/work/lobster/llvm-project/build/bin/clang-tidy
key: cache-clang-tidy
- name: Run integration tests
run: |
make integration-tests
- name: Check output files
if: always()
run: |
util/check_local_modifications.sh
failure:
name: Check all jobs
needs: integration-tests
if: ${{ failure() || cancelled() }}
runs-on: ubuntu-24.04
steps:
- name: Failure
run: exit 1
41 changes: 26 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,28 @@ packages:
diff -Naur test_install/lib/python*/site-packages/lobster test_install_monolithic/lib/python*/site-packages/lobster -x "*.pyc"
diff -Naur test_install/bin test_install_monolithic/bin

clang-tidy:
cd .. && \
git clone https://github.com/bmw-software-engineering/llvm-project && \
cd llvm-project && \
cmake -S llvm -B build -G Ninja -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra' -DCMAKE_BUILD_TYPE=Release && \
cmake --build build --target clang-tidy

integration-tests: packages
(cd integration-tests/projects/basic; make)
(cd integration-tests/projects/filter; make)
(cd tests-integration/projects/basic; make)
(cd tests-integration/projects/filter; make)
rm -f MODULE.bazel MODULE.bazel.lock

system-tests:
mkdir -p docs
make -B -C test-system/lobster-json
make -B -C test-system/lobster-python
make -B -C tests-system/lobster-json
make -B -C tests-system/lobster-python

unit-tests:
coverage run -p \
--branch --rcfile=coverage.cfg \
--data-file .coverage \
-m unittest discover -s test-unit -v

test: integration-tests system-tests unit-tests
-m unittest discover -s tests-unit -v

upload-main: packages
python3 -m twine upload --repository pypi packages/*/dist/*
Expand All @@ -82,9 +88,14 @@ full-release:
coverage:
coverage combine -q
coverage html --rcfile=coverage.cfg
coverage report --rcfile=coverage.cfg --fail-under=57
coverage report --rcfile=coverage.cfg --fail-under=72

test: system-tests unit-tests
make coverage
util/check_local_modifications.sh

test-ci: system-tests unit-tests coverage
test-all: integration-tests system-tests unit-tests
make coverage
util/check_local_modifications.sh

docs:
Expand Down Expand Up @@ -117,10 +128,10 @@ requirements.lobster: lobster/tools/trlc/requirements.trlc \
code.lobster: $(wildcard lobster/tools/trlc/*.py)
lobster-python --out code.lobster lobster/tools/trlc

unit-tests.lobster: $(wildcard test-unit/lobster-trlc/*.py)
lobster-python --activity --out unit-tests.lobster test-unit/lobster-trlc
unit-tests.lobster: $(wildcard tests-unit/lobster-trlc/*.py)
lobster-python --activity --out unit-tests.lobster tests-unit/lobster-trlc

system-tests.lobster: $(wildcard test-system/*/*.rsl) \
$(wildcard test-system/*/*.trlc) \
$(wildcard test-system/*/tracing)
python3 test-system/lobster-trlc/lobster-trlc-system-test.py
system-tests.lobster: $(wildcard tests-system/*/*.rsl) \
$(wildcard tests-system/*/*.trlc) \
$(wildcard tests-system/*/tracing)
python3 tests-system/lobster-trlc/lobster-trlc-system-test.py
2 changes: 1 addition & 1 deletion coverage.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ exclude_lines =
omit =
/usr/*
*/site-packages/*
test-unit/*
tests-unit/*
Loading

0 comments on commit f69c82b

Please sign in to comment.