xref: /PHP-Parser/.github/workflows/main.yml (revision 26a01971)
1# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2name: Main
3on:
4  push:
5  pull_request:
6
7jobs:
8  tests_coverage:
9    runs-on: "ubuntu-latest"
10    name: "PHP 7.4 Unit Tests (with coverage)"
11    steps:
12      - name: "Checkout"
13        uses: "actions/checkout@v4"
14      - name: "Install PHP"
15        uses: "shivammathur/setup-php@v2"
16        with:
17          coverage: "xdebug"
18          php-version: "7.4"
19          tools: composer:v2
20      - name: "Install dependencies"
21        run: |
22          composer require php-coveralls/php-coveralls:^2.2 --dev --no-update
23          COMPOSER_ROOT_VERSION=dev-master composer update --no-progress --prefer-dist
24      - name: "Tests"
25        run: "php vendor/bin/phpunit --coverage-clover build/logs/clover.xml"
26      - name: Coveralls
27        env:
28          COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29        run: "php vendor/bin/php-coveralls"
30        if: ${{ success() }}
31  tests:
32    runs-on: "ubuntu-latest"
33    name: "PHP ${{ matrix.php-version }} Unit Tests"
34    strategy:
35      matrix:
36        php-version:
37          - "8.0"
38          - "8.1"
39          - "8.2"
40          - "8.3"
41          - "8.4"
42      fail-fast: false
43    steps:
44      - name: "Checkout"
45        uses: "actions/checkout@v4"
46      - name: "Install PHP"
47        uses: "shivammathur/setup-php@v2"
48        with:
49          coverage: "none"
50          php-version: "${{ matrix.php-version }}"
51          ini-file: "development"
52          tools: composer:v2
53      - name: "Install dependencies"
54        run: "COMPOSER_ROOT_VERSION=dev-master composer update --no-progress --prefer-dist ${{ matrix.flags }}"
55      - name: "PHPUnit"
56        run: "php vendor/bin/phpunit"
57  test_old_73_80:
58    runs-on: "ubuntu-latest"
59    name: "PHP 7.4 Code on PHP 8.4 Integration Tests"
60    steps:
61      - name: "Checkout"
62        uses: "actions/checkout@v4"
63      - name: "Install PHP"
64        uses: "shivammathur/setup-php@v2"
65        with:
66          coverage: "none"
67          php-version: "8.4"
68          ini-file: "development"
69          tools: composer:v2
70      - name: "Install PHP 8 dependencies"
71        run: "COMPOSER_ROOT_VERSION=dev-master composer update --no-progress --prefer-dist"
72      - name: "Tests"
73        run: "test_old/run-php-src.sh 7.4.33"
74  test_old_80_70:
75    runs-on: "ubuntu-latest"
76    name: "PHP 8.4 Code on PHP 7.4 Integration Tests"
77    steps:
78      - name: "Checkout"
79        uses: "actions/checkout@v4"
80      - name: "Install PHP"
81        uses: "shivammathur/setup-php@v2"
82        with:
83          coverage: "none"
84          php-version: "7.4"
85          ini-file: "development"
86          tools: composer:v2
87      - name: "Install PHP 8 dependencies"
88        run: "COMPOSER_ROOT_VERSION=dev-master composer update --no-progress --prefer-dist"
89      - name: "Tests"
90        run: "test_old/run-php-src.sh 8.4.0beta5"
91  phpstan:
92    runs-on: "ubuntu-latest"
93    name: "PHPStan"
94    steps:
95      - name: "Checkout"
96        uses: "actions/checkout@v4"
97      - name: "Install PHP"
98        uses: "shivammathur/setup-php@v2"
99        with:
100          coverage: "none"
101          php-version: "8.3"
102          tools: composer:v2
103      - name: "Install dependencies"
104        run: |
105          cd tools && composer install
106      - name: "PHPStan"
107        run: "php tools/vendor/bin/phpstan"
108  php-cs-fixer:
109    runs-on: "ubuntu-latest"
110    name: "PHP-CS-Fixer"
111    steps:
112      - name: "Checkout"
113        uses: "actions/checkout@v4"
114      - name: "Install PHP"
115        uses: "shivammathur/setup-php@v2"
116        with:
117          coverage: "none"
118          php-version: "8.3"
119          tools: composer:v2
120      - name: "Install dependencies"
121        run: |
122          cd tools && composer install
123      - name: "php-cs-fixer"
124        run: "php tools/vendor/bin/php-cs-fixer fix --dry-run"
125