Skip to content

Commit

Permalink
Added GHA build step.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Feb 27, 2024
1 parent 3294b75 commit 547e6dd
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/box.json export-ignore
/tests export-ignore
/phpcs.xml export-ignore
/phpmd.xml export-ignore
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/release-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release PHP

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
release-php:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1

- name: Install dependencies
run: composer install

- name: Build PHAR
run: composer build

- name: Test PHAR
run: ./.build/git-artifact || exit 1

- name: Get tag name
id: get-version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
./.build/git-artifact
35 changes: 33 additions & 2 deletions .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,38 @@ jobs:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

build-php:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1

- name: Install dependencies
run: composer install

- name: Build PHAR
run: composer build

- name: Test PHAR
run: ./.build/git-artifact || exit 1
#;> PHP_PHAR

# Demonstration of deployment in 'force-push' mode.
deploy-force-push:
needs: test-php
needs:
- test-php
- build-php

runs-on: ubuntu-latest

Expand Down Expand Up @@ -164,7 +193,9 @@ jobs:
# of the second push. This is because the mode is intended to create a new
# branch per artifact deployment.
deploy-branch:
needs: test-php
needs:
- test-php
- build-php

runs-on: ubuntu-latest

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/cobertura.xml
/composer.lock
/vendor
/vendor-bin
13 changes: 13 additions & 0 deletions box.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"output": ".build/git-artifact",
"compression": "GZ",
"finder": [
{
"in": "./",
"exclude": [
"php-script",
"tests"
]
}
]
}
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"consolidation/robo": "^4"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"escapestudios/symfony2-coding-standard": "^3",
"phpmd/phpmd": "^2.15",
Expand All @@ -39,6 +40,7 @@
},
"config": {
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
Expand Down

0 comments on commit 547e6dd

Please sign in to comment.