Skip to content

Commit 7f0039f

Browse files
committed
Create base action
1 parent db79e40 commit 7f0039f

File tree

8 files changed

+2310
-45
lines changed

8 files changed

+2310
-45
lines changed

.github/workflows/release.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: PHP release
2+
3+
on:
4+
release:
5+
types: [published, created, edited]
6+
7+
jobs:
8+
run:
9+
runs-on: ubuntu-latest
10+
name: Release
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v1
14+
15+
- name: Setup PHP
16+
uses: shivammathur/setup-php@v1
17+
with:
18+
php-version: 7.4
19+
extensions: curl,json,mbstring
20+
coverage: none
21+
22+
- name: Get Composer Cache Directory
23+
id: composer-cache
24+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
25+
26+
- name: Cache dependencies
27+
uses: actions/cache@v1
28+
with:
29+
path: ${{ steps.composer-cache.outputs.dir }}
30+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
31+
restore-keys: ${{ runner.os }}-composer-
32+
33+
- name: Validate composer.json and composer.lock
34+
run: composer validate
35+
36+
- name: Install dependencies
37+
run: composer install --prefer-dist --no-progress --no-suggest
38+
39+
- name: Compile phar
40+
run: composer run-script phar
41+
42+
- name: Upload binary to release
43+
uses: svenstaro/upload-release-action@v1-release
44+
with:
45+
repo_token: ${{ secrets.GITHUB_TOKEN }}
46+
file: build/out/phpdraft-${{ github.ref }}.phar
47+
asset_name: phpdraft-${{ github.ref }}.phar
48+
tag: ${{ github.ref }}
49+
overwrite: false
50+
51+
- name: Upload library to release
52+
uses: svenstaro/upload-release-action@v1-release
53+
with:
54+
repo_token: ${{ secrets.GITHUB_TOKEN }}
55+
file: build/out/phpdraft-library-${{ github.ref }}.phar
56+
asset_name: phpdraft-library-${{ github.ref }}.phar
57+
tag: ${{ github.ref }}
58+
overwrite: false

.github/workflows/sonar.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: PHPDrafter sonarqube analysis
2+
3+
on: [push]
4+
5+
jobs:
6+
sonarqube:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1
10+
- name: SonarCloud Scan
11+
uses: sonarsource/sonarcloud-github-action@master
12+
continue-on-error: true
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/test.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: PHPDrafter test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
phpcs:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: PHP Code Scanner Scan
17+
uses: rtCamp/action-phpcs-code-review@master
18+
continue-on-error: true
19+
env:
20+
GH_BOT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
with:
22+
args: "PSR12"
23+
test:
24+
runs-on: ubuntu-latest
25+
name: PHP ${{ matrix.php-versions }}
26+
strategy:
27+
matrix:
28+
php-versions: ['7.2', '7.3', '7.4']
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v1
32+
33+
- name: Setup PHP
34+
uses: shivammathur/setup-php@v1
35+
with:
36+
php-version: ${{ matrix.php-versions }}
37+
extensions: curl,json,mbstring,uopz
38+
coverage: xdebug
39+
pecl: true
40+
41+
- name: Get Composer Cache Directory
42+
id: composer-cache
43+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
44+
45+
- name: Cache dependencies
46+
uses: actions/cache@v1
47+
with:
48+
path: ${{ steps.composer-cache.outputs.dir }}
49+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
50+
restore-keys: ${{ runner.os }}-composer-
51+
52+
- name: Validate composer.json and composer.lock
53+
run: composer validate
54+
55+
- name: Install dependencies
56+
run: composer install --prefer-dist --no-progress --no-suggest
57+
58+
- name: Run test suite
59+
run: composer run-script test
60+
61+
- name: Upload coverage result
62+
uses: actions/upload-artifact@v1
63+
with:
64+
name: coverage
65+
path: coverage.xml
66+
67+
analytics:
68+
name: Analytics
69+
needs: test
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Code coverage Scan
73+
uses: codecov/codecov-action@v1
74+
with:
75+
token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
src/Michelf/*
1313
src/.gitignore
1414
vendor/**
15-
composer.lock
1615

1716
# JIRA plugin
1817
atlassian-ide-plugin.xml

.travis.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

build.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<target name="setup" depends="clean"/>
44

55
<target name="clean" unless="clean.done" description="Cleanup build artifacts">
6-
<delete dir="${project.basedir}/bin"/>
7-
<delete dir="${project.basedir}/build/documentation"/>
8-
<delete dir="${project.basedir}/build/logfiles"/>
6+
<delete dir="${project.basedir}/build/coverage"/>
7+
<delete dir="${project.basedir}/build/logs"/>
98
<delete dir="${project.basedir}/build/phar"/>
109
<delete dir="${project.basedir}/build/out"/>
10+
<delete dir="${project.basedir}/build/tmp"/>
1111
<delete>
1212
<fileset dir="${project.basedir}/build">
1313
<include name="**/phpdraft*.phar"/>

composer.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "smillerdev/phpdraft",
33
"description": "This is a parser for API Blueprint files in PHP.",
44
"minimum-stability": "stable",
5-
"license": "GPL-3.0",
5+
"license": "GPL-3.0-or-later",
66
"bin": ["phpdraft"],
77
"authors": [
88
{
@@ -18,7 +18,7 @@
1818
}
1919
],
2020
"require": {
21-
"php": "~7.1",
21+
"php": "~7.2",
2222
"ql/uri-template": "~1.0",
2323
"vanilla/garden-cli": "~2.0",
2424
"michelf/php-markdown": "~1.9",
@@ -32,6 +32,16 @@
3232
"theseer/autoload": "~1.0",
3333
"phing/phing": "~2.0"
3434
},
35+
"scripts": {
36+
"test": [
37+
"vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover=coverage.xml"
38+
],
39+
"phar": [
40+
"vendor/bin/phing phar-nightly",
41+
"vendor/bin/phing signed-phar",
42+
"sha256sum build/out/*"
43+
]
44+
},
3545
"autoload": {
3646
"psr-4": { "PHPDraft\\": "src/PHPDraft" }
3747
},

0 commit comments

Comments
 (0)