Skip to content

Fix

Fix #324

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@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-rc-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-
- 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 --version
php githooks app:pre-build php
php githooks app:build
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: githooks-${{ matrix.php-versions }}
path: githooks-${{ matrix.php-versions }}.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@v4
- 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: Cache dependencies
uses: actions/cache@v4
with:
path: |
/home/runner/.cache/composer/files
key: ${{ runner.os }}-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-
# Install dependencies for run phpunit
- 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: Display structure of downloaded files
run: ls -R githooks-7.1
- name: Extract and check build
run: php githooks app:extract-build
# - name: Extract and check builds 7.2
# if: ${{ '7.2' == matrix.php-versions }}
# run: |
# rm builds/php7.1/githooks
# git status
# ls -lah
# tar -xvf githooks-7.1/githooks-7.1.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 -xvf githooks-7.3/githooks-7.3.tar
# builds/php7.3/githooks --version
# - name: Extract and check builds 8.3
# if: ${{ '8.3' == matrix.php-versions }}
# run: |
# rm builds/githooks
# tar -xvf githooks-8.1/githooks-8.1.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@v4
- name: Delete Old Builds
run: rm builds/githooks builds/php7.1/githooks builds/php7.3/githooks
- 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 -xvf githooks-71.tar
tar -xvf githooks-73.tar
tar -xvf githooks-81.tar
ls -lah builds
git status
- name: Get Time
id: time
uses: nanzm/get-time-action@v1.1
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/git-commit-push@v1.3
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