Skip to content

Commit

Permalink
Add github workflows to test
Browse files Browse the repository at this point in the history
  • Loading branch information
hosni committed Apr 2, 2024
1 parent dff2044 commit 3cba9d8
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 3 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,52 @@
name: Test Jalno Base
on:
push:
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: true
matrix:
php: ['8.0', '8.1', '8.2']

name: PHP ${{ matrix.php }}

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Checkout jalno/PhpParser
uses: actions/checkout@v4
with:
repository: jalno/PhpParser
path: packages/PhpParser

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Validate defaultClassMap.php
run: php -l packages/base/defaultClassMap.php

- name: Validate package.json
run: php -r 'json_decode(file_get_contents("packages/base/package.json"), false, 512, JSON_THROW_ON_ERROR);'

- name: Validate lang file langs/en_US.json
run: php -r 'json_decode(file_get_contents("packages/base/langs/en_US.json"), false, 512, JSON_THROW_ON_ERROR);'

- name: Validate lang file langs/fa_IR.json
run: php -r 'json_decode(file_get_contents("packages/base/langs/fa_IR.json"), false, 512, JSON_THROW_ON_ERROR);'

- name: PHPStan
uses: php-actions/phpstan@v3
with:
php_version: ${{ matrix.php }}
path: ./
configuration: packages/base/phpstan.neon
Expand Up @@ -5,8 +5,11 @@
use packages\base\Process;

class CannotStartProcessException extends Exception {
public function __construct(public readonly Process $process, string $message = "can not start process") {
protected Process $process;

public function __construct(Process $process, string $message = "can not start process") {
parent::__construct($message);
$this->process = $process;
}

public function getProcess(): Process
Expand Down
Expand Up @@ -5,8 +5,11 @@
use packages\base\Process;

class NotStartedProcessException extends Exception {
public function __construct(public readonly Process $process, string $message = "process does not started") {
protected Process $process;

public function __construct(Process $process, string $message = "process does not started") {
parent::__construct($message);
$this->process = $process;
}

public function getProcess(): Process
Expand Down
2 changes: 1 addition & 1 deletion packages/base/libraries/frontend/frontend.php
@@ -1,10 +1,10 @@
<?php
namespace packages\base;
use \packages\base\frontend;
use \packages\base\IO\directory;
use \packages\base\IO\file;
use \packages\base\json;
use \packages\base\frontend\source;

class frontend{
private static function getWebpackResult():array{
$base = packages::package('base');
Expand Down

0 comments on commit 3cba9d8

Please sign in to comment.