Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First pass at adding github actions. #123

Merged
merged 20 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
70 changes: 70 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Acquia Cli Deploy

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.3']
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl
ini-values: post_max_size=256M, short_open_tag=On

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-versions }}-

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-source --no-progress --no-suggest --no-interaction

- name: Install Phar tools and build deployment artefact.
run: |
composer phar:install-tools
rm -rf vendor/*
composer install --prefer-dist --no-dev --no-interaction
composer phar:build

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./acquiacli.phar
asset_name: acquiacli.phar
asset_content_type: application/octet-stream
90 changes: 90 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Acquia Cli Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, macos-latest, windows-latest]
php-versions: ['7.3', '7.4']
name: PHP ${{ matrix.php-versions }} build and test on ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl
ini-values: post_max_size=256M, short_open_tag=On


- name: Setup PHP with pecl extension
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: pecl
extensions: pcov

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-versions }}-

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-source --no-progress --no-suggest --no-interaction

- name: Setup PCOV
run: |
composer require pcov/clobber
vendor/bin/pcov clobber

- name: Run test suite
run: composer run-script test

- name: Remove requirement for pcov/clobber
run: composer remove pcov/clobber

- name: Install Phar tools and build deployment artefact.
run: |
composer phar:install-tools
composer install --prefer-dist --no-dev --no-interaction
composer phar:build

- name: Run the phar
run: php acquiacli.phar

- name: Upload artefact
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-php-${{ matrix.php-versions }}-acquiacli.phar
path: acquiacli.phar
if-no-files-found: error

- name: Upload code coverage
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-php-${{ matrix.php-versions }}-phpunit.html
path: ./tests/logs/phpunit.html

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./tests/logs/clover.xml
name: acquia-cli-codecov
fail_ci_if_error: true%
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Build Status](https://travis-ci.org/typhonius/acquia_cli.svg?branch=master)](https://travis-ci.org/typhonius/acquia_cli)
![Acquia Cli Test](https://github.com/typhonius/acquia_cli/workflows/Acquia%20Cli%20Test/badge.svg)
[![Total Downloads](https://poser.pugx.org/typhonius/acquia_cli/downloads.png)](https://packagist.org/packages/typhonius/acquia_cli)
[![Coverage Status](https://coveralls.io/repos/github/typhonius/acquia_cli/badge.svg?branch=master)](https://coveralls.io/github/typhonius/acquia_cli?branch=master)
[![Coverage Status](https://codecov.io/gh/typhonius/acquia_cli/branch/master/graph/badge.svg)](https://codecov.io/gh/typhonius/acquia_cli)

[![License](https://poser.pugx.org/typhonius/acquia_cli/license.png)]()
[![Latest Stable Version](https://poser.pugx.org/typhonius/acquia_cli/v/stable.png)](https://packagist.org/packages/typhonius/acquia_cli)
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
"curl -L https://github.com/humbug/box/releases/download/3.8.4/box.phar -o tools/box",
"chmod +x tools/box"
],
"phar:build": "env PATH=tools:$PATH box compile",
"phar:build": "php tools/box compile",
"lint": [
"find src -name '*.php' -print0 | xargs -0 -n1 php -l",
"find tests -name '*.php' -print0 | xargs -0 -n1 php -l"
],
"cs": "phpcs --standard=PSR12 -n src tests",
"cs": "phpcs --standard=PSR12 -n src tests --ignore=./tests/logs/*",
"cbf": "phpcbf --standard=PSR2 -n src tests",
"unit": "phpunit --colors=always --coverage-clover ./tests/logs/clover.xml",
"unit": "php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude='~vendor~' ./vendor/bin/phpunit --configuration=phpunit.xml --testdox",
"stan": "phpstan analyse --level 7 src tests",
"test": [
"@lint",
Expand Down
13 changes: 11 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php">
<phpunit
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
verbose="true"
>
<testsuites>
<testsuite name="Acquia CLI">
<directory suffix=".php">./tests/</directory>
Expand All @@ -11,7 +18,9 @@
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="tests/logs/clover.xml"/>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/>
<log type="coverage-clover" target="tests/logs/clover.xml" showUncoveredFiles="true"/>
<log type="coverage-html" target="tests/logs/phpunit.html" lowUpperBound="35" highLowerBound="70"/>
</logging>
<php>
<const name="PHPUNIT_ACQUIACLI_TESTSUITE" value="true"/>
Expand Down