forked from GEWIS/gewisweb
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (54 loc) · 2.7 KB
/
static-analysis-psalm.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
name: PHP Static Analysis with Psalm
# Only run this action on pull requests (creation, synchronisation, and reopening).
on: [pull_request]
# Cancel running jobs that have become stale through updates to the ref (e.g., pushes to a pull request).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
psalm:
name: Psalm
runs-on: ubuntu-latest
steps:
- name: Checkout head branch
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: calendar, curl, exif, gd, intl, opcache, pgsql, pdo_mysql, pdo_pgsql, zip, imagick, memcached, xdebug
- name: Extract configuration files
run: |
cp config/autoload/doctrine.local.development.php.dist config/autoload/doctrine.local.php
cp config/autoload/laminas-developer-tools.local.php.dist config/autoload/laminas-developer-tools.local.php
cp config/autoload/local.development.php.dist config/autoload/local.php
- name: Check out main
run: |
git fetch --all
git update-ref refs/heads/temp-psalmpr refs/remotes/origin/main
git checkout --detach temp-psalmpr
- name: Install dependencies with Composer
uses: ramsey/composer-install@v3
- name: Load environment variables
uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env.dist
- name: Generate Psalm Baseline
run: |
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><files/>" > psalm/psalm-baseline.xml
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><files/>" > psalm/psalm-baseline-pr.xml
vendor/bin/psalm --set-baseline=psalm/psalm-baseline-pr.xml --no-diff --no-cache --no-progress || true
- name: Check out new branch
run: |
git checkout -- psalm/psalm-baseline.xml
git checkout --theirs -- config/modules.config.php
git checkout -
- name: Install dependencies with Composer
uses: ramsey/composer-install@v3
- name: Load environment variables
uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env.dist
- name: Run Psalm
run: |
vendor/bin/psalm --no-diff --no-cache --no-progress --output-format=github