Skip to content

Commit f576194

Browse files
authored
Merge pull request #22 from PackageFactory/task/github-actions
TASK: Add github workflow for quality assurance
2 parents a06c6f1 + e1ca11a commit f576194

4 files changed

Lines changed: 78 additions & 0 deletions

File tree

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ indent_size = 2
2222
[*.xml]
2323
indent_style = space
2424
indent_size = 2
25+
26+
[*.yml]
27+
indent_style = space
28+
indent_size = 2
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 'Set up PHP'
2+
description: 'Set up PHP and composer incl. caches'
3+
inputs:
4+
php-version:
5+
description: 'The version of PHP to set up'
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
11+
- uses: shivammathur/setup-php@v2
12+
with:
13+
php-version: ${{ inputs.php-version }}
14+
coverage: xdebug
15+
16+
- id: composer-cache
17+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
18+
shell: bash
19+
20+
- uses: actions/cache@v2
21+
with:
22+
path: ${{ steps.composer-cache.outputs.dir }}
23+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
24+
restore-keys: ${{ runner.os }}-composer-
25+
26+
- run: composer install
27+
shell: bash

.github/workflows/qa.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: QA
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main, '[0-9]+.[0-9]' ]
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
# This allows a subsequently queued workflow run to interrupt previous runs
13+
concurrency:
14+
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
15+
cancel-in-progress: true
16+
17+
jobs:
18+
static-analysis:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: ./.github/actions/setup-php
23+
with:
24+
php-version: '8.1'
25+
26+
- name: Static Code Analysis with phpstan
27+
run: ./scripts/analyse
28+
shell: bash
29+
30+
tests:
31+
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
php-version: ['8.1', '8.2']
35+
testsuite: ['unit', 'integration']
36+
steps:
37+
- uses: actions/checkout@v3
38+
- uses: ./.github/actions/setup-php
39+
with:
40+
php-version: ${{ matrix.php-version }}
41+
42+
- name: Testsuite "${{ matrix.testsuite }}" with phpunit
43+
run: |
44+
./scripts/test --testsuite ${{ matrix.testsuite }}

src/Parser/Ast/EnumMemberDeclarationNode.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ public static function fromTokens(\Iterator $tokens): self
5151
if (Scanner::type($tokens) === TokenType::BRACKET_ROUND_OPEN) {
5252
Scanner::skipOne($tokens);
5353
$value = match (Scanner::type($tokens)) {
54+
/** @phpstan-ignore-next-line */
5455
TokenType::STRING_QUOTED => StringLiteralNode::fromTokens($tokens),
56+
/** @phpstan-ignore-next-line */
5557
TokenType::NUMBER_DECIMAL => NumberLiteralNode::fromTokens($tokens),
5658
default => throw new \Exception('@TODO: Unexpected Token ' . Scanner::type($tokens)->value)
5759
};
60+
/** @phpstan-ignore-next-line */
5861
Scanner::assertType($tokens, TokenType::BRACKET_ROUND_CLOSE);
5962
Scanner::skipOne($tokens);
6063
}

0 commit comments

Comments
 (0)