Skip to content

Commit

Permalink
Introduce the compatibility workflow (#2)
Browse files Browse the repository at this point in the history
* Introduce the compatibility workflow

* We don't need to do this here

* It helps if this is put in the right folder

* Update php-ci.yml

* Also checkout

* We can safely ignore this

* Update phpstan.neon
  • Loading branch information
BelleNottelling authored Jun 13, 2023
1 parent 2b23548 commit 4ee23fe
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 1 deletion.
76 changes: 76 additions & 0 deletions .github/workflows/php-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Check FOSSBilling Compatibility

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
phpstan:
runs-on: ubuntu-latest

name: PHPStan - FOSSBilling Preview
steps:
- uses: actions/checkout@v3

- name: Checkout FOSSBilling Source Code
uses: actions/checkout@v3
with:
repository: "FOSSBilling/FOSSBilling"
path: "FOSSBilling"

- name: Install Composer Dependencies
uses: php-actions/composer@v6
with:
args: --working-dir=FOSSBilling
dev: no

- name: Run PHPStan
uses: php-actions/phpstan@v3
with:
php_version: latest
configuration: phpstan.neon
memory_limit: 512M

phpstan-release:
runs-on: ubuntu-latest

name: PHPStan - FOSSBilling Release
steps:
- uses: actions/checkout@v3

- name: Get the Latest FOSSBilling Release Tag
uses: oprypin/find-latest-tag@v1
with:
repository: "FOSSBilling/FOSSBilling"
releases-only: true
id: get_id

- name: Checkout The Release tag
uses: actions/checkout@v3
with:
repository: "FOSSBilling/FOSSBilling"
path: "FOSSBilling"
ref: ${{ steps.get_id.outputs.tag }}

- name: Install Composer Dependencies (<=0.4.x)
if: ${{ hashFiles('FOSSBilling/src/composer.json') }}
uses: php-actions/composer@v6
with:
args: --working-dir=FOSSBilling/src
dev: no

- name: Install Composer Dependencies (>=0.5.0)
if: ${{ hashFiles('FOSSBilling/composer.json') }}
uses: php-actions/composer@v6
with:
args: --working-dir=FOSSBilling/
dev: no

- name: Run PHPStan
uses: php-actions/phpstan@v3
with:
php_version: latest
configuration: phpstan.neon
memory_limit: 512M
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ In general, we use modules to extend the functionality of FOSSBilling.

All modules can communicate with the other modules using their API endpoints.

# Technical requirements about modules
## Technical requirements about modules

## Required

Expand All @@ -35,8 +35,22 @@ All modules can communicate with the other modules using their API endpoints.

We recommend hosting your extensions on a public [GitHub](https://github.com) repository.

### Automated compatibility checking

As FOSSBilling evolves and matures, its internal functionality changes, which can create compatibility issues between your module and FOSSBilling.
To help developers catch these issues early on, we've designed a workflow that enables you to perform a PHPStan analysis of your module with both the latest FOSSBilling release and its preview builds.
While PHPStan cannot perform live tests, it's a useful tool to verify that your module doesn't reference missing functions, use incorrect types, or have other common low-level issues.

#### Setup

More in-depth instructions are planned. For now, check out the required files:

* [php-ci.yml](https://github.com/FOSSBilling/example-module/blob/main/.github/workflows/php-ci.yml)
* [phpstan.neon](https://github.com/FOSSBilling/example-module/blob/main/phpstan.neon)

## Licensing
This extension is open source software and is released under the Apache v2.0 license. See [LICENSE](LICENSE) for the full license terms.

This product includes the following third party work:
* Open Source Iconography by [Pictogrammers](https://pictogrammers.com/) licensed under the [Pictogrammers Free License](https://pictogrammers.com/docs/general/license/).
* We recommend hosting your extensions on a public [GitHub](https://github.com) repository.
11 changes: 11 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
parameters:
level: 1
paths:
- src
- FOSSBilling
excludePaths:
analyse:
- src/vendor
- FOSSBilling
ignoreErrors:
- '#^Function __trans not found\.$#'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.

0 comments on commit 4ee23fe

Please sign in to comment.