[pre-commit.ci] pre-commit autoupdate #881
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: Tests | |
| on: [push, pull_request] | |
| jobs: | |
| linux: | |
| runs-on: ubuntu-20.04 | |
| strategy: | |
| matrix: | |
| args: [''] | |
| include: | |
| - args: -DENABLE_GETOPT=OFF | |
| - args: -DUSE_WCHAR_T=OFF | |
| # TODO: Compiler gcc / clang | |
| env: | |
| CTEST_OUTPUT_ON_FAILURE: 1 | |
| ARGS: ${{ matrix.args }} | |
| TESTARGS: -DMYSQL_TESTING=on -DPSQL_TESTING=ON | |
| services: | |
| postgres: | |
| image: postgres | |
| env: | |
| POSTGRES_PASSWORD: smsd | |
| POSTGRES_USER: smsd | |
| POSTGRES_DB: smsd | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| mysql: | |
| image: mysql | |
| env: | |
| MYSQL_DATABASE: smsd | |
| MYSQL_USER: smsd | |
| MYSQL_PASSWORD: smsd | |
| MYSQL_ROOT_PASSWORD: smsd | |
| options: >- | |
| --health-cmd="mysqladmin --password=smsd ping" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| ports: | |
| - 3306:3306 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: apt | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libbluetooth-dev libusb-1.0-0-dev libgudev-1.0-dev unixodbc-dev libdbi-dev libdbd-sqlite3 libdbd-mysql libdbd-pgsql cmake cmake-data | |
| - name: Prepare | |
| run: | | |
| mkdir _build | |
| cd _build | |
| ln -s ../codecov.yml . | |
| - name: cmake | |
| run: | | |
| cd _build | |
| # -DCMAKE_C_COMPILER=$CC | |
| cmake .. -DENABLE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Continuous -DONLINE_TESTING=ON $TESTARGS $ARGS | |
| - name: build | |
| run: make -C _build | |
| - name: test | |
| run: make -C _build test | |
| - name: coverage | |
| run: make -C _build gcov | |
| - uses: codecov/codecov-action@v4 | |
| windows: | |
| runs-on: windows-2022 | |
| env: | |
| CTEST_OUTPUT_ON_FAILURE: 1 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install nsis | |
| run: choco install nsis | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: x64 | |
| - name: Start PostgreSQL on Windows | |
| run: | | |
| $pgService = Get-Service -Name postgresql* | |
| Set-Service -InputObject $pgService -Status running -StartupType automatic | |
| Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru | |
| - name: Create PostgreSQL user on Windows | |
| run: | | |
| & $env:PGBIN\psql --command="CREATE USER smsd PASSWORD 'smsd'" --command="\du" | |
| - name: Create PostgreSQL database | |
| run: | | |
| & $env:PGBIN\createdb --owner=smsd smsd | |
| $env:PGPASSWORD = 'smsd' | |
| & $env:PGBIN\psql --username=smsd --host=localhost --list smsd | |
| - name: cmake | |
| run: cmake -S . -B _build -DENABLE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Continuous -DONLINE_TESTING=ON -DPSQL_TESTING=ON | |
| - name: build | |
| run: cmake --build _build --config Release --target package -- /verbosity:minimal | |
| - name: test | |
| run: | | |
| cd _build | |
| ctest --output-on-failure --no-compress-output --dashboard ExperimentalTest --build-config Release | |
| - uses: codecov/codecov-action@v4 | |
| macos: | |
| runs-on: macos-latest | |
| env: | |
| CTEST_OUTPUT_ON_FAILURE: 1 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Start PostgreSQL on MacOS | |
| run: | | |
| brew services start postgresql | |
| echo "Check PostgreSQL service is running" | |
| i=10 | |
| COMMAND='pg_isready' | |
| while [ $i -gt 0 ]; do | |
| echo "Check PostgreSQL service status" | |
| eval $COMMAND && break | |
| ((i--)) | |
| if [ $i == 0 ]; then | |
| echo "PostgreSQL service not ready, all attempts exhausted" | |
| exit 1 | |
| fi | |
| echo "PostgreSQL service not ready, wait 10 more sec, attempts left: $i" | |
| sleep 10 | |
| done | |
| # Homebrew creates an account with the same name as the installing user, but no password | |
| - name: Create PostgreSQL user | |
| run: | | |
| psql --command="CREATE USER smsd PASSWORD 'smsd'" --command="\du" postgres | |
| - name: Create PostgreSQL database | |
| run: | | |
| createdb --owner=smsd smsd | |
| PGPASSWORD=smsd psql --username=smsd --host=localhost --list smsd | |
| - name: Prepare | |
| run: | | |
| mkdir _build | |
| cd _build | |
| ln -s ../codecov.yml . | |
| - name: cmake | |
| run: | | |
| cd _build | |
| cmake .. -DENABLE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Continuous -DONLINE_TESTING=ON -DPSQL_TESTING=ON | |
| - name: build | |
| run: make -C _build | |
| - name: test | |
| run: make -C _build test | |
| - name: coverage | |
| run: make -C _build gcov | |
| - uses: codecov/codecov-action@v4 |