-
Notifications
You must be signed in to change notification settings - Fork 99
91 lines (73 loc) · 2.89 KB
/
continuous_integration.yml
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Continuous Integration"
on:
pull_request: ~
push:
branches:
- master
jobs:
continuous-integration:
name: "Continuous Integration"
runs-on: "ubuntu-latest"
strategy:
matrix:
install-args: ['', '--prefer-lowest']
php-version: ['8.1', '8.2']
fail-fast: false
steps:
# Cancel previous runs of the same branch
- name: cancel
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
with:
coverage: "xdebug"
php-version: "${{ matrix.php-version }}"
tools: composer:v2
- name: composer-cache-dir
id: composercache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: composer-cache
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }}
restore-keys: |
composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }}
composer-${{ hashFiles('**/composer.json') }}-
composer-
- name: "Install dependencies with composer"
run: |
composer update ${{ matrix.install-args }} --no-interaction --no-progress --prefer-dist
- name: "Run tests with phpunit/phpunit"
run: "vendor/bin/phpunit"
- name: phpstan-cache
uses: actions/cache@v3
with:
key: phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}-${{ github.sha }}
path: .phpstan-cache
restore-keys: |
phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}-
phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-
phpstan-${{ matrix.php-version }}-
phpstan-
- name: "Run static code analysis with phpstan/phpstan"
run: "composer phpstan"
- name: "Run coding standard checks with squizlabs/php_codesniffer"
run: "composer cs-check"
if: ${{ matrix.php-version == '7.2' }} # Do not suggest using features after 7.2
- name: "Archive code coverage results"
uses: actions/upload-artifact@v3
with:
name: "codeCoverage"
path: "build"
- uses: codecov/[email protected] # upload the coverage to codecov
with:
fail_ci_if_error: true # optional (default = false)
# Do not upload in forks, and only on php8, latest deps
if: ${{ github.repository == 'thecodingmachine/graphqlite' && matrix.php-version == '8.0' && matrix.install-args == '' }}