Skip to content

Commit

Permalink
Merge pull request #4 from NxtLvLSoftware/create-pull-request/patch
Browse files Browse the repository at this point in the history
  • Loading branch information
JackNoordhuis authored Sep 12, 2023
2 parents bfc7452 + 6214411 commit 8faf33b
Show file tree
Hide file tree
Showing 93 changed files with 3,479 additions and 2,300 deletions.
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
root = true

[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_size = 2
indent_style = space

[*.json]
indent_size = 2
indent_style = space
insert_final_newline = false

[*.md]
indent_style = space
indent_size = 2
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Auto detect text files and perform LF normalization
* text=auto
*.php text eol=lf
*.xml text eol=lf
*.json text eol=lf
*.yml text eol=lf
*.md text eol=lf
13 changes: 13 additions & 0 deletions .github/banner-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions .github/banner-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions .github/pages/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
source "https://rubygems.org"

gem "minima", "~> 2.5"

gem "github-pages", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do

end

# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
platforms :mingw, :x64_mingw, :mswin, :jruby do
gem "tzinfo", ">= 1", "< 3"
gem "tzinfo-data"
end

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]

# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
# do not have a Java counterpart.
gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]

gem "webrick", "~> 1.8"
14 changes: 14 additions & 0 deletions .github/pages/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
twitter_username: NxtLvlSoftware
github_username: NxtLvlSoftware

lsi: false
safe: true
source: ./
incremental: false
theme: minima
highlighter: rouge
gist:
noscript: false
kramdown:
math_engine: mathjax
syntax_highlighter: rouge
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CI

on:
push:
branches: [dev, dist]
pull_request:
branches: [dev]

permissions:
contents: read

env:
GITHUB_ACTIONS: true

jobs:
test:
name: Test (PhpStan + PhpUnit)
runs-on: ${{ matrix.image }}
timeout-minutes: 5

strategy:
fail-fast: false
matrix:
image: [ubuntu-latest]
php-version: [8.2.0, 8.2.9]

steps:
- uses: actions/checkout@v3

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

- name: Restore Composer package cache
uses: actions/cache@v3
with:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
key: "composer-v2-cache-${{ matrix.php-version }}-${{ hashFiles('./composer.json') }}"
restore-keys: |
composer-v2-cache-
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction

- name: Run Tests
run: composer test-ci

stage:
name: Stage changes as pull request
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 5

if: github.ref == 'refs/heads/dev'
steps:
- run: 'echo "Staging dev changes"'
if: ${{ github.event_name == 'push' }}
- uses: actions/checkout@v3
with:
ref: dist

- name: Reset branch
run: |
git fetch origin dev:dev
git reset --hard dev
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.STAGE_DEPLOY_KEY }}
title: Merge dev changes to dist
assignees: JackNoordhuis
199 changes: 199 additions & 0 deletions .github/workflows/pages-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
name: Publish Pages

on:
push:
branches: [dist]

permissions:
contents: write

env:
GITHUB_ACTIONS: true

jobs:
index:
name: Index
runs-on: ubuntu-latest
timeout-minutes: 5

strategy:
fail-fast: true

environment:
name: pages-build
url: ${{ steps.config.outputs.base_url }}

steps:
- uses: actions/checkout@v4
with:
ref: staging
sparse-checkout: |
.github/pages/_config.yml
README.md
sparse-checkout-cone-mode: false

- name: Move pages config
run: |
mv .github/pages/_config.yml ./_config.yml
rm -rf ./.github
- name: Setup Pages
id: config
uses: actions/configure-pages@v3
with:
generator_config_file: ./_config.yml

- name: Build Pages
uses: actions/jekyll-build-pages@v1

- uses: actions/upload-artifact@v3
with:
name: pages-index-html
path: |
./_site
!./_site/**/*.md
coverage:
name: Coverage
runs-on: ubuntu-latest
timeout-minutes: 5

strategy:
fail-fast: true

steps:
- uses: actions/checkout@v3

- name: Setup PHP 8.2.9 with Xdebug
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: xdebug
tools: composer

- name: Restore Composer package cache
uses: actions/cache@v3
with:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
key: "composer-v2-cache-8.2.9-${{ hashFiles('./composer.json') }}"
restore-keys: |
composer-v2-cache-
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction

- name: Generate coverage html
run: composer coverage-ci

- name: Generate coverage badge
uses: timkrase/[email protected]
with:
report_type: html
report: .phpunit/coverage/index.html
coverage_badge_path: .phpunit/coverage/badge.svg

- uses: actions/upload-artifact@v3
with:
name: pages-coverage-html
path: .phpunit/coverage

docs:
name: Docs
runs-on: ubuntu-latest
timeout-minutes: 5

strategy:
fail-fast: true

steps:
- uses: actions/checkout@v3

- name: Setup PHP 8.2.9 with Xdebug
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer, phive

- name: Restore Composer package cache
uses: actions/cache@v3
with:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
key: "composer-v2-cache-8.2.9-${{ hashFiles('./composer.json') }}"
restore-keys: |
composer-v2-cache-
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction

- name: Install phpDocumentor
run: composer install-php-documentor

- name: Generate phpDocumentor html
run: composer docs-ci

- uses: actions/upload-artifact@v3
with:
name: pages-docs-html
path: ./docs-build

package:
name: Package
needs: [index, coverage, docs]
runs-on: ubuntu-latest
timeout-minutes: 5

strategy:
fail-fast: true

steps:
- uses: actions/download-artifact@v3
with:
name: pages-index-html
path: ./

- uses: actions/download-artifact@v3
with:
name: pages-coverage-html
path: ./coverage

- uses: actions/download-artifact@v3
with:
name: pages-docs-html
path: ./docs

- name: Fix permissions
run: |
chmod -c -R +rX "./" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- uses: actions/upload-pages-artifact@v2
with:
name: github-pages
path: ./

publish:
name: Publish
needs: [package]
runs-on: ubuntu-latest
timeout-minutes: 5

strategy:
fail-fast: true

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
Loading

0 comments on commit 8faf33b

Please sign in to comment.