Skip to content

Commit f0884ad

Browse files
committed
Use Github actions instead of Travis CI (api-platform#278)
1 parent 8f61d20 commit f0884ad

File tree

4 files changed

+122
-48
lines changed

4 files changed

+122
-48
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
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]

.github/workflows/ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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
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: Install code coverage
55+
run: composer require --dev --no-update 'phpunit/php-code-coverage:^9.2'
56+
if: matrix.php_version == '8.0'
57+
58+
- name: Install project for PHP 8.0
59+
run: composer install --prefer-dist --no-progress --no-suggest --ansi
60+
if: matrix.php_version == '8.0'
61+
62+
- name: Run phpunit
63+
run: vendor/bin/simple-phpunit
64+
65+
- name: Run php-cs-fixer
66+
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr
67+
68+
- name: Run phpstan
69+
run: |
70+
vendor/bin/phpstan analyse
71+
72+
- name: Run e2e tests
73+
run: |
74+
php bin/compile

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
on:
2+
release:
3+
types:
4+
- published
5+
6+
name: Upload Release Asset
7+
8+
jobs:
9+
build:
10+
name: Upload Release Asset
11+
runs-on: ubuntu-latest
12+
env:
13+
extensions: json
14+
composer_version: 2
15+
php_version: '8.0'
16+
outputs:
17+
upload_url: ${{ steps.step_upload_url.outputs.upload_url }}
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v2
21+
22+
- name: Setup PHP with extensions
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: ${{ env.php_version }}
26+
extensions: ${{ env.extensions }}
27+
ini-values: memory_limit=-1
28+
tools: composer:v2
29+
30+
- name: Download box.phar
31+
run: |
32+
wget -O box.phar https://github.com/humbug/box/releases/download/3.11.1/box.phar
33+
export BOX_BIN=$(pwd)/box.phar
34+
35+
- name: Compile project
36+
run: php ./box.phar compile;
37+
38+
- name: Upload Release Asset
39+
id: upload-release-asset
40+
uses: actions/upload-release-asset@v1
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
with:
44+
upload_url: ${{ github.event.release.upload_url }}
45+
asset_path: ./schema.phar
46+
asset_name: schema.phar
47+
asset_content_type: application/x-php

.travis.yml

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

0 commit comments

Comments
 (0)