From fc1da2d4f3246501deb0326c264b7bf4915d5da7 Mon Sep 17 00:00:00 2001 From: Anupam Ghosh Date: Tue, 24 Aug 2021 15:14:01 +0530 Subject: [PATCH] github-ci for c-test Signed-off-by: Anupam Ghosh --- .github/workflows/test-checks.yml | 64 +++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/test-checks.yml diff --git a/.github/workflows/test-checks.yml b/.github/workflows/test-checks.yml new file mode 100644 index 0000000000..acf2b676a2 --- /dev/null +++ b/.github/workflows/test-checks.yml @@ -0,0 +1,64 @@ +# Copyright 2021 Anupam Ghosh +# SPDX-License-Identifier: GPL-2.0 AND LGPL-2. + +name: c tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + C-tests: + runs-on: ubuntu-20.04 + strategy: + matrix: + database-name: + - fossology + database-password: + - fossy + database-user: + - fossy + database-host: + - 127.0.0.1 + database-port: + - 5432 + + services: + postgres: + image: postgres:12 + env: + POSTGRES_DB: ${{ matrix.database-name }} + POSTGRES_PASSWORD: ${{ matrix.database-password }} + POSTGRES_USER: ${{ matrix.database-user }} + ports: + - 5432:5432 + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 50 + + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y libcppunit-dev + sudo ./utils/fo-installdeps -y -e + export PATH="/usr/lib/ccache/:$PATH" + + - name: Setup test database + env: + DATABASE_HOST: ${{ matrix.database-host }} + DATABASE_PORT: ${{ matrix.database-port }} + run: | + sudo ./utils/prepare-test + + - name: Unit tests + run: make all phpvendors test