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

[WIP] Homebrew integration #1055

Open
wants to merge 15 commits into
base: 3.x
Choose a base branch
from
Open
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
26 changes: 26 additions & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
push:
branches:
- main
name: Create release on merge with Main
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First Change
- Second Change
draft: true
prerelease: true
35 changes: 35 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
on:
pull_request:
branches:
- main
- 3.x
name: Build Phar on Pull Request CI
jobs:
checkout_build:
runs-on: ubuntu-latest
container:
image: quay.io/pantheon-public/php-ci:v7.4
name: Checkout & build Phar
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Save repo content as artifact
uses: actions/upload-artifact@v2
with:
name: full-workspace
path: ${{ github.workspace }}
retention-days: 5
- name: Full Composer Install
run: composer install
- name: Validate Code
run: composer code:lint
- name: Phar Build
run: composer phar:build
- name: permissions
run: chmod +x ./robo
- name: Save robo.phar as artifact
uses: actions/upload-artifact@v2
with:
name: robo-phar
path: robo
if-no-files-found: error
127 changes: 60 additions & 67 deletions .github/workflows/ci.yml → .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,56 @@
# From https://github.com/sebastianbergmann/phpunit/blob/20ab19d3aed56fccf9569cd33c6cd0baab0ec272/.github/workflows/ci.yml
# (With many modifications)

on:
pull_request:
branches:
- 3.x
push:
branches:
branches: # Add development branches here
- 3.x
- homebrew-integration

name: CI

name: Unit Testing CI on Push to development branches
jobs:
checkout_build:
runs-on: ubuntu-latest
container:
image: quay.io/pantheon-public/php-ci:v7.4
name: Checkout & build Phar
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Full Composer Install
run: composer install
- name: Phar Build
run: composer phar:build
- name: permissions
run: chmod +x ./robo
- name: Save repo content as artifact
uses: actions/upload-artifact@v2
with:
name: full-workspace
path: ${{ github.workspace }}
- name: permissions
run: chmod +x ./robo
- name: Save robo.phar as artifact
uses: actions/upload-artifact@v2
with:
name: robo-phar
path: robo
if-no-files-found: error
retention-days: 5

coding-guidelines:
name: Coding Guidelines

runs-on: ubuntu-latest

needs:
- checkout_build
steps:
- name: Checkout
uses: actions/checkout@v2

with:
fetch-depth: 0
- name: Get artifact
uses: actions/download-artifact@v2
with:
name: robo-phar
- name: permissions
run: chmod +x ./robo
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -31,16 +61,16 @@ jobs:
run: composer install --no-ansi --no-interaction --no-progress

- name: Run phpcs
run: composer cs
run: composer code:cs

- name: Run linter
run: composer lint
run: composer code:lint

backward-compatibility:
name: Backward Compatibility

runs-on: ubuntu-latest

needs:
- checkout_build
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -67,9 +97,9 @@ jobs:

tests:
name: Tests

runs-on: ${{ matrix.os }}

needs:
- checkout_build
env:
PHP_EXTENSIONS: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter

Expand All @@ -89,22 +119,24 @@ jobs:
- locked

include:
- os: ubuntu-latest
php-version: "7.1"
dependencies: lowest

- os: ubuntu-latest
php-version: "7.4"
dependencies: highest

- os: ubuntu-latest
php-version: "8.0"
dependencies: highest
php-ini-values: assert.exception=1, zend.assertions=1, opcache.enable=1, opcache.enable_cli=1, opcache.optimization_level=-1, opcache.jit_buffer_size=4096M, opcache.jit=1205

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get artifact
uses: actions/download-artifact@v2
with:
name: robo-phar

- name: permissions
run: chmod +x ./robo

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
Expand All @@ -113,46 +145,7 @@ jobs:
coverage: pcov
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ matrix.php-ini-values }}

- name: Determine composer cache directory on Linux
if: matrix.os == 'ubuntu-latest'
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Determine composer cache directory on Windows
if: matrix.os == 'windows-latest'
run: Add-Content -Path $ENV:GITHUB_ENV -Value "COMPOSER_CACHE_DIR=~\AppData\Local\Composer"

- name: Cache dependencies installed with composer
uses: actions/cache@v1
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-

- name: Make sure composer.json is valid before we start modifyig it
run: composer validate

- name: Clear platform php configuration in case we need to update phpunit
run: composer config --unset platform.php

- name: Update phpunit if dependencies are locked in case phpunit version in lock file is not compatible
if: matrix.dependencies == 'locked'
run: |
composer install --no-ansi --no-interaction --no-progress
composer update --no-ansi --no-interaction --no-progress phpunit/phpunit --with-all-dependencies

- name: Install lowest dependencies with composer
if: matrix.dependencies == 'lowest'
run: composer update --no-ansi --no-interaction --no-progress --prefer-lowest

- name: Install highest dependencies with composer
if: matrix.dependencies == 'highest'
run: composer update --no-ansi --no-interaction --no-progress

- name: Make sure everything is still installed
run: composer install
- name: Run tests with phpunit
run: composer unit

- name: Publish code coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.php-version == '8.0'
run: bash <(curl -s https://codecov.io/bash)
run: composer code:unit
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
release:
branches:
- main
name: Update Homebrew on Release
jobs:
package_macos:
runs-on: macos-latest
name: Package a Homebrew release
steps:
- name: Bump Homebrew formula
uses: dawidd6/action-homebrew-bump-formula@v3
with:
token: ${{secrets.HOMEBREW_GITHUB_API_TOKEN}}
tap: consolidated/external
tag: ${{github.ref}}
revision: ${{github.sha}}
formula: robo
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ tests/_log/*
tests/_helpers/_generated/*
*.phar
.phpunit.result.cache
.DS_Store
/robo
File renamed without changes.
Loading