Skip to content

Fix

Fix #280

Workflow file for this run

name: Release
# https://github.com/shivammathur/setup-php
on:
push:
branches: [ rc** ]
pull_request:
branches-ignore: [ master ]
jobs:
build_rc:
name: Build php ${{ matrix.php-versions }} version
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.1', '7.3', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Install dependencies
run: |
chmod -R +x tools/*
tools/composer install --prefer-dist --no-progress
- name: Install Humbug/Box
run: tools/composer global require humbug/box
- name: Build the Aplication
run: |
php githooks app:pre-build
branch=${GITHUB_REF##*/}
echo ${branch}
prefix='rc-'
version=${branch#"$prefix"}
echo $version
php githooks app:build --build-version=${version}
# - name: Tar files to keep permissions
# run: |
# ls -lah builds/githooks builds/php7.1/githooks
# tar -cvf githooks-71.tar builds/php7.1/githooks
# tar -cvf githooks-73.tar builds/php7.3/githooks
# tar -cvf githooks-81.tar builds/githooks
# # ls -lah builds/githooks builds/php7.1/githooks
- name: Tar files to keep permissions 7.1
if: ${{ '7.1' == matrix.php-versions }}
run: tar -cvf githooks-71.tar builds/php7.1/githooks
- name: Tar files to keep permissions 7.3
if: ${{ '7.3' == matrix.php-versions }}
run: tar -cvf githooks-73.tar builds/php7.3/githooks
- name: Tar files to keep permissions 8.1
if: ${{ '8.1' == matrix.php-versions }}
run: tar -cvf githooks-81.tar builds/githooks
- name: Upload php 7.1 build
uses: actions/upload-artifact@v4
if: ${{ '7.1' == matrix.php-versions }}
with:
name: githooks-71
path: githooks-71.tar
- name: Upload php 7.3 build
uses: actions/upload-artifact@v4
if: ${{ '7.3' == matrix.php-versions }}
with:
name: githooks-73
path: githooks-73.tar
- name: Upload php 8.1 build
uses: actions/upload-artifact@v4
if: ${{ '8.1' == matrix.php-versions }}
with:
name: githooks-81
path: githooks-81.tar
test_rc:
name: Test the Build in php ${{ matrix.php-versions }}
runs-on: ${{ matrix.operating-system }}
needs: build_rc
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.2', '8.0', '8.3']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpcs, phpcbf, phpmd, phpstan, parallel-Lint, phpcpd
coverage: none
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer install --prefer-dist --no-progress
chmod -R +x tools/*
- uses: actions/download-artifact@v4
with:
path: ${{ github.GITHUB_WORKSPACE }}
- name: Extract and check builds 7.2
if: ${{ '7.2' == matrix.php-versions }}
run: |
rm builds/php7.1/githooks
tar -xf githooks-71/githooks-71.tar
builds/php7.1/githooks --version
- name: Extract and check builds 8.0
if: ${{ '8.0' == matrix.php-versions }}
run: |
rm builds/php7.3/githooks
tar -xf githooks-73/githooks-73.tar
builds/php7.3/githooks --version
- name: Extract and check builds 8.3
if: ${{ '8.3' == matrix.php-versions }}
run: |
rm builds/githooks
tar -xf githooks-81/githooks-81.tar
builds/githooks --version
git status
- name: Testing the Aplication
run: |
echo -e "\e[42m\e[30m**** Release Test Suite ****\033[0m"
vendor/bin/phpunit --group release
shell: bash
commit_rc:
name: Commit the Build
needs: test_rc
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Delete Old Builds
run: rm builds/githooks builds/php7.1/githooks && echo ${{ secrets.PAT_TOKEN_TO_COMMIT }}
- uses: actions/download-artifact@v4
with:
name: githooks-71
- uses: actions/download-artifact@v4
with:
name: githooks-73
- uses: actions/download-artifact@v4
with:
name: githooks-81
- name: Extract and check builds
run: |
tar -xf githooks-71.tar
tar -xf githooks-73.tar
tar -xf githooks-81.tar
ls -lah builds
git status
- name: Get Time
id: time
uses: nanzm/[email protected]
with:
timeZone: 1
format: 'DD-MM-YYYY HH:mm:ss'
- name: Extract version
id: version_id
run: |
branch=${GITHUB_REF##*/}
echo ${branch}
prefix='rc-'
version=${branch#"$prefix"}
echo $version
echo "::set-output name=version::${version}"
- name: Check Version
run: echo ${{ steps.version_id.outputs.version }} && echo ${{ steps.time.outputs.time }}
- uses: GuillaumeFalourd/[email protected]
with:
files: builds/githooks builds/php7.1/githooks builds/php7.3/githooks
commit_message: 'Release Candidate: ${{ steps.version_id.outputs.version }} - Build: ${{ steps.time.outputs.time }}'
- name: Check the commit
run: git log