YetiForceCompany/YetiForceCRM

View on GitHub
.github/workflows/tests.yml

Summary

Maintainability
Test Coverage
name: Unit tests

on:
  push:
    branches:
      - developer
  pull_request:
    branches:
      - developer

jobs:
  tests80:
    runs-on: ubuntu-latest
    name: PHP 8.0 - MariaDB 10.5
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

      - name: Tests
        uses: YetiForceCompany/YetiForceCRM-Tests/8.0@main
        env:
          YETI_TEST_MODULE_KEY: ${{ secrets.YETI_TEST_MODULE_KEY }}
          YETI_MAIL_PASS: ${{ secrets.YETI_MAIL_PASS }}

  tests81:
    runs-on: ubuntu-latest
    name: PHP 8.1 - MariaDB 10.5
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

      - name: Tests
        uses: YetiForceCompany/YetiForceCRM-Tests/8.1@main
        env:
          YETI_TEST_MODULE_KEY: ${{ secrets.YETI_TEST_MODULE_KEY }}
          YETI_MAIL_PASS: ${{ secrets.YETI_MAIL_PASS }}

  tests80jit:
    runs-on: ubuntu-latest
    name: PHP 8.0 JIT - MariaDB 10.5
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

      - name: Tests
        uses: YetiForceCompany/YetiForceCRM-Tests/8.0-JIT@main
        env:
          YETI_TEST_MODULE_KEY: ${{ secrets.YETI_TEST_MODULE_KEY }}
          YETI_MAIL_PASS: ${{ secrets.YETI_MAIL_PASS }}

  tests81jit:
    runs-on: ubuntu-latest
    name: PHP 8.1 JIT - MariaDB 10.5
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

      - name: Tests
        uses: YetiForceCompany/YetiForceCRM-Tests/8.1-JIT@main
        env:
          YETI_TEST_MODULE_KEY: ${{ secrets.YETI_TEST_MODULE_KEY }}
          YETI_MAIL_PASS: ${{ secrets.YETI_MAIL_PASS }}

  coverage:
    needs: tests80
    runs-on: ubuntu-latest
    name: Code Coverage
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

      - name: Tests
        uses: YetiForceCompany/YetiForceCRM-Tests/coverage@main
        env:
          YETI_TEST_MODULE_KEY: ${{ secrets.YETI_TEST_MODULE_KEY }}
          YETI_MAIL_PASS: ${{ secrets.YETI_MAIL_PASS }}
          CODACY_PROJECT_TOKEN: ${{ secrets.YETI_CODACY_PROJECT_TOKEN }}
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

      - name: PHP info
        run: |
          whereis php
          apt list --installed | grep php
          dpkg --get-selections | grep php

      - name: Scrutinizer CI
        run: |
          wget https://scrutinizer-ci.com/ocular.phar --quiet
          /usr/bin/php8.0 ocular.phar code-coverage:upload --format=php-clover ${{github.workspace}}/tests/coverages/coverage.xml

      - name: Code Climate - Test & publish code coverage
        uses: paambaati/codeclimate-action@v3.0.0
        env:
          CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
        with:
          coverageLocations: ${{github.workspace}}/tests/coverages/coverage3.xml:clover

      - name: Upload artifact Coverages
        uses: actions/upload-artifact@v3
        with:
          name: Coverages
          path: ${{github.workspace}}/tests/coverages

      - name: Upload artifact Logs
        if: ${{ always() }}
        uses: actions/upload-artifact@v3
        with:
          name: Logs
          path: ${{github.workspace}}/cache/logs/