Skip to content

Commit

Permalink
Update development environment
Browse files Browse the repository at this point in the history
  • Loading branch information
gocom committed Apr 17, 2022
1 parent 75db44b commit c1ca926
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 87 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.yml]
indent_size = 2
[Makefile]
indent_style = tab
55 changes: 31 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,34 @@ name: CI
on: [push]

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v1

- name: Build
id: build
uses: gocom/action-textpattern-package-plugin@master

- name: Upload Compressed Plugin Installer Artifact
uses: actions/upload-artifact@master
with:
name: ${{ steps.build.outputs.name }}_sha${{ github.sha }}_zip.txt
path: ${{ github.workspace }}/${{ steps.build.outputs.compressed }}

- name: Upload Uncompressed Plugin Installer Artifact
uses: actions/upload-artifact@master
with:
name: ${{ steps.build.outputs.name }}_sha${{ github.sha }}.txt
path: ${{ github.workspace }}/${{ steps.build.outputs.uncompressed }}
build:
name: Build
runs-on: ubuntu-latest
env:
COMPOSER_HOME: ./.composer

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup
run: mkdir -p "$COMPOSER_HOME"

- name: Lint
run: make lint

- name: Build
id: build
uses: gocom/action-textpattern-package-plugin@master

- name: Upload Compressed Plugin Installer Artifact
uses: actions/upload-artifact@master
with:
name: ${{ steps.build.outputs.name }}_sha${{ github.sha }}_zip.txt
path: ${{ github.workspace }}/${{ steps.build.outputs.compressed }}

- name: Upload Uncompressed Plugin Installer Artifact
uses: actions/upload-artifact@master
with:
name: ${{ steps.build.outputs.name }}_sha${{ github.sha }}.txt
path: ${{ github.workspace }}/${{ steps.build.outputs.uncompressed }}
101 changes: 55 additions & 46 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,60 @@
name: Release

on:
push:
tags:
- '*.*.*'
push:
tags:
- '*.*.*'

jobs:
build:
name: Create Release
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v1

- name: Build
id: build
uses: gocom/action-textpattern-package-plugin@master

- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Compressed Plugin Installer
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/${{ steps.build.outputs.compressed }}
asset_name: ${{ steps.build.outputs.name }}_v${{ steps.build.outputs.version }}_zip.txt
asset_content_type: text/plain

- name: Upload Uncompressed Plugin Installer
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/${{ steps.build.outputs.uncompressed }}
asset_name: ${{ steps.build.outputs.name }}_v${{ steps.build.outputs.version }}.txt
asset_content_type: text/plain
build:
name: Create Release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build
id: build
uses: gocom/action-textpattern-package-plugin@master

- name: Changelog
id: changelog
run: |
contents="$(sed -e '1,/h2. Changelog/d' README.textile | sed -e '1,/h3./d' -e '/h3./,$d')"
contents="${contents//'%'/'%25'}"
contents="${contents//$'\n'/'%0A'}"
contents="${contents//$'\r'/'%0D'}"
echo "::set-output name=contents::$contents"
- name: Create Release
id: create_release
uses: actions/create-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.changelog.outputs.contents }}
draft: false
prerelease: false

- name: Upload Compressed Plugin Installer
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/${{ steps.build.outputs.compressed }}
asset_name: ${{ steps.build.outputs.name }}_v${{ steps.build.outputs.version }}_zip.txt
asset_content_type: text/plain

- name: Upload Uncompressed Plugin Installer
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/${{ steps.build.outputs.uncompressed }}
asset_name: ${{ steps.build.outputs.name }}_v${{ steps.build.outputs.version }}.txt
asset_content_type: text/plain
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
!.editorconfig
!.github
!.gitignore
/composer.lock
/vendor
/dist/
/vendor/
composer.lock
16 changes: 6 additions & 10 deletions CONTRIBUTING.textile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Please take a quick look at this document before to make contribution process ea

h2. License

"GNU General Public License, version 2":https://github.com/gocom/rah_flat/blob/master/LICENSE. By contributing code, you agree to license your additions under the GPLv2 license.
"GNU General Public License, version 2":https://github.com/gocom/rah_flat/blob/master/LICENSE.

h2. Configure git

Expand All @@ -15,22 +15,18 @@ $ git config --global user.email [email protected]

Make sure to use an email address that is linked to your GitHub account. It can be a throwaway address or you can use GitHub's email protection features. We don't want your emails, but this is to make sure we know who did what. All commits nicely link to their author, instead of them coming from [email protected].

h2. Dependencies
h2. Development

Dependencies are managed using "Composer":https://getcomposer.org. After you have cloned the repository, run composer install:
For list of available commands, run:

bc. $ composer install

And update before testing and committing:

bc. $ composer update
bc. $ make help

h2. Coding standard

The project follows the "PSR-0":https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md and "PSR-2":https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide-meta.md standards with PHP 5.2 style namespacing. You can use PHP_CodeSniffer to make sure your additions follow them too:

bc. $ composer cs
bc. $ make lint

h2. Versioning

"Semantic Versioning":https://semver.org/ and major.minor.path format.
"Semantic Versioning":https://semver.org/.
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.PHONY: all clean compile help lint lint-fix

PHP = docker-compose run --rm php

all: lint

vendor:
$(PHP) composer --ignore-platform-req=ext-memcached install

clean:
$(PHP) rm -rf vendor composer.lock

lint: vendor
$(PHP) composer lint

lint-fix: vendor
$(PHP) composer lint-fix

compile: vendor
$(PHP) composer compile

help:
@echo "Manage project"
@echo ""
@echo "Usage:"
@echo " $$ make [command]"
@echo ""
@echo "Commands:"
@echo ""
@echo " $$ make lint"
@echo " Lint code style"
@echo ""
@echo " $$ make lint-fix"
@echo " Lint and fix code style"
@echo ""
@echo " $$ make compile"
@echo " Compiles the plugin"
@echo ""
@echo " $$ make clean"
@echo " Delete installed dependencies"
@echo ""
@echo " $$ make vendor"
@echo " Install dependencies"
@echo ""
2 changes: 1 addition & 1 deletion README.textile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
h1. rah_flat

"Download":https://github.com/gocom/rah_flat/releases | "Packagist":https://packagist.org/packages/rah/rah_flat | "Donate":https://rahforum.biz/donate/rah_flat
"Download":https://github.com/gocom/rah_flat/releases | "Packagist":https://packagist.org/packages/rah/rah_flat | "Issues":https://github.com/gocom/rah_flat/issues

This "Textpattern CMS":https://textpattern.com plugin imports flat "frontend themes":https://docs.textpattern.com/themes/front-end-themes automatically to the database while the site is set in debugging or testing mode.

Expand Down
12 changes: 10 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"authors": [
{
"name": "Jukka Svahn",
"homepage": "https://rahforum.biz",
"homepage": "https://github.com/gocom",
"role": "Developer"
}
],
Expand All @@ -22,9 +22,17 @@
"textpattern/installer": "*"
},
"require-dev": {
"rah/mtxpc": "^0.9.0",
"squizlabs/php_codesniffer": "3.*"
},
"scripts": {
"cs": "./vendor/bin/phpcs"
"lint": "./vendor/bin/phpcs",
"lint-fix": "./vendor/bin/phpcbf",
"compile": "mtxpc --outdir=dist/ -c . && mtxpc --outdir=dist/ ."
},
"config": {
"allow-plugins": {
"textpattern/installer": true
}
}
}
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.2'

services:
php:
image: composer:2.3
volumes:
- .:/app
- ${COMPOSER_HOME:-$HOME/.composer}:/tmp
networks:
- app

networks:
app:
driver: bridge

0 comments on commit c1ca926

Please sign in to comment.