diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0191fa64..f41e32e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,12 +8,12 @@ on: push: branches: - master - - main + - maintaina-composerfixed - FRAMEWORK_6_0 pull_request: branches: - master - - main + - maintaina-composerfixed - FRAMEWORK_6_0 @@ -29,11 +29,17 @@ 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: @@ -41,7 +47,7 @@ jobs: 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 @@ -49,9 +55,5 @@ jobs: ## 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 diff --git a/.github/workflows/phpdoc.yml b/.github/workflows/phpdoc.yml index 365812f5..14eee9d4 100644 --- a/.github/workflows/phpdoc.yml +++ b/.github/workflows/phpdoc.yml @@ -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 @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..ee161f7e --- /dev/null +++ b/.github/workflows/release.yml @@ -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 "ci-job@maintaina.com" + - 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 diff --git a/.github/workflows/update-satis.yml b/.github/workflows/update-satis.yml index 5049bd0e..41e78af3 100644 --- a/.github/workflows/update-satis.yml +++ b/.github/workflows/update-satis.yml @@ -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 diff --git a/doc/components.conf b/doc/components.conf new file mode 100644 index 00000000..53dec12d --- /dev/null +++ b/doc/components.conf @@ -0,0 +1,253 @@ +'; + +/* 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'], +];