ci: enable pre-commit checks

This commit is contained in:
Oleg Kainov 2020-05-17 18:11:14 +02:00 committed by Oleg Kainov
parent 4ad869c502
commit 243484c29d
6 changed files with 21 additions and 11 deletions

View File

@ -2,4 +2,4 @@
* *
!mantis-entrypoint* !mantis-entrypoint*
!config_inc.php !config_inc.php

View File

@ -21,9 +21,7 @@ jobs:
steps: steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: pre-commit
# Runs a single command using the runners shell uses: pre-commit/action@v1.1.0
- name: Run a one-line script
run: echo Hello, world!
- name: Hadolint Action - name: Hadolint Action
uses: brpaz/hadolint-action@v1.1.0 uses: brpaz/hadolint-action@v1.1.0

11
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,11 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-case-conflict
# Useful, but so far is broken on Windows
# - id: check-executables-have-shebangs
- id: check-merge-conflict

View File

@ -7,7 +7,7 @@ Docker image for Mantis Bug Tracker https://www.mantisbt.org/
# Why this image? # Why this image?
There are some other alternative images exist already such as [vimagick/mantisbt](https://hub.docker.com/r/vimagick/mantisbt/), [xlrl/docker-mantisbt](https://github.com/xlrl/docker-mantisbt) and others. Why do we need yet another image? There are some other alternative images exist already such as [vimagick/mantisbt](https://hub.docker.com/r/vimagick/mantisbt/), [xlrl/docker-mantisbt](https://github.com/xlrl/docker-mantisbt) and a few others. Why do we need yet another image?
The reason is to combine all the nice features each of them have and add some missing features. To list some: The reason is to combine all the nice features each of them have and add some missing features. To list some:
@ -16,7 +16,8 @@ The reason is to combine all the nice features each of them have and add some mi
- Allows to easily configure presence of `admin` service folder - Allows to easily configure presence of `admin` service folder
- Comes with built-in integration with Gitlab and Github [source plugins](https://github.com/mantisbt-plugins/source-integration) - Comes with built-in integration with Gitlab and Github [source plugins](https://github.com/mantisbt-plugins/source-integration)
- Example `docker-compose.yml` file provided for getting started in one click! - Example `docker-compose.yml` file provided for getting started in one click!
- Easy customization of the config files and custom plugins without destroying data from base image. - Easy customization of the config files and custom plugins without destroying data from base image
- Consistent Dockerfile style following all best practices (ensured by Dockerfile lint)
# Quick start # Quick start
@ -28,7 +29,7 @@ https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html-desktop/#admin.confi
- Open browser at `localhost:8989/admin/install.php` and follow installation instructions, default out-of-the-box values are good to use. - Open browser at `localhost:8989/admin/install.php` and follow installation instructions, default out-of-the-box values are good to use.
-- Ignore `Config File Exists but Database does not` warning and proceed installation -- Ignore `Config File Exists but Database does not` warning and proceed installation
- Log in as `administrator`/`root` (default credentials) and confugre whatever you need (typically you want to create your own Admin user and disable built-in "administrator" first) - Log in as `administrator`/`root` (default credentials) and confugre whatever you need (typically you want to create your own Admin user and disable built-in "administrator" first)
- Check MantisBT own's checks at `localhost:8989/admin/`. Note: several warnings are expected to be "WARN" due to issues in MantisBT, such as magic quotes warning ([#26964](https://www.mantisbt.org/bugs/view.php?id=26964) and "folder outside of web root" warnings ([#21584](https://mantisbt.org/bugs/view.php?id=21584))) - Check MantisBT own's checks at `localhost:8989/admin/`. Note: several warnings are expected to be "WARN" due to issues in MantisBT, such as magic quotes warning ([#26964](https://www.mantisbt.org/bugs/view.php?id=26964)) and "folder outside of web root" warnings ([#21584](https://mantisbt.org/bugs/view.php?id=21584)))
- When ready to move to production, either remove `MANTIS_ENABLE_ADMIN` env variable or set it to 0 - this will remove "admin" folder from the installation. - When ready to move to production, either remove `MANTIS_ENABLE_ADMIN` env variable or set it to 0 - this will remove "admin" folder from the installation.
For further details refer to [official documentation](https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html-desktop/#admin.install.new) For further details refer to [official documentation](https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html-desktop/#admin.install.new)
@ -75,4 +76,4 @@ More details are available in [official documentation](https://www.mantisbt.org/
## Custom plugins ## Custom plugins
In order to add your own custom plugins into the image, either create your own Dockerfile and copy extra plugins to `/var/www/html/plugins/` or add volume in docker-compose to mount extra plugin directly inside existing image `./custom_plugin/:/var/www/html/plugins/custom_plugin/` In order to add your own custom plugins into the image, either create your own Dockerfile and copy extra plugins to `/var/www/html/plugins/` or add volume in docker-compose to mount extra plugin directly inside existing image `./custom_plugin/:/var/www/html/plugins/custom_plugin/`

View File

@ -20,4 +20,4 @@ $g_webmaster_email = getenv('EMAIL_WEBMASTER') !== false ? getenv('EMAI
$g_from_email = getenv('EMAIL_FROM') !== false ? getenv('EMAIL_FROM') : null; $g_from_email = getenv('EMAIL_FROM') !== false ? getenv('EMAIL_FROM') : null;
$g_return_path_email = getenv('EMAIL_RETURN_PATH') !== false ? getenv('EMAIL_RETURN_PATH') : null; $g_return_path_email = getenv('EMAIL_RETURN_PATH') !== false ? getenv('EMAIL_RETURN_PATH') : null;
include 'config_inc_addon.php'; include 'config_inc_addon.php';

View File

@ -41,4 +41,4 @@ services:
- MYSQL_USER=mantis - MYSQL_USER=mantis
- MYSQL_PASSWORD=mantis - MYSQL_PASSWORD=mantis
# Set default collation so Mantis does not complain about latin1 # Set default collation so Mantis does not complain about latin1
command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci'] command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']