Skip to content

Commit

Permalink
ci: setup Continuous Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
sxbrsky committed Dec 30, 2023
1 parent 9b08553 commit bf1b0c8
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 41 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/ci.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "Coding Standards"

on:
pull_request:
branches:
- "*.*"
paths:
- composer.*
- phpcs.xml.dist
- src/**
- tests/**
push:
branches:
- "*.x"
paths:
- composer.*
- phpcs.xml.dist
- src/**
- tests/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
coding-standards:
name: Coding Standards
runs-on: "ubuntu-latest"

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: '8.2'

- name: Install dependencies
uses: ramsey/composer-install@v2

- name: "Check coding standards"
run: "composer run lint:style -- -q --no-colors --report=checkstyle"
62 changes: 62 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "Continuous Integration"

on:
pull_request:
branches:
- "*.*"
paths:
- .github/workflows/continuous-integration.yml
- composer.*
- lib/**
- phpunit.xml.dist
- tests/**
push:
branches:
- "*.x"
paths:
- .github/workflows/continuous-integration.yml
- composer.*
- lib/**
- phpunit.xml.dist
- tests/**

env:
fail-fast: true

permissions:
contents: read

jobs:
build:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
php-versions: [ '8.2', '8.3' ]
operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']

steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-versions }}
- name: Install dependencies
run: composer install --prefer-source --no-interaction --dev
- name: Coding Standard
run: composer run lint:style
- name: Static Code Analysis (PHPStan)
run: composer run analyze:phpstan
- name: Static Code Analysis (Psalm)
run: composer run analyze:psalm
- name: Run test suite
run: composer run unit:tests
48 changes: 48 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Static Analysis"

on:
pull_request:
branches:
- "*.*"
paths:
- composer.*
- src/**
- phpstan*
- psalm*
push:
branches:
- "*.x"
paths:
- composer.*
- src/**
- phpstan*
- psalm*

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
static-analysis:
name: Static Analysis
runs-on: "ubuntu-latest"

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: '8.2'
tools: cs2pr

- name: Install dependencies
uses: ramsey/composer-install@v2

- name: Static Analysis (PHPStan)
run: "composer run analyze:phpstan -- --error-format=checkstyle | cs2pr"

- name: Static Analysis (PHPStan)
run: "composer run analyze:psalm -- --shepherd"

0 comments on commit bf1b0c8

Please sign in to comment.