Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved back installer into the project. #1393

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 63 additions & 4 deletions .github/workflows/vortex-release-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- '*'
branches:
- '**release-docs**'
- '**release-installer**'

permissions:
contents: read
Expand All @@ -18,7 +19,55 @@ concurrency:
cancel-in-progress: true

jobs:
release-docs:

vortex-release-installer:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false

- 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
working-directory: .vortex/installer

- name: Add version
run: |
TAG=${{ github.ref_type == 'tag' && github.ref_name || '' }}
SHA=${{ github.ref_type == 'branch' && github.sha || '' }}
sed -i "s/\"git-tag-ci\": \"dev\"/\"git-tag-ci\": \"${TAG:-${SHA}}\"/g" box.json
working-directory: .vortex/installer

- name: Build PHAR
run: composer build
working-directory: .vortex/installer

- name: Test PHAR
run: ./build/installer --quiet || exit 1
working-directory: .vortex/installer

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: vortex-installer
path: .vortex/installer/build/installer

vortex-release-docs:
needs: vortex-release-installer

environment:
name: github-pages

Expand All @@ -40,20 +89,30 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2

- name: Download installer
uses: actions/download-artifact@v2
with:
name: vortex-installer

- name: Copy installer to docs
run: |
cp ../installer ../.vortex/docs/static/install
php ../.vortex/docs/static/install --version

- name: Check docs up-to-date
run: |
composer --working-dir=.utils install
npm run update-variables
git diff --quiet HEAD || { echo "Docs not up-to-date. Run 'cd .vortex && ahoy update-docs' and commit changes."; git diff; exit 1; }
working-directory: '${{ github.workspace }}/.vortex/docs'
working-directory: .vortex/docs

- name: Install dependencies
run: npm install
working-directory: '${{ github.workspace }}/.vortex/docs'
working-directory: .vortex/docs

- name: Build documentation site
run: npm run build
working-directory: '${{ github.workspace }}/.vortex/docs'
working-directory: .vortex/docs

- name: Upload documentation site
uses: actions/upload-pages-artifact@v3
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/vortex-test-installer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This action is used for Vortex maintenance. It will not be used in the scaffolded project.
name: Vortex - Test installer

on:
push:
branches:
- main
pull_request:
branches:
- main
- 'feature/**'

jobs:
vortex-test-installer:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- name: Install dependencies
run: composer install
working-directory: .vortex/installer

- name: Check coding standards
run: composer lint
working-directory: .vortex/installer

- name: Run tests
run: XDEBUG_MODE=coverage composer test
working-directory: .vortex/installer

- name: Upload coverage report as an artifact
uses: actions/upload-artifact@v4
with:
name: ${{github.job}}-code-coverage-report-${{ matrix.php-versions }}
path: .vortex/installer/.coverage-html

- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v4
with:
files: .vortex/installer/cobertura.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

# Smoke test for PHAR.
- name: Build PHAR
run: composer build
working-directory: .vortex/installer

- name: Test PHAR
run: .vortex/installer/build/installer --quiet || exit 1
5 changes: 3 additions & 2 deletions .vortex/.ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ commands:
install:
name: Install test dependencies.
cmd: |
[ ! -d ./docs/node_modules ] && npm --prefix tests ci
[ ! -d ./tests/node_modules ] && npm --prefix tests ci
[ ! -d ./docs/node_modules ] && npm --prefix docs ci
[ ! -d ./installer/node_modules ] && composer --working-dir installer install

docs:
name: Start documentation server.
Expand Down Expand Up @@ -48,7 +49,7 @@ commands:

test-bats:
cmd: |
[ ! -d tests/node_modules ] && ahoy install
[ ! -d tests/node_modules ] && npm --prefix tests ci
tests/node_modules/.bin/bats "$@"

test-common:
Expand Down
2 changes: 1 addition & 1 deletion .vortex/docs/content/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Refer to [Features](getting-started/features.mdx) for more details.
## Quick start

```bash
curl -SsL https://install.drevops.com > install.php && php install.php
curl -SsL https://vortex.drevops.com/install > install.php && php install.php
```

Refer to [Installation](getting-started/installation.mdx) for more details.
Expand Down
2 changes: 1 addition & 1 deletion .vortex/docs/content/getting-started/features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The following list includes ✅ completed and 🚧 upcoming features.
* ✅ Functional test coverage for workflows
* ✅ Integration test coverage for deployments
* ✅ Vortex updates
* ✅ [Basic installer](https://install.drevops.com/)
* ✅ [Basic installer](https://vortex.drevops.com/install)
* 🚧 Advanced installer CLI UI
* 🚧 Advances installer Web UI
* 🚧 Automated project setup
Expand Down
4 changes: 2 additions & 2 deletions .vortex/docs/content/getting-started/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ for each service.

2. Run the following command to install the **Vortex** template.
```shell title="Install using interactive prompts"
curl -SsL https://install.drevops.com > install.php && php install.php
curl -SsL https://vortex.drevops.com/install > install.php && php install.php
```

3. Run the following command to initialize Git repository and commit the initial
Expand Down Expand Up @@ -51,7 +51,7 @@ your existing project into the new one.

4. Run the following command to install the **Vortex** template.
```shell title="Install using interactive prompts"
curl -SsL https://install.drevops.com > install.php && php install.php
curl -SsL https://vortex.drevops.com/install > install.php && php install.php
```

5. Commit the changes to the new branch.
Expand Down
2 changes: 1 addition & 1 deletion .vortex/docs/content/workflows/variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ Defined in: `scripts/vortex/github-labels.sh`

The URL of the installer script.

Default value: `https://install.drevops.com`
Default value: `https://vortex.drevops.com/install`

Defined in: `scripts/vortex/update-vortex.sh`

Expand Down
7 changes: 7 additions & 0 deletions .vortex/installer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/build
/.coverage-html
/.phpunit.cache
/cobertura.xml
/composer.lock
/vendor
/vendor-bin
13 changes: 13 additions & 0 deletions .vortex/installer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Vortex installer

## Maintenance

composer install
composer lint
composer test

### Releasing

The installer is packaged as a PHAR and deployed to https://vortex.drevops.com/install
upon each GitHub release or for every branch to a branch containing the
`release-docs` or `release-installer` in the name.
32 changes: 32 additions & 0 deletions .vortex/installer/box.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"output": "build/installer",
"banner": [
"@file",
"Vortex CLI installer.",
"",
"<!-- -->",
"CLI installer for <a href=\"https://github.com/drevops/vortex\">Vortex</a> project.<br/>",
"Run in your terminal:<br/>",
"<code>curl -SsL https://vortex.drevops.com/install > install.php && php install.php</code><br/>",
"More details: <a href=\"https://vortex.drevops.com\">https://vortex.drevops.com</a>",
"<!--"
],
"finder": [
{
"in": "./",
"exclude": [
"tests",
"vendor-bin"
]
}
],
"blacklist": [
"box.json",
"phpcs.xml",
"phpmd.xml",
"phpstan.neon"
],
"replacements": {
"git-tag-ci": "dev"
}
}
74 changes: 74 additions & 0 deletions .vortex/installer/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "drevops/vortex-installer",
"type": "library",
"description": "Installer for Vortex.",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Alex Skrypnyk",
"email": "[email protected]",
"homepage": "https://www.drevops.com",
"role": "Maintainer"
}
],
"homepage": "https://github.com/drevops/vortex-installer",
"support": {
"issues": "https://github.com/drevops/vortex-installer/issues",
"source": "https://github.com/drevops/vortex-installer"
},
"require": {
"php": ">=8.1",
"symfony/console": "^6.3 || ^7"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8",
"dealerdirect/phpcodesniffer-composer-installer": "^1",
"drupal/coder": "^8.3",
"mikey179/vfsstream": "^1.6",
"opis/closure": "^3.6",
"phpmd/phpmd": "^2.13",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10",
"rector/rector": "^1.0.0"
},
"autoload": {
"psr-4": {
"DrevOps\\Installer\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"DrevOps\\Installer\\Tests\\": "tests/phpunit"
},
"classmap": [
"tests/phpunit"
]
},
"config": {
"sort-packages": true,
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"lint": [
"phpcs",
"phpstan",
"rector --clear-cache --dry-run"
],
"lint-fix": [
"rector --clear-cache",
"phpcbf"
],
"test": "if [ \"${XDEBUG_MODE}\" = 'coverage' ]; then phpunit; else phpunit --no-coverage; fi",
"build": [
"@composer bin box require --dev humbug/box",
"box validate",
"box compile"
]
},
"bin": [
"install"
]
}
12 changes: 12 additions & 0 deletions .vortex/installer/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env php
<?php

foreach ([$GLOBALS['_composer_autoload_path'] ?? NULL, __DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php'] as $file) {
if ($file && file_exists($file)) {
require_once $file;
unset($file);
break;
}
}

require __DIR__ . '/src/app.php';
Loading
Loading