Skip to content

Commit

Permalink
Merge pull request #2 from wallabag/github-actions
Browse files Browse the repository at this point in the history
Migrate from Travis CI to GitHub Actions
  • Loading branch information
yguedidi authored Dec 17, 2023
2 parents 8929eac + 0420ba0 commit 867e89e
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 76 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

[*.yaml]
indent_size = 2
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/.rmt.yml export-ignore
/.styleci.yml export-ignore
/behat.yml export-ignore
Expand All @@ -10,6 +9,7 @@
/README.md export-ignore
/CONTRIBUTING.md export-ignore
/CHANGELOG export-ignore
/.github export-ignore
/doc export-ignore
/tests export-ignore
/examples export-ignore
42 changes: 42 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
pull_request:
push:
branches:
- master

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.2]
fail-fast: true
steps:
- uses: actions/checkout@v4

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

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --optimize-autoloader --no-interaction

- run: make tests

- run: make rusty
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ default:

suites:
array:
paths: [ %paths.base%/tests/features/common, %paths.base%/features/operators, %paths.base%/tests/features/array ]
paths: [ '%paths.base%/tests/features/common', '%paths.base%/features/operators', '%paths.base%/tests/features/array' ]
contexts: [ ArrayContext ]
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"bin-dir": "bin/"
},
"require": {
"php": ">=7.1",
"php": ">=7.2",

"hoa/ruler": "~2.0",
"symfony/property-access": "~3.0|~4.0"
Expand All @@ -40,8 +40,7 @@
"ext-json": "*",

"mikey179/vfsstream": "~1.4",
"coduo/phpspec-data-provider-extension": "~1.0,!=1.0.2",
"phpspec/phpspec": "~2.0,>=2.4@dev",
"phpspec/phpspec": "~4.0",

"behat/behat": "~3.0",

Expand Down
4 changes: 1 addition & 3 deletions phpspec.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
suites:
default:
spec_path: %paths.config%/tests
spec_path: '%paths.config%/tests'

formatter.name: dot
extensions:
- Coduo\PhpSpec\DataProvider\DataProviderExtension
68 changes: 33 additions & 35 deletions tests/spec/RulerZ/Parser/ParserSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,56 +16,54 @@ public function it_is_initializable()
$this->shouldHaveType(Parser::class);
}

/**
* @dataProvider validRules
*/
public function it_returns_an_ast_for_a_valid_rule($rule)
public function it_returns_an_ast_for_a_valid_rule()
{
$this->parse($rule)->shouldHaveType(Rule::class);
foreach ($this->validRules() as $rule) {
$this->parse($rule)->shouldHaveType(Rule::class);
}
}

/**
* @dataProvider invalidRules
*/
public function it_throws_an_exception_for_an_invalid_rule($rule)
public function it_throws_an_exception_for_an_invalid_rule()
{
$this->shouldThrow(Exception::class)->duringParse($rule);
foreach ($this->invalidRules() as $rule) {
$this->shouldThrow(Exception::class)->duringParse($rule);
}
}

public function validRules()
{
return [
['points > 30'],
['some_point ∈ some_figure'],
['some_point ∈ :some_figure'],
['some_point ∈ ["some", "list", "of", "points"]'],
['group(user) ∈ :allowed_groups'],
['locked = false'],
['admin = true'],
['deleted_at = null'],
['user.group = "members"'],
["user.group = 'members'"],
['user.group in ["members", "admins"]'],
['length(name) = 4'],
['distance(lat1, long1, lat2, long2) < 50'],
['name = :user_name'],
['name = ?'],
['name = ? and group = ?'],
['name = ? and group = :group'],
['points > 30 and group = "member"'],
['(points > 30 and group in ["member", "guest"]) or group = "admin"'],
['not points > 30'],
['a < -1'],
['a > -0.05'],
'points > 30',
'some_point ∈ some_figure',
'some_point ∈ :some_figure',
'some_point ∈ ["some", "list", "of", "points"]',
'group(user) ∈ :allowed_groups',
'locked = false',
'admin = true',
'deleted_at = null',
'user.group = "members"',
"user.group = 'members'",
'user.group in ["members", "admins"]',
'length(name) = 4',
'distance(lat1, long1, lat2, long2) < 50',
'name = :user_name',
'name = ?',
'name = ? and group = ?',
'name = ? and group = :group',
'points > 30 and group = "member"',
'(points > 30 and group in ["member", "guest"]) or group = "admin"',
'not points > 30',
'a < -1',
'a > -0.05',
];
}

public function invalidRules()
{
return [
['> 30'],
['name[0] = "a"'],
['name.foo() = "a"'],
'> 30',
'name[0] = "a"',
'name.foo() = "a"',
];
}

Expand Down
9 changes: 4 additions & 5 deletions tests/spec/RulerZ/Target/Native/NativeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ public function it_supports_satisfaction_tests_for_arrays()
$this->supports([], CompilationTarget::MODE_SATISFIES)->shouldReturn(true);
}

/**
* @dataProvider unsupportedTypes
*/
public function it_can_not_filter_other_types($type)
public function it_can_not_filter_other_types()
{
$this->supports($type, CompilationTarget::MODE_FILTER)->shouldReturn(false);
foreach ($this->unsupportedTypes() as $type) {
$this->supports($type, CompilationTarget::MODE_FILTER)->shouldReturn(false);
}
}

public function unsupportedTypes(): array
Expand Down

0 comments on commit 867e89e

Please sign in to comment.