Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #77 from phptal/feature/release-automation
Release automation, migration to github actions
  • Loading branch information
Ocramius committed Mar 27, 2021
2 parents 0ba925f + c0a24a9 commit 7329e01
Show file tree
Hide file tree
Showing 8 changed files with 2,242 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
@@ -1,6 +1,6 @@
/.github export-ignore
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
Makefile export-ignore
phpunit.xml export-ignore
71 changes: 71 additions & 0 deletions .github/workflows/phpunit.yml
@@ -0,0 +1,71 @@
name: "Tests"

on:
pull_request:
push:

jobs:
phpunit:
name: "Tests"

runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
dependencies:
- "lowest"
- "highest"
- "locked"
php-version:
- "7.3"
- "7.4"
- "8.0"
operating-system:
- "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2, cs2pr

- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"

- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest --ignore-platform-req=php"

- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress --no-suggest --ignore-platform-req=php"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress --no-suggest --ignore-platform-req=php"

- name: "Generate Locales"
run: |
sudo locale-gen en_GB
sudo locale-gen en_GB.utf8
sudo locale-gen fr_FR
sudo locale-gen fr_FR@euro
sudo locale-gen fr_FR.utf8
- name: "Tests"
run: "vendor/bin/phpunit"

- name: "Linting"
run: "tools/phptal_lint.php -e html tests/input/phptal*.html"
57 changes: 57 additions & 0 deletions .github/workflows/release-on-milestone-closed.yml
@@ -0,0 +1,57 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Automatic Releases"

on:
milestone:
types:
- "closed"

jobs:
release:
name: "GIT tag, release & create merge-up PR"
runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Release"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:release"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}

- name: "Create Merge-Up Pull Request"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:create-merge-up-pull-request"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}

- name: "Create and/or Switch to new Release Branch"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:switch-default-branch-to-next-minor"
env:
"GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}

- name: "Bump Changelog Version On Originating Release Branch"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:bump-changelog"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
6 changes: 0 additions & 6 deletions .gitignore
@@ -1,10 +1,4 @@
build
/vendor/
/composer.lock
/doc/temp/
/docs/
/tools/phpunit
/tools/jsonlint
/tools/phpdoc
/tools/phpdoc.php
/tools/validate-json
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -3,7 +3,7 @@
all::test docs doc

test::
tools/phpunit
vendor/bin/phpunit

doc::
$(MAKE) $(MFLAGS) -C doc
Expand Down
3 changes: 0 additions & 3 deletions composer.json
Expand Up @@ -32,9 +32,6 @@
"PHPTAL": "classes/"
}
},
"config": {
"bin-dir": "tools"
},
"bin": [
"tools/phptal_lint.php"
]
Expand Down

0 comments on commit 7329e01

Please sign in to comment.