Skip to content

Commit a36e533

Browse files
romaninshDarkSide666
authored andcommitted
Add Github workflows (actions) (#848)
* workflow * Setting current dependencies * wip * wip * wip * wip * wip * wip * wip * wip * fix * Fix unit test on Windows paths * Remove file db.github.php from Demo functional test check. * Apply fixes from StyleCI * Fix some Type Hints * Apply fixes from StyleCI
1 parent 3c5920a commit a36e533

File tree

8 files changed

+119
-8
lines changed

8 files changed

+119
-8
lines changed

.github/workflows/bundler.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Bundler
2+
3+
on:
4+
create:
5+
branches:
6+
- 'release/*'
7+
8+
jobs:
9+
autocommit:
10+
runs-on: ubuntu-latest
11+
container:
12+
image: atk4/image:latest # https://github.com/atk4/image
13+
steps:
14+
- uses: actions/checkout@master
15+
- run: |
16+
sed -i -e '/atk4\/data/d' composer.json
17+
sed -i -e '/atk4\/core/d' composer.json
18+
cat composer.json
19+
composer require atk4/core atk4/data
20+
composer update
21+
22+
- uses: teaminkling/autocommit@master
23+
with:
24+
commit-message: Setting current dependencies
25+
- uses: ad-m/github-push-action@master
26+
with:
27+
branch: ${{ github.ref }}
28+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-drafter.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
# branches to consider in the event; optional, defaults to all
6+
branches:
7+
- develop
8+
9+
jobs:
10+
update_release_draft:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# Drafts your next Release notes as Pull Requests are merged into "master"
14+
- uses: toolmantim/release-drafter@v5.2.0
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/unit-tests.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Unit Testing
2+
3+
on:
4+
pull_request
5+
6+
jobs:
7+
unit-test:
8+
name: Unit Testing
9+
runs-on: ubuntu-latest
10+
container:
11+
image: atk4/image:latest # https://github.com/atk4/image
12+
strategy:
13+
matrix:
14+
php: ['7.2', '7.3', 'latest']
15+
services:
16+
mysql:
17+
image: mysql:5.7
18+
env:
19+
MYSQL_ROOT_PASSWORD: password
20+
DB_DATABASE: db
21+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
22+
steps:
23+
- uses: actions/checkout@v1
24+
- name: Get Composer Cache Directory
25+
id: composer-cache
26+
run: |
27+
echo "::set-output name=dir::$(composer config cache-files-dir)"
28+
- uses: actions/cache@v1
29+
with:
30+
path: ${{ steps.composer-cache.outputs.dir }}
31+
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
32+
restore-keys: |
33+
${{ runner.os }}-composer-
34+
35+
- run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
36+
37+
- name: Install dependencies and SQL
38+
run: |
39+
mkdir -p coverage
40+
apk add npm
41+
npm install -g less clean-css uglify-js
42+
mysql -uroot -ppassword -h mysql -e 'CREATE DATABASE atk4;'
43+
mysql -uroot -ppassword -h mysql atk4 < demos/atk4.sql
44+
45+
mv demos/db.github.php demos/db.php
46+
(cd js; npm install; npm run build)
47+
#lessc public/agileui.less public/agileui.css --clean-css="--s1 --advanced --compatibility=ie8" --source-map
48+
#uglifyjs --compress -- public/agileui.js > public/agileui.min.js
49+
50+
- name: Unit Testing
51+
run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml
52+
53+
# - name: Merge coverage logs
54+
# run: vendor/bin/phpcov merge build/logs/ --clover build/logs/cc.xml;
55+
56+
- uses: codecov/codecov-action@v1
57+
with:
58+
token: ${{ secrets.CODECOV_TOKEN }}
59+
file: covearge.xml
60+
61+

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
}
1616
],
1717
"require": {
18-
"atk4/data": "dev-develop",
19-
"atk4/core": "dev-develop",
2018
"php": ">=7.2.0",
21-
"ext-json": "*"
19+
"ext-json": "*",
20+
"atk4/core": "dev-develop",
21+
"atk4/data": "dev-develop"
2222
},
2323
"require-dev": {
2424
"phpunit/phpunit": "<6",

demos/db.github.php

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
$db = new \atk4\data\Persistence\SQL('mysql:dbname=atk4;host=mysql', 'root', 'password');

src/ActionExecutor/Basic.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Basic extends \atk4\ui\View implements Interface_
6262
*
6363
* @param \atk4\data\UserAction\Generic $action
6464
*/
65-
public function setAction(\atk4\data\UserAction\Generic $action)
65+
public function setAction(\atk4\data\UserAction\Generic $action) : void
6666
{
6767
$this->action = $action;
6868
}
@@ -134,6 +134,8 @@ protected function initPreview()
134134
/**
135135
* Will call $action->execute() with the correct arguments.
136136
*
137+
* @throws \atk4\core\Exception
138+
*
137139
* @return mixed
138140
*/
139141
public function jsExecute()
@@ -154,7 +156,7 @@ public function jsExecute()
154156
/**
155157
* Will add header if set.
156158
*
157-
* @throws Exception
159+
* @throws \atk4\core\Exception
158160
*/
159161
public function addHeader()
160162
{

tests/BuiltInWebServerAbstract.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public static function setUpBeforeClass()
3030

3131
if (!file_exists(getcwd().'/demos/coverage.php')) {
3232
file_put_contents(
33-
getcwd().'/demos/coverage.php',
34-
file_get_contents(getcwd().'/tools/coverage.php')
33+
implode(DIRECTORY_SEPARATOR, [dirname(__DIR__), 'demos', 'coverage.php']),
34+
file_get_contents(implode(DIRECTORY_SEPARATOR, [dirname(__DIR__), 'tools', 'coverage.php']))
3535
);
3636
}
3737

tests/DemoCallExitTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class DemoCallExitTest extends BuiltInWebServerAbstract
3030
public function testableDemoFilesdataProvider()
3131
{
3232
$files = [];
33-
foreach (scandir(getcwd().DIRECTORY_SEPARATOR.'demos') as $file) {
33+
foreach (scandir(dirname(__DIR__).DIRECTORY_SEPARATOR.'demos') as $file) {
3434
if (is_dir($file) || substr($file, -3) !== 'php') {
3535
continue;
3636
}
@@ -41,6 +41,7 @@ public function testableDemoFilesdataProvider()
4141
case 'db.example.php': // exclude - is a setup file
4242
case 'db.php': // exclude - is a setup file
4343
case 'db.travis.php': // exclude - is a setup file
44+
case 'db.github.php': // exclude - is a setup file
4445
case 'coverage.php': // exclude - is the coverage file
4546
case 'somedatadef.php': // exclude - is a setup file
4647
case 'layouts_nolayout.php': // exclude - output only a partial html

0 commit comments

Comments
 (0)