Skip to content

Commit ceac4b2

Browse files
committed
trying a different workflow to run quality and tests
1 parent b0bdee6 commit ceac4b2

File tree

1 file changed

+79
-22
lines changed

1 file changed

+79
-22
lines changed

.github/workflows/ci.yml

Lines changed: 79 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,96 @@
1-
name: PHP Composer
1+
name: Atlas.Pdo CI
22

33
on:
44
push:
5-
branches: [ "2.x" ]
5+
paths-ignore:
6+
- '**.md'
7+
- '**.txt'
68
pull_request:
7-
branches: [ "2.x" ]
9+
paths-ignore:
10+
- '**.md'
11+
- '**.txt'
12+
workflow_dispatch:
13+
14+
env:
15+
fail-fast: true
16+
17+
# PHP extensions required by Composer
18+
EXTENSIONS: pdo
819

920
permissions:
1021
contents: read
1122

1223
jobs:
13-
build:
1424

15-
runs-on: ubuntu-latest
25+
# PHPStan
26+
quality:
27+
name: "Validate Quality"
28+
if: "!contains(github.event.head_commit.message, 'ci skip')"
29+
30+
permissions:
31+
contents: read
1632

33+
runs-on: ubuntu-22.04
34+
35+
strategy:
36+
fail-fast: true
37+
matrix:
38+
php:
39+
- '8.1'
40+
- '8.2'
41+
- '8.3'
42+
- '8.4'
1743
steps:
18-
- uses: actions/checkout@v4
44+
- uses: actions/checkout@v4
45+
46+
- name: "Setup PHP"
47+
uses: shivammathur/[email protected]
48+
with:
49+
php-version: ${{ matrix.php }}
50+
extensions: ${{ env.EXTENSIONS }}
51+
env:
52+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1953

20-
- name: Validate composer.json and composer.lock
21-
run: composer validate --strict
54+
- name: "Install development dependencies with Composer"
55+
uses: "ramsey/composer-install@v3"
56+
with:
57+
composer-options: "--prefer-dist"
2258

23-
- name: Cache Composer packages
24-
id: composer-cache
25-
uses: actions/cache@v3
26-
with:
27-
path: vendor
28-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
29-
restore-keys: |
30-
${{ runner.os }}-php-
59+
- name: "PHPStan"
60+
run: |
61+
composer stan
3162
32-
- name: Install dependencies
33-
run: composer install --prefer-dist --no-progress
63+
unit-tests:
64+
needs: quality
65+
66+
permissions:
67+
contents: read # to fetch code (actions/checkout)
68+
69+
name: Unit tests / PHP-${{ matrix.php }}
70+
runs-on: ubuntu-22.04
71+
72+
strategy:
73+
matrix:
74+
php:
75+
- '8.1'
76+
- '8.2'
77+
- '8.3'
78+
- '8.4'
79+
steps:
80+
- name: "Setup PHP"
81+
uses: shivammathur/[email protected]
82+
with:
83+
php-version: ${{ matrix.php }}
84+
extensions: ${{ env.EXTENSIONS }}
85+
env:
86+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3487

35-
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
36-
# Docs: https://getcomposer.org/doc/articles/scripts.md
88+
- name: "Install development dependencies with Composer"
89+
uses: "ramsey/composer-install@v3"
90+
with:
91+
composer-options: "--prefer-dist"
3792

38-
# - name: Run test suite
39-
# run: composer run-script test
93+
- name: "Run Unit Tests"
94+
if: always()
95+
run: |
96+
composer test

0 commit comments

Comments
 (0)