Skip to content
Snippets Groups Projects
Verified Commit f9d83585 authored by Thomas Lambert's avatar Thomas Lambert :helicopter:
Browse files

ci: add CI file and useful scripts

parent 617a8ac4
No related branches found
No related tags found
No related merge requests found
---
# This CI/CD pipeline is used to
# 1. Ensure code quality
# 2. Generate releases automatically
# Using the official Python Docker image as default
default:
image: python
before_script:
- pip install miss_hit
# Pipeline stages
stages:
- static analysis
- release
# Static code analysis jobs via MISS_HIT
style_check:
stage: static analysis
script:
- mh_style . --fix
metric_check:
stage: static analysis
script:
- mh_metric . --ci
lint_check:
stage: static analysis
script:
- mh_lint .
# TODO: Use git-archive-all and bake an archive that includes submodules
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG # Run when we create a new tag
script:
- echo "Running release_job for $TAG"
release:
tag_name: '$CI_COMMIT_TAG'
description: 'Automatic release for version $CI_COMMIT_TAG'
---
# These hooks run the three MISS_HIT checks to ensure good code quality before
# each commit.
repos:
- repo: local
hooks:
# MISS_HIT code style check
- id: mh_style
entry: mh_style
name: mh_style
args: [--process-slx, --fix]
files: ^(.*\.(m|slx))$
language: python
additional_dependencies: [miss_hit_core]
# MISS_HIT code metric check
- id: mh_metric
name: mh_metric
entry: mh_metric
args: [--ci]
files: ^(.*\.(m|slx))$
language: python
additional_dependencies: [miss_hit_core]
# MISS_HIT code linting check
- id: mh_lint
name: mh_lint
entry: mh_lint
files: ^(.*\.(m|slx))$
language: python
additional_dependencies: [miss_hit]
# miss_hit style checker
# (https://florianschanda.github.io/miss_hit/style_checker.html)
#
project_root
# Ensure copyright notice is everywhere
copyright_primary_entity: "University of Liege"
copyright_entity: "Thomas Lambert <t.lambert@uliege.be>"
copyright_entity: "The Octave Project Developers"
# Enable miss_hit on the whole repo
enable: 1
enforce_encoding: "utf8"
# Layout
line_length: 100
tab_width: 4
# Regex to enforce naming convention
regex_script_name: "[a-z](_?[a-z0-9]+)*"
regex_function_name: "[a-z](_?[a-z0-9]+)*"
regex_nested_name: "[a-z](_?[a-z0-9]+)*"
regex_parameter_name: "[a-zA-Z](_?[a-zA-Z0-9]+)*"
regex_class_name: "[A-Z]([a-zA-Z0-9]+)*"
regex_method_name: "[a-z](_?[a-zA-Z0-9]+)*"
# metrics limit for the code quality
# (https://florianschanda.github.io/miss_hit/metrics.html)
metric "cnest": limit 5
metric "file_length": limit 800
metric "cyc": limit 15
metric "parameters": limit 10
metric "globals": limit 0
metric "persistent": limit 3
# Python requirements.
# THIS IS NOT NEEDED FOR SIMPLE USE OF THE SOFTWARE.
# These requirements are for managing automated testing and good code quality
# during the development.
miss_hit # Matlab static code analysis
pre-commit # Easy setup of pre-commit hooks
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment