Skip to content

Commit b84706b

Browse files
committed
Update GH actions: Add composer update and validate steps
1 parent d830da9 commit b84706b

File tree

1 file changed

+54
-70
lines changed

1 file changed

+54
-70
lines changed

.github/workflows/main.yml

+54-70
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,27 @@ jobs:
1313
security:
1414
name: Security
1515
runs-on: ${{ matrix.os }}
16-
1716
strategy:
1817
fail-fast: false
1918
matrix:
20-
php: [ '8.1' ] # Note: This workflow requires only the LATEST version of PHP
19+
php: [ '8.1' ]
2120
os: [ ubuntu-latest ]
22-
23-
steps: # General Steps
21+
steps:
2422
- name: Set Git To Use LF
2523
run: |
2624
git config --global core.autocrlf false
2725
git config --global core.eol lf
2826
- name: Checkout
2927
uses: actions/checkout@v2
30-
31-
# Install PHP Dependencies
3228
- name: Setup PHP ${{ matrix.php }}
3329
uses: shivammathur/setup-php@v2
3430
with:
3531
php-version: ${{ matrix.php }}
36-
- name: Validate Composer
32+
- name: Update Composer
33+
run: composer self-update
34+
- name: Validate Composer Config
3735
run: composer validate
3836
- name: Get Composer Cache Directory
39-
# Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
4037
id: composer-cache
4138
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
4239
- name: Restore Composer Cache
@@ -51,38 +48,33 @@ jobs:
5148
timeout_minutes: 5
5249
max_attempts: 5
5350
command: composer update --prefer-dist --no-interaction --no-progress
54-
55-
# Execution
5651
- name: Security Advisories
5752
run: composer require --dev roave/security-advisories:dev-latest
5853

5954
psalm:
6055
name: Psalm
6156
runs-on: ${{ matrix.os }}
62-
6357
strategy:
6458
fail-fast: false
6559
matrix:
66-
php: [ '8.1' ] # Note: This workflow requires only the LATEST version of PHP
60+
php: [ '8.1' ]
6761
os: [ ubuntu-latest ]
68-
69-
steps: # General Steps
62+
steps:
7063
- name: Set Git To Use LF
7164
run: |
7265
git config --global core.autocrlf false
7366
git config --global core.eol lf
7467
- name: Checkout
7568
uses: actions/checkout@v2
76-
77-
# Install PHP Dependencies
7869
- name: Setup PHP ${{ matrix.php }}
7970
uses: shivammathur/setup-php@v2
8071
with:
8172
php-version: ${{ matrix.php }}
82-
- name: Validate Composer
73+
- name: Update Composer
74+
run: composer self-update
75+
- name: Validate Composer Config
8376
run: composer validate
8477
- name: Get Composer Cache Directory
85-
# Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
8678
id: composer-cache
8779
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
8880
- name: Restore Composer Cache
@@ -97,60 +89,52 @@ jobs:
9789
timeout_minutes: 5
9890
max_attempts: 5
9991
command: composer update --prefer-dist --no-interaction --no-progress
100-
101-
# Execution
10292
- name: Static Analysis
10393
continue-on-error: true
10494
run: vendor/bin/psalm --no-cache
10595

10696
unit-tests:
107-
name: Build (${{matrix.php}}, ${{ matrix.os }}, ${{ matrix.stability }})
108-
runs-on: ${{ matrix.os }}
109-
110-
strategy:
111-
fail-fast: false
112-
matrix:
113-
php: [ '8.1' ]
114-
os: [ ubuntu-latest, macos-latest, windows-latest ]
115-
stability: [ prefer-lowest, prefer-stable ]
116-
117-
steps: # General Steps
118-
- name: Set Git To Use LF
119-
run: |
120-
git config --global core.autocrlf false
121-
git config --global core.eol lf
122-
- name: Checkout
123-
uses: actions/checkout@v2
124-
125-
# Install PHP Dependencies
126-
- name: Setup PHP ${{ matrix.php }}
127-
uses: shivammathur/setup-php@v2
128-
with:
129-
php-version: ${{ matrix.php }}
130-
# PHP Extras
131-
coverage: pcov
132-
tools: pecl
133-
ini-values: "memory_limit=-1"
134-
extensions: phar, ffi
135-
- name: Validate Composer
136-
run: composer validate
137-
- name: Get Composer Cache Directory
138-
# Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
139-
id: composer-cache
140-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
141-
- name: Restore Composer Cache
142-
uses: actions/cache@v1
143-
with:
144-
path: ${{ steps.composer-cache.outputs.dir }}
145-
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
146-
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-
147-
- name: Install Dependencies
148-
uses: nick-invision/retry@v1
149-
with:
150-
timeout_minutes: 5
151-
max_attempts: 5
152-
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
153-
154-
# Execution
155-
- name: Execute Tests
156-
run: vendor/bin/phpunit --testdox --verbose
97+
name: Build (${{matrix.php}}, ${{ matrix.os }}, ${{ matrix.stability }})
98+
runs-on: ${{ matrix.os }}
99+
strategy:
100+
fail-fast: false
101+
matrix:
102+
php: [ '8.1', '8.2' ]
103+
os: [ ubuntu-latest, macos-latest, windows-latest ]
104+
stability: [ prefer-lowest, prefer-stable ]
105+
steps:
106+
- name: Set Git To Use LF
107+
run: |
108+
git config --global core.autocrlf false
109+
git config --global core.eol lf
110+
- name: Checkout
111+
uses: actions/checkout@v2
112+
- name: Setup PHP ${{ matrix.php }}
113+
uses: shivammathur/setup-php@v2
114+
with:
115+
php-version: ${{ matrix.php }}
116+
coverage: pcov
117+
tools: pecl
118+
ini-values: "memory_limit=-1"
119+
extensions: phar, ffi
120+
- name: Update Composer
121+
run: composer self-update
122+
- name: Validate Composer Config
123+
run: composer validate
124+
- name: Get Composer Cache Directory
125+
id: composer-cache
126+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
127+
- name: Restore Composer Cache
128+
uses: actions/cache@v1
129+
with:
130+
path: ${{ steps.composer-cache.outputs.dir }}
131+
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
132+
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-
133+
- name: Install Dependencies
134+
uses: nick-invision/retry@v1
135+
with:
136+
timeout_minutes: 5
137+
max_attempts: 5
138+
command: composer update --${{ matrix.stability }} --ignore-platform-reqs --prefer-dist --no-interaction --no-progress
139+
- name: Execute Tests
140+
run: vendor/bin/phpunit --testdox --verbose

0 commit comments

Comments
 (0)