summaryrefslogtreecommitdiff
path: root/.forgejo/workflows/coverage.yml
blob: 46b5bce22995c28af169b471098b95b4a8658ee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]
name: Coverage
jobs:
  coverage:
    name: Coverage
    runs-on: docker
    container:
      image: node:20

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up php 8.3 with xdebug & composer
        run: |
          apt-get update
          apt-get install -y ca-certificates apt-transport-https software-properties-common curl gnupg
          curl -fsSL https://packages.sury.org/php/apt.gpg -o /usr/share/keyrings/sury-php.gpg
          echo "deb [signed-by=/usr/share/keyrings/sury-php.gpg] https://packages.sury.org/php/ bookworm main" > /etc/apt/sources.list.d/sury-php.list
          apt-get update
          apt-get install -y php8.3 php8.3-cli php8.3-xdebug php8.3-mbstring php8.3-xml php8.3-curl php8.3-zip unzip
          php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
          php composer-setup.php --install-dir=/usr/local/bin --filename=composer
          php -r "unlink('composer-setup.php');"
          echo "xdebug.mode=coverage" >> /etc/php/8.3/cli/php.ini
          echo "xdebug.start_with_request=yes" >> /etc/php/8.3/cli/php.ini
          php -v
          composer --version

      - name: Install dependencies
        run: composer install

      - name: Run tests and collect coverage
        run: ./vendor/bin/phpunit tests --coverage-clover coverage.xml tests