From 4f9e40caf6501a4e80a0cc3fac87bab697d6db7e Mon Sep 17 00:00:00 2001 From: Adar Nimrod Date: Mon, 21 Dec 2020 23:57:38 +0200 Subject: [PATCH] Migrate from Travis CI to GitLab CI. Also, update pre-commit hooks. --- .gitlab-ci.yml | 24 ++++++++++++++++++++++++ .pre-commit-config.yaml | 38 ++++++++++++++++++++++++-------------- .travis.yml | 4 ++-- README.rst | 19 +++++++++++-------- test.bats | 2 -- 5 files changed, 61 insertions(+), 26 deletions(-) create mode 100644 .gitlab-ci.yml mode change 100755 => 100644 test.bats diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..e699e19 --- /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/ + +test: + stage: test + image: buildpack-deps:bullseye + allow_failure: true + before_script: + - apt-get update + - apt-get install -y bats + script: + - bats . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 179bcb3..3a2cc75 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,25 @@ +--- repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - sha: v1.2.3 - hooks: - - id: check-added-large-files - - id: check-yaml - - id: check-merge-conflict - - id: check-symlinks - - id: detect-private-key - - id: trailing-whitespace -- repo: https://github.com/adarnimrod/shell-pre-commit - sha: v0.6.0 - hooks: - - id: shell-lint - - id: shellcheck + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.4.0 + hooks: + - id: check-added-large-files + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: trailing-whitespace + + - repo: https://github.com/adarnimrod/shell-pre-commit + rev: v0.6.0 + hooks: + - id: shell-lint + - id: shellcheck + + - repo: https://github.com/myint/rstcheck + rev: master + hooks: + - id: rstcheck + + - repo: https://github.com/adrienverge/yamllint + rev: v1.25.0 + hooks: + - id: yamllint diff --git a/.travis.yml b/.travis.yml index 7df7be2..9d1defc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,8 +19,8 @@ install: - pip install pre_commit | cat script: - - pre-commit run --all-files - - bats test.bats || true + - pre-commit run --all-files + - bats test.bats || true notifications: on_failure: never diff --git a/README.rst b/README.rst index 923c573..42dcee4 100644 --- a/README.rst +++ b/README.rst @@ -1,8 +1,9 @@ bundle-certs ############ -.. image:: https://travis-ci.org/adarnimrod/bundle_certs.svg?branch=master - :target: https://travis-ci.org/adarnimrod/bundle_certs +.. image:: https://git.shore.co.il/nimrod/bundle_certs/badges/master/pipeline.svg + :target: https://git.shore.co.il/nimrod/bundle_certs/-/commits/master + :alt: pipeline status A shell script to bundle SSL certificates in the correct order. The use case envisioned is programmatically handling SSL certificate renewal. @@ -28,8 +29,8 @@ For regular use: For testing/ development purposes, all of the above, plus: -- `Bats `_. -- `Pre-commit `_. +- Bats_ +- Pre-commit_ Usage ----- @@ -61,9 +62,8 @@ Shell functions Development and testing ----------------------- -Testing is done using Bats `_. To test run -:code:`bats test.bats`. `Pre-commit `_ is also -configured for this repo. +Testing is done using Bats_. To test run :code:`bats test.bats`. Pre-commit_ is +also configured for this repo. License ------- @@ -77,4 +77,7 @@ Author Information Nimrod Adar, `contact me `_ or visit my `website `_. Patches are welcome via `git send-email `_. The repository is located -at: https://www.shore.co.il/cgit/. +at: https://git.shore.co.il/explore/. + +.. _Bats: https://github.com/sstephenson/bats +.. _Pre-commit: https://pre-commit.com/ diff --git a/test.bats b/test.bats old mode 100755 new mode 100644 index fbfece2..24bc768 --- a/test.bats +++ b/test.bats @@ -1,5 +1,3 @@ -#!/usr/bin/env bats - setup () { teardown mkdir -p .testcerts -- GitLab