Skip to content

Commit cbf35de

Browse files
committed
Use Github actions instead of Travis CI (#278)
1 parent 8f61d20 commit cbf35de

File tree

4 files changed

+128
-48
lines changed

4 files changed

+128
-48
lines changed

Diff for: .editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ trim_trailing_whitespace = false
2424
[*.yml]
2525
trim_trailing_whitespace = false
2626

27-
[.travis.yml]
27+
[.github/workflows/*.yml]
2828
indent_size = 2
2929

3030
[composer.json]

Diff for: .github/workflows/ci.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI
2+
3+
on:
4+
- push
5+
6+
jobs:
7+
build:
8+
name: Build and Test
9+
runs-on: ubuntu-latest
10+
env:
11+
extensions: json
12+
composer_version: 2
13+
strategy:
14+
matrix:
15+
php_version:
16+
- '7.4'
17+
- '8.0'
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- name: Get Composer Cache Directory
22+
id: composer-cache
23+
run: |
24+
echo "::set-output name=dir::$(composer config cache-files-dir)"
25+
26+
- uses: actions/cache@v2
27+
with:
28+
path: ${{ steps.composer-cache.outputs.dir }}
29+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
30+
restore-keys: |
31+
${{ runner.os }}-composer-
32+
33+
- name: Setup PHP with extensions
34+
uses: shivammathur/setup-php@v2
35+
with:
36+
php-version: ${{ matrix.php_version }}
37+
extensions: ${{ env.extensions }}
38+
ini-values: memory_limit=-1
39+
coverage: pcov
40+
tools: composer:v2, cs2pr, php-cs-fixer
41+
42+
- name: Install prerequisites
43+
run: |
44+
export PATH="$PATH:$HOME/.composer/vendor/bin"
45+
mkdir -p build/logs
46+
wget https://github.com/satooshi/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
47+
wget -O box.phar https://github.com/humbug/box/releases/download/3.11.1/box.phar
48+
export BOX_BIN=$(pwd)/box.phar
49+
sudo chown -R $(whoami):$(whoami) .
50+
51+
- name: Install dependencies
52+
run: composer install --prefer-dist --no-interaction --no-progress
53+
54+
- name: Run phpunit
55+
run: vendor/bin/simple-phpunit
56+
57+
- name: Run php-cs-fixer
58+
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr
59+
60+
- name: Run phpstan
61+
run: |
62+
vendor/bin/phpstan analyse
63+
64+
- name: Run e2e tests
65+
run: |
66+
php bin/compile

Diff for: .github/workflows/release.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
on:
2+
push:
3+
tags:
4+
- 'v*'
5+
6+
name: Create Release and Upload Release Asset
7+
8+
jobs:
9+
build:
10+
name: Create Release and Upload Release Asset
11+
runs-on: ubuntu-latest
12+
env:
13+
extensions: json
14+
php_version: '8.0'
15+
outputs:
16+
upload_url: ${{ steps.step_upload_url.outputs.upload_url }}
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
21+
- name: Setup PHP with extensions
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: ${{ env.php_version }}
25+
extensions: ${{ env.extensions }}
26+
ini-values: memory_limit=-1
27+
tools: composer:v2
28+
29+
- name: Install dependencies
30+
run: composer install --prefer-dist --no-interaction --no-progress
31+
32+
- name: Download box.phar
33+
run: |
34+
wget -O box.phar https://github.com/humbug/box/releases/download/3.11.1/box.phar
35+
export BOX_BIN=$(pwd)/box.phar
36+
37+
- name: Compile project
38+
run: php ./box.phar compile;
39+
40+
- name: Create Release
41+
id: create_release
42+
uses: actions/create-release@v1
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
45+
with:
46+
tag_name: ${{ github.ref }}
47+
release_name: Release ${{ github.ref }}
48+
body: ''
49+
draft: false
50+
prerelease: false
51+
52+
- name: Upload Release Asset
53+
id: upload-release-asset
54+
uses: actions/upload-release-asset@v1
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
with:
58+
upload_url: ${{ steps.create_release.outputs.upload_url }}
59+
asset_path: ./schema.phar
60+
asset_name: schema.phar
61+
asset_content_type: application/x-php

Diff for: .travis.yml

-47
This file was deleted.

0 commit comments

Comments
 (0)