Skip to content

Commit

Permalink
Moved back installer into the project.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Sep 1, 2024
1 parent 94a3b25 commit 6c28602
Show file tree
Hide file tree
Showing 51 changed files with 3,962 additions and 30 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/vortex-release-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
- '*'
branches:
- '**release-docs**'
workflow_run:
workflows:
- 'Vortex - Release installer'
types:
- completed

permissions:
contents: read
Expand Down Expand Up @@ -40,6 +45,16 @@ 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: |
copy vortex-installer/installer .vortex/docs/static/installer
php .vortex/docs/static/installer --version
- name: Check docs up-to-date
run: |
composer --working-dir=.utils install
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/vortex-release-installer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This action is used for Vortex maintenance. It will not be used in the scaffolded project.
name: Vortex - Release installer

on:
push:
tags:
- '*'
branches:
- '**release-installer**'

jobs:
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

- 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
- name: Build PHAR
run: composer build

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

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: vortex-installer
path: .build/installer
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

Check failure on line 46 in .github/workflows/vortex-test-installer.yml

View workflow job for this annotation

GitHub Actions / vortex-test-actions

46:17 [colons] too many spaces after colon

- 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
78 changes: 78 additions & 0 deletions .vortex/installer/.github/workflows/release-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Release PHP

on:
push:
tags:
- '*'

jobs:
release-php:
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

- 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
- name: Build PHAR
run: composer build

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

- name: Prepare publish artifact
run: |
mkdir -p /tmp/installer/docs
cp .build/installer /tmp/installer/docs/index.html
echo "install.drevops.com" > /tmp/installer/docs/CNAME
- name: Setup SSH private key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.PUBLISH_SSH_PRIVATE_KEY }}

- name: Publish
run: |
DST_BRANCH=bin
git config --global user.name "Deployment robot"
git config --global user.email "[email protected]"
cd /tmp/installer
git init
git checkout -b "${DST_BRANCH}"
git add -A
git commit -m "Automatically pushed from drevops/vortex-installer 'main' branch."
git remote add origin [email protected]:drevops/vortex-installer.git
git push origin "${DST_BRANCH}" --force
- name: Get tag name
if: github.ref_type == 'tag'
id: get-version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Create Release
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v2
with:
files: |
./.build/installer
56 changes: 56 additions & 0 deletions .vortex/installer/.github/workflows/test-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Test PHP

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

jobs:
test-php:
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

- name: Check coding standards
run: composer lint

- name: Run tests
run: XDEBUG_MODE=coverage composer test

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

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

# Smoke test for PHAR.
- name: Build PHAR
run: composer build

- name: Test PHAR
run: ./.build/installer --quiet || exit 1
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
42 changes: 42 additions & 0 deletions .vortex/installer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<p align="center">
<a href="" rel="noopener">
<img width=200px height=200px src="https://placehold.jp/000000/ffffff/200x200.png?text=DrevOps+Installer&css=%7B%22border-radius%22%3A%22%20100px%22%7D" alt="DrevOps Installer logo"></a>
</p>

<h1 align="center">Installer for <a href="https://github.com/drevops/vortex">Vortex</a> project.</h1>

<div align="center">

[![GitHub Issues](https://img.shields.io/github/issues/drevops/vortex-installer.svg)](https://github.com/drevops/vortex-installer/issues)
[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/drevops/vortex-installer.svg)](https://github.com/drevops/vortex-installer/pulls)
[![Test PHP](https://github.com/drevops/vortex-installer/actions/workflows/test-php.yml/badge.svg)](https://github.com/drevops/vortex-installer/actions/workflows/test-php.yml)
[![codecov](https://codecov.io/gh/drevops/vortex-installer/graph/badge.svg?token=K9SPETWCJR)](https://codecov.io/gh/drevops/vortex-installer)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/drevops/vortex-installer)
![LICENSE](https://img.shields.io/github/license/drevops/vortex-installer)
![Renovate](https://img.shields.io/badge/renovate-enabled-green?logo=renovatebot)

</div>

> [!IMPORTANT]
> We are working on the `v2` on the installer in
> the [`2.x`](https://github.com/drevops/vortex-installer/tree/2.x) branch.
## Installation

Download and run the latest version of the installer:

```bash
curl -SsL https://install.drevops.com > install.php
php install.php
rm -r install.php
```

## Maintenance

composer install
composer lint
composer test

### Releasing

The installer is packaged as a PHAR and deployed to https://install.drevops.com/ upon each GitHub release.
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://install.drevops.com > install.php && php install.php; rm -r 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"
}
}
Loading

1 comment on commit 6c28602

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.