Skip to content

Commit b76c5ed

Browse files
authored
Switch to GitHub Actions (#421)
1 parent bc29944 commit b76c5ed

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

.github/workflows/build.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
tests:
12+
runs-on: ubuntu-latest
13+
name: Build and test
14+
strategy:
15+
matrix:
16+
php: ["7.2", "7.4"]
17+
composer-version: ["1"]
18+
coverage: ["none"]
19+
publish-phar: [false]
20+
include:
21+
- php: "7.3"
22+
coverage: "pcov"
23+
publish-phar: true
24+
- php: "7.4"
25+
composer-version: "2"
26+
27+
steps:
28+
- uses: actions/checkout@v2
29+
30+
- name: Setup PHP
31+
uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: "${{ matrix.php }}"
34+
ini-values: "phar.readonly=0"
35+
tools: "composer:v${{ matrix.composer-version }}"
36+
coverage: "${{ matrix.coverage }}"
37+
38+
- name: Set composer root version
39+
run: source .composer-root-version
40+
41+
- name: Install dependencies
42+
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
43+
44+
- name: Run check-composer-root-version
45+
run: make check-composer-root-version
46+
47+
- name: Run tests (coverage)
48+
if: matrix.publish-phar
49+
run: make tc
50+
51+
- name: Run tests (e2e)
52+
if: matrix.publish-phar
53+
run: make e2e
54+
55+
- name: Run tests
56+
if: !matrix.publish-phar
57+
run: make tu
58+
59+
- name: Run phpstan
60+
if: !matrix.publish-phar
61+
run: make phpstan
62+
63+
- uses: actions/upload-artifact@v1
64+
name: Publish the PHAR
65+
if: matrix.publish-phar
66+
with:
67+
name: php-scoper.phar
68+
path: bin/php-scoper.phar
69+
70+
publish-phar:
71+
runs-on: ubuntu-latest
72+
name: Publish the PHAR
73+
needs: tests
74+
if: github.event_name == 'release'
75+
steps:
76+
- uses: actions/download-artifact@v1
77+
with:
78+
name: php-scoper.phar
79+
path: .
80+
- name: Upload php-scoper.phar
81+
uses: actions/upload-release-asset@v1
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
with:
85+
upload_url: ${{ github.event.release.upload_url }}
86+
asset_path: php-scoper.phar
87+
asset_name: php-scoper.phar
88+
asset_content_type: application/zip

0 commit comments

Comments
 (0)