Работа с Базой Данных из Qt #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ master, main ] | |
| pull_request: | |
| branches: [ master, main ] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install tools | |
| run: sudo apt-get update && sudo apt-get install -y lcov g++ qt5-qmake qtbase5-dev qtchooser 2>/dev/null || true | |
| - name: Build | |
| run: | | |
| PRO_FILE=$(find . -maxdepth 2 -name "*.pro" | head -1) | |
| if [ -n "$PRO_FILE" ]; then | |
| echo "Building with qmake: $PRO_FILE" | |
| qmake "$PRO_FILE" "QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage" "QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage" && make -j$(nproc) || true | |
| elif [ -f CMakeLists.txt ]; then | |
| echo "Building with CMake" | |
| cmake -B build -DCMAKE_CXX_FLAGS="--coverage" && cmake --build build || true | |
| elif [ -f Makefile ]; then | |
| echo "Building with Makefile" | |
| make || true | |
| else | |
| echo "Compiling C++ files directly" | |
| find . -name "*.cpp" -not -path "./build/*" | head -20 | xargs g++ -fprofile-arcs -ftest-coverage -o /dev/null 2>&1 || true | |
| fi | |
| - name: Run tests | |
| run: make check 2>/dev/null || ctest 2>/dev/null || true | |
| - name: Coverage report | |
| if: always() | |
| run: | | |
| lcov --capture --directory . --output-file coverage.info --ignore-errors source 2>/dev/null || true | |
| if [ -f coverage.info ] && [ -s coverage.info ]; then | |
| lcov --remove coverage.info '/usr/*' '*/moc_*' '*/ui_*' --output-file coverage.info 2>/dev/null || true | |
| echo "## Test Coverage Report" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| lcov --summary coverage.info 2>&1 | grep -E "lines|functions" >> $GITHUB_STEP_SUMMARY || echo "No data" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "## Code Inventory" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo "C++ files: $(find . -name '*.cpp' -o -name '*.h' | wc -l)" >> $GITHUB_STEP_SUMMARY | |
| find . -name '*.cpp' -o -name '*.h' | xargs wc -l 2>/dev/null | tail -1 >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| fi |