Skip to content

Commit b4a0289

Browse files
Roelof Roosgrogy
Roelof Roos
authored andcommitted
Added GitHub Actions for release and testing
1 parent 496c25c commit b4a0289

File tree

2 files changed

+243
-0
lines changed

2 files changed

+243
-0
lines changed

.github/workflows/release.yml

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Build and test phar
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
bundle:
10+
name: Bundle binary
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: 5.4
21+
extensions: exif, phar, openssl
22+
coverage: false
23+
ini-values: phar.readonly=Off
24+
25+
- name: Install Box from GitHub
26+
run: |
27+
curl -LSs https://box-project.github.io/box2/installer.php | php
28+
test -f ./box.phar
29+
test -d ~/bin || mkdir ~/bin
30+
mv ./box.phar ~/bin/box
31+
~/bin/box -V
32+
echo "$HOME/bin" >> $GITHUB_PATH
33+
34+
- name: Install Composer dependencies
35+
uses: ramsey/composer-install@v1
36+
37+
- name: Building binary...
38+
run: box build -v
39+
40+
- uses: actions/upload-artifact@v2
41+
with:
42+
name: parallel-lint-phar
43+
path: ./parallel-lint.phar
44+
45+
verify:
46+
name: Validate binary on PHP ${{ matrix.php }}
47+
runs-on: ubuntu-latest
48+
continue-on-error: ${{ matrix.experimental == true }}
49+
needs:
50+
- bundle
51+
52+
strategy:
53+
matrix:
54+
php:
55+
- '5.4'
56+
- '5.5'
57+
- '5.6'
58+
- '7.0'
59+
- '7.1'
60+
- '7.2'
61+
- '7.3'
62+
- '7.4'
63+
- '8.0'
64+
- '8.1'
65+
66+
include:
67+
- php: '8.1'
68+
experimental: true
69+
70+
steps:
71+
- name: Checkout code
72+
uses: actions/checkout@v2
73+
74+
- uses: actions/download-artifact@v2
75+
with:
76+
name: parallel-lint-phar
77+
78+
- name: Setup PHP
79+
uses: shivammathur/setup-php@v2
80+
with:
81+
php-version: ${{ matrix.php }}
82+
coverage: false
83+
84+
- name: Run linter against codebase
85+
run: php ./parallel-lint.phar src/
86+
87+
publish:
88+
name: Add binary to release
89+
runs-on: ubuntu-latest
90+
needs:
91+
- bundle
92+
- verify
93+
94+
steps:
95+
- uses: actions/download-artifact@v2
96+
with:
97+
name: parallel-lint-phar
98+
99+
- name: Draft Release
100+
uses: actions/create-release@v1
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
with:
104+
tag_name: ${{ github.ref }}
105+
release_name: Release ${{ github.ref }}
106+
draft: true
107+
prerelease: false
108+
109+
- name: Upload Phar as Release Asset
110+
id: upload-release-asset
111+
uses: softprops/action-gh-release@v1
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
with:
115+
files: parallel-lint.phar

.github/workflows/test.yml

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Run unit and style tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- develop
8+
- master
9+
10+
jobs:
11+
lint:
12+
name: Run style linter
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Setup PHP
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: '8.0'
19+
extensions: json
20+
coverage: none
21+
22+
- name: Checkout code
23+
uses: actions/checkout@v2
24+
25+
- name: Install Composer dependencies
26+
uses: ramsey/composer-install@v1
27+
28+
- name: Run code sniffer
29+
run: vendor/bin/phpcs
30+
31+
test:
32+
name: Run unit tests
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- name: Setup PHP
37+
uses: shivammathur/setup-php@v2
38+
with:
39+
php-version: '8.0'
40+
extensions: json
41+
coverage: none
42+
43+
- name: Checkout code
44+
uses: actions/checkout@v2
45+
46+
- name: Install Composer dependencies
47+
uses: ramsey/composer-install@v1
48+
49+
- name: Run tests
50+
run: composer test
51+
52+
bundle:
53+
name: Bundle binary
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@v2
59+
60+
- name: Setup PHP
61+
uses: shivammathur/setup-php@v2
62+
with:
63+
php-version: 5.4
64+
extensions: exif, phar, openssl
65+
coverage: false
66+
ini-values: phar.readonly=Off
67+
68+
- name: Install Box from GitHub
69+
run: |
70+
curl -LSs https://box-project.github.io/box2/installer.php | php
71+
test -f ./box.phar
72+
test -d ~/bin || mkdir ~/bin
73+
mv ./box.phar ~/bin/box
74+
~/bin/box -V
75+
echo "$HOME/bin" >> $GITHUB_PATH
76+
77+
- name: Install Composer dependencies
78+
uses: ramsey/composer-install@v1
79+
80+
- name: Building binary...
81+
run: box build -v
82+
83+
- uses: actions/upload-artifact@v2
84+
with:
85+
name: parallel-lint-phar
86+
path: ./parallel-lint.phar
87+
88+
verify-bundle:
89+
name: Validate binary on PHP ${{ matrix.php }}
90+
runs-on: ubuntu-latest
91+
continue-on-error: ${{ matrix.experimental == true }}
92+
needs:
93+
- bundle
94+
95+
strategy:
96+
matrix:
97+
php:
98+
- '5.4'
99+
- '5.5'
100+
- '5.6'
101+
- '7.0'
102+
- '7.1'
103+
- '7.2'
104+
- '7.3'
105+
- '7.4'
106+
- '8.0'
107+
- '8.1'
108+
109+
include:
110+
- php: '8.1'
111+
experimental: true
112+
113+
steps:
114+
- name: Checkout code
115+
uses: actions/checkout@v2
116+
117+
- uses: actions/download-artifact@v2
118+
with:
119+
name: parallel-lint-phar
120+
121+
- name: Setup PHP
122+
uses: shivammathur/setup-php@v2
123+
with:
124+
php-version: ${{ matrix.php }}
125+
coverage: false
126+
127+
- name: Run linter against codebase
128+
run: php ./parallel-lint.phar src/

0 commit comments

Comments
 (0)