From 07e9fd5b8d6e23971f58e5dc6b0b1f32eb22f61a Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Sat, 26 Dec 2020 22:24:50 +0200 Subject: [PATCH] Migrate to GitLab CI. - Update pre-commit checks. - Replace Travis CI with GitLab CI. - Address new warnings from pre-commit checks. --- .gitlab-ci.yml | 24 +++++++++++++++++++ .pre-commit-config.yaml | 50 ++++++++++++++++++++++++++++----------- .pre-commit-hooks.yaml | 2 +- .travis.yml | 36 ---------------------------- README.md | 5 ++-- tests/merge-conflict.bats | 2 -- 6 files changed, 63 insertions(+), 56 deletions(-) create mode 100644 .gitlab-ci.yml delete mode 100644 .travis.yml mode change 100755 => 100644 tests/merge-conflict.bats diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..98ded67 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,24 @@ +--- +stages: + - test + +pre-commit: + stage: test + image: adarnimrod/ci-images:pre-commit + variables: + XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache" + script: + - pre-commit run --all-files + cache: + paths: + - .cache/ + +bats: + stage: test + image: alpine + before_script: + - apk add --update bats git + - git config --global user.email "you@example.com" + - git config --global user.name "Your Name" + script: + - bats tests/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d3dc103..e458a8a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,17 +1,39 @@ -- repo: https://github.com/pre-commit/pre-commit-hooks - sha: v0.9.1 +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks.git + rev: v3.4.0 hooks: - - id: check-added-large-files - - id: check-merge-conflict - - id: check-yaml -- repo: https://git.shore.co.il/nimrod/shell-pre-commit.git - sha: v0.5.4 + - id: check-added-large-files + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-symlinks + - id: check-yaml + - id: trailing-whitespace + + - repo: https://git.shore.co.il/nimrod/shell-pre-commit.git + rev: v0.6.0 hooks: - - id: shell-lint - files: &shellscripts '^merge-conflict$' - - id: shellcheck - files: *shellscripts -- repo: https://git.shore.co.il/nimrod/git-pre-commit.git - sha: v0.1.1 + - id: shell-lint + - id: shellcheck + + - repo: https://git.shore.co.il/nimrod/git-pre-commit.git + rev: v0.1.1 hooks: - - id: merge-conflict + - id: merge-conflict + + - repo: https://github.com/pre-commit/pre-commit.git + rev: v2.9.3 + hooks: + - id: validate_manifest + + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.25.0 + hooks: + - id: yamllint + + - repo: https://github.com/amperser/proselint.git + rev: 0.10.2 + hooks: + - id: proselint + types: [plain-text] + exclude: LICENSE diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 8a92237..a3f3c98 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -5,4 +5,4 @@ language: script entry: merge-conflict files: '$^' - always_run: True + always_run: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ab17cf6..0000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -dist: trusty -sudo: false -group: beta -cache: - - pip - - directories: - - $HOME/.pre-commit - - $HOME/.cabal - - $HOME/.ghc - -matrix: - fast_finish: True - include: - - language: python - python: "3.6" - env: - PATH: "$HOME/.cabal/bin:$PATH" - addons: - apt: - packages: - - cabal-install - - ghc - install: - - cabal update && cabal install shellcheck - - pip install pre_commit | cat - - pre-commit install-hooks - script: - - pre-commit run --all-files - - language: shell - script: - bats -t tests/ - -notifications: - on_failure: never - email: false diff --git a/README.md b/README.md index d894ae9..c1b35fa 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Git pre-commit hooks -[](https://travis-ci.org/adarnimrod/git-pre-commit) + [](https://git.shore.co.il/nimrod/git-pre-commit/-/commits/master) [Pre-commit](http://pre-commit.com/) Git related hooks. @@ -28,4 +27,4 @@ This software is licensed under the MIT license (see the `LICENSE.txt` file). Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my [website](https://www.shore.co.il/). Patches are welcome via [git send-email](http://git-scm.com/book/en/v2/Git-Commands-Email). The repository is -located at <https://git.shore.co.il/nimrod/>. +located at <https://git.shore.co.il/explore>. diff --git a/tests/merge-conflict.bats b/tests/merge-conflict.bats old mode 100755 new mode 100644 index bf17c34..c4285e8 --- a/tests/merge-conflict.bats +++ b/tests/merge-conflict.bats @@ -1,5 +1,3 @@ -#!/usr/bin/env bats - export PATH="$BATS_TEST_DIRNAME/../:$PATH" export repo="$BATS_TMPDIR/testrepo" -- GitLab