Skip to content

Commit

Permalink
update github workflow files
Browse files Browse the repository at this point in the history
  • Loading branch information
midahp committed Nov 7, 2024
1 parent df60c39 commit c19076a
Show file tree
Hide file tree
Showing 5 changed files with 331 additions and 10 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ on:
push:
branches:
- master
- main
- maintaina-composerfixed
- FRAMEWORK_6_0
pull_request:
branches:
- master
- main
- maintaina-composerfixed
- FRAMEWORK_6_0


Expand All @@ -29,29 +29,31 @@ jobs:
operating-system: ['ubuntu-20.04']
php-versions: ['7.4', '8.0', 'latest']
phpunit-versions: ['latest', '9.5']
exclude:
- php-versions: '7.4'
phpunit-versions: 'latest'
- php-versions: '8.0'
phpunit-versions: 'latest'
steps:
- name: Setup github ssh key
run: mkdir -p ~/.ssh/ && ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: bcmath, ctype, curl, dom, gd, gettext, iconv, imagick, json, ldap, mbstring, mysql, opcache, openssl, pcntl, pdo, posix, redis, soap, sockets, sqlite, tokenizer, xmlwriter
ini-values: post_max_size=512M, max_execution_time=360
coverage: xdebug
tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}, composer:v2, phpstan
tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}, composer:v2
- name: Setup Github Token as composer credential
run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: Install horde/test dependency and other dependencies
run: |
## For unclear reasons, github action fails randomly if we do not install before we require.
COMPOSER_ROOT_VERSION=dev-FRAMEWORK_6_0 composer config minimum-stability dev
COMPOSER_ROOT_VERSION=dev-FRAMEWORK_6_0 composer install
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: run phpunit
run: phpunit --bootstrap test/bootstrap.php
- name: run phpstan
run: phpstan analyze src/ --level 8
5 changes: 3 additions & 2 deletions .github/workflows/phpdoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: '8.1'
extensions: bcmath, ctype, curl, dom, gd, gettext, iconv, imagick, json, ldap, mbstring, mysql, opcache, openssl, pcntl, pdo, posix, redis, soap, sockets, sqlite, tokenizer, xmlwriter
ini-values: post_max_size=512M, max_execution_time=360
coverage: xdebug
Expand All @@ -60,7 +60,8 @@ jobs:
echo "Creating UUT related dir in docu repo"
mkdir -p $UUT_DIR/phpdoc-git/${GITHUB_REF##*/}/${REPO}/
## Look into any of lib, src, app (if they exist) but not test, migration, bin, locale or script dirs
$BIN_DIR/phpdocumentor -d $UUT_DIR/lib/ -d $UUT_DIR/src/ -d $UUT_DIR/app/ -t "${UUT_DIR}/phpdoc-git/${GITHUB_REF##*/}/${REPO}/"
cd $UUT_DIR
$BIN_DIR/phpdocumentor -d lib/ -d src/ -d app/ -t "phpdoc-git/${GITHUB_REF##*/}/${REPO}/"
cd ${UUT_DIR}/phpdoc-git
git add "${GITHUB_REF##*/}/${REPO}"
php indexer.php ${GITHUB_REF##*/} $REPO
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
name: make release

# manual workflow to make a new release for the default branch
on:
workflow_dispatch:
branches:
- FRAMEWORK_6_0
env:
components: "/home/runner/.composer/web/components/bin/horde-components -c /home/runner/.composer/web/components/config/maintaina.conf.dist"
COMPOSER_ALLOW_SUPERUSER: 1

jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: ['ubuntu-20.04']
php-versions: ['8.1']
steps:
- name: Setup git
run: |
mkdir -p ~/.ssh/ && ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts
git config --global user.name "Github CI Runner"
git config --global user.email "[email protected]"
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: gettext
ini-values: post_max_size=512M, max_execution_time=360
tools: composer:v2
- name: Setup composer
run: |
composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer global config repositories.0 composer https://horde-satis.maintaina.com
composer global config minimum-stability dev
composer config --no-plugins --global allow-plugins.horde/horde-installer-plugin true
composer global require horde/horde-installer-plugin "2.3.0"
composer global require horde/components "dev-FRAMEWORK_6_0"
- name: write changelog
run: |
entries_amount=0; max_entries=100
PATTERN="^\[.*\] .*"
for commit in $(git rev-list FRAMEWORK_6_0)
do
msg=$(git log --format=%B -n 1 $commit | head -n 1)
if [ $entries_amount -gt $max_entries ]; then break; fi
if [[ $msg == 'Released'* ]]; then break; fi
if [[ $msg == 'Development mode for'* ]]; then break; fi
if [[ $msg =~ $PATTERN ]]; then
$components changed "$msg"
let "entries_amount+=1"
fi
done
- name: make release and push
run: |
$components release for maintaina
git push
git push origin --tags
2 changes: 1 addition & 1 deletion .github/workflows/update-satis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: '8.2'
extensions: bcmath, ctype, curl, dom, gd, gettext, iconv, imagick, json, ldap, mbstring, mysql, opcache, openssl, pcntl, pdo, posix, redis, soap, sockets, sqlite, tokenizer, xmlwriter
ini-values: post_max_size=512M, max_execution_time=3600
coverage: xdebug
Expand Down
253 changes: 253 additions & 0 deletions doc/components.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
<?php
/*
* Horde Components Configuration File
*
* This file contains the configuration settings for the Horde components
* helper.
*
* Strings should be enclosed in 'quotes'.
* Integers should be given literally (without quotes).
* Boolean values may be true or false (never quotes).
*
* PHP Version 7
*/

/* PEAR server name. Only change for testing purposes. */
$conf['releaseserver'] = 'pear.horde.org';

/* PEAR server directory. Only change for testing purposes. */
$conf['releasedir'] = '/horde/web/pear.horde.org';

/* Username for horde.org.
* Make sure you belong to the "horde" group there. */
$conf['horde_user'] = '';

/* Needed to update the Whups versions */
$conf['horde_pass'] = '';

/* From: address for announcements. */
$conf['from'] = 'Full name <[email protected]>';

/* Path to a checkout of the horde-web repository. */
$conf['web_dir'] = '/var/www/horde-web';

/**
* Vendor: Used by the composer, packagist, satis and git-related tasks
* Defaults to 'horde' if unset
*/
// $conf['vendor'] = 'horde';

/**
* Git Repo Base: The base URL for your remote git repo
* Defaults to https://github.com/$vendor if unset
* If you configure this, $vendor will NOT be appended
*/
//$conf['git_repo_base'] = 'https://git.mycompany.com/level/nextlevel/';

/** composer_repo - Type of loader hints to generate
* Default is not to generate any hints. Dependencies will be from packagist
*/
// generate a vcs repo source per horde internal dependency
// $conf['composer_repo'] = 'vcs';
// generate a satis source for all horde namespace
$conf['composer_repo'] = 'satis:https://horde-satis.maintaina.com';

/**
* composer_version - tweak all dependency versions
* to a common branch name or version
* This is used by the horde-components composer command and
* the composer release task unless overwritten there
*
* Default: Depend on versions from .horde.yml
*/
// depend on master branch
// $conf['composer_version'] = 'dev-master';
// depend on a staging branch - components won't check if it even exists!
$conf['composer_version'] = 'dev-FRAMEWORK_6_0';


/* Well known composer native substitutes for pear dependencies */
$conf['composer_opts']['pear-substitutes'] = [
['pear.php.net/Archive_Tar' =>
['source' => 'Packagist', 'name' => 'pear/archive_tar']],
['pear.php.net/Console_Color2' =>
['source' => 'Packagist', 'name' => 'pear/console_color2']],
['pear.php.net/Net_DNS2' =>
['source' => 'Packagist', 'name' => 'pear/net_dns2']],
['pear.php.net/Console_Table' =>
['source' => 'Packagist', 'name' => 'pear/console_table']],
['pear.php.net/PHP_CodeSniffer' =>
['source' => 'Packagist', 'name' => 'squizlabs/php_codesniffer']],
['pear.phpunit.de/phpcpd' => ['source' => 'Packagist', 'name' => 'sebastian/phpcpd']],
['pear.phpunit.de/phpdcd' => ['source' => 'Packagist', 'name' => 'sebastian/phpdcd']],
['pear.phpunit.de/phploc' => ['source' => 'Packagist', 'name' => 'phploc/phploc']]
];

/**
* Configure release pipelines
*/

/**
* Upstream pipeline
*
* Usage: horde-components path/to/component release for upstream
*
* The upstream pipeline is similar to the original pipeline
*
* Added Steps:
* - checkout of the correct branch, prevent accidental release from master
* - writing an updated composer file
* - Pushing to github
* - Notifying to Packagist
*
* Removed Steps:
* - None
*
*/
$conf['pipeline']['release']['upstream'] = [
// Checkout the FRAMEWORK_5_2 branch, don't accidentally release master
['name' => 'GitBranch', 'options' => [
'git_branch' => 'FRAMEWORK_5_2',
'git_branch_prereq' => false
]
],
['name' => 'Unit'],
['name' => 'Changelog'],
['name' => 'Timestamp'],
['name' => 'CurrentSentinel'],
// By default, upload to Pirum server after generating
['name' => 'Package', 'options' => ['upload' => 'true']],

// The composer task will use global options like composer_opts,
// composer_version, composer_repo unless explicitly overwritten here
['name' => 'Composer'],
['name' => 'CommitPreRelease'],
['name' => 'TagRelease'],
['name' => 'Announce'],
['name' => 'Website'],
['name' => 'Bugs'],
['name' => 'NextVersion'],
['name' => 'CommitPostRelease'],
['name' => 'GitPush'],
// Nudge Packagist that we have an update
// Requires API key. Does not work for new packages not yet registered.
['name' => 'Packagist', 'options' => [
'packagist_api_key' => '',
'packagist_user' => 'horde',
'vendor' => 'horde'
]
]
// Optional: A local Satis installation satis.horde.org
// satis_bin: path to satis cli
// satis_json: path to satis json file
// satis_outdir: path where satis should write the repository
// satis_push: If the output dir is a git checkout, try to commit and push?
/* ['name' => 'Satis', 'options' => [
'satis_bin' => '',
'satis_json' => '',
'satis_outdir' => '',
'satis_push' => true
]
]*/
];

/**
* Downstream pipeline
*
* Usage: horde-components path/to/component release for downstream
*
* The downstream pipeline is for developing horde based code in your own lab
*
* Added Steps:
* - checkout of the correct branch, prevent accidental release from master
* - writing an updated composer file
* - Pushing to github
* - Writing to a satis repository
*
* Removed Steps:
* - Package/Upload (Pear)
* - Announce
* - Website
* - Bugs
*
*/
$conf['pipeline']['release']['downstream'] = [
// Ensure we create release from the staging branch. Break if not.
['name' => 'GitBranch', 'options' => [
'git_branch' => 'staging',
'git_branch_prereq' => true
]
],
['name' => 'Unit'],
['name' => 'Changelog'],
['name' => 'Timestamp'],
['name' => 'CurrentSentinel'],
// Pear related steps have been removed
// The composer task will use global options like composer_opts,
// composer_version, composer_repo unless explicitly overwritten here
['name' => 'Composer', 'options' => ['composer_version' => '' ] ],
['name' => 'CommitPreRelease'],
['name' => 'TagRelease'],
// Increase version numbers for development mode
['name' => 'NextVersion'],
// Force our component to require staging branch dependencies
// This is useful for development mode
['name' => 'Composer', 'options' => ['composer_version' => 'dev-FRAMEWORK_6_0']],
['name' => 'CommitPostRelease'],
['name' => 'GitPush'],
// Our downstream pipeline uses satis rather than packagist
// satis_bin: path to satis cli
// satis_json: path to satis json file
// satis_outdir: path where satis should write the repository
// satis_push: If the output dir is a git checkout, try to commit and push?
['name' => 'Satis', 'options' => [
'satis_bin' => '',
'satis_json' => '',
'satis_outdir' => '',
'satis_push' => true
]
]
// TODO: Missing a step to update the release branch from the latest tag
];


/**
* Insys pipeline
*
* Usage: horde-components path/to/component release for insysgui
*
* The insysgui pipeline is for developing horde based code insys apps
*
* Added Steps:
* - checkout of the correct branch, prevent accidental release from master
* - writing an updated composer file
* - Pushing to github
* - Writing to a satis repository
*
* Removed Steps:
* - Package/Upload (Pear)
* - Announce
* - Website
* - Bugs
*
*/
$conf['pipeline']['release']['maintaina'] = [
// Ensure we create release from the master branch. Break if not.
['name' => 'GitBranch', 'options' => [
'git_branch' => 'FRAMEWORK_6_0',
'git_branch_prereq' => true
]
],
// no unit tests for now
// ['name' => 'Unit'],
['name' => 'Changelog'],
['name' => 'Timestamp'],
['name' => 'CurrentSentinel'],
['name' => 'Composer'],
['name' => 'CommitPreRelease'],
['name' => 'TagRelease'],
// Increase version numbers for development mode
['name' => 'NextVersion'],
['name' => 'CommitPostRelease'],
// ['name' => 'GitPush'],
];

0 comments on commit c19076a

Please sign in to comment.