Skip to content

Commit

Permalink
First import
Browse files Browse the repository at this point in the history
  • Loading branch information
melmorabity committed Jul 25, 2023
0 parents commit ace9332
Show file tree
Hide file tree
Showing 41 changed files with 3,468 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/actions/shellspec/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Install ShellSpec
description: Install ShellSpec
inputs:
shell:
description: Installation shell
default: sh
runs:
using: composite
steps:
- name: Install ShellSpec
shell: ${{ inputs.shell }}
run: |
PREFIX=$HOME/.local
SHELLSPEC_RELEASE=$(git -c "versionsort.suffix=-" ls-remote --refs --tags --sort="v:refname" https://github.com/shellspec/shellspec '*.*.*' | awk -F "/" 'END { gsub(/\r/, "", $3); print $3; }')
mkdir -p "$PREFIX/bin" "$PREFIX/lib" "$PREFIX/doc/shellspec"
curl -L "https://github.com/shellspec/shellspec/releases/download/$SHELLSPEC_RELEASE/shellspec-dist.tar.gz" -o - | tar -xz -C "$PREFIX/lib"
ln -sf "$PREFIX/lib/shellspec/shellspec" "$PREFIX/bin"
ln -sf "$PREFIX/lib/LICENSE" "$PREFIX/doc/shellspec"
echo "$PREFIX/bin" >>"$GITHUB_PATH"
55 changes: 55 additions & 0 deletions .github/workflows/acceptance_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: Acceptance tests
on:
push:
branches:
- main
tags-ignore:
- '**'
pull_request:
jobs:
acceptance-tests:
name: Acceptance tests (${{ matrix.os }}, Helm ${{ matrix.helm_version }}, Python ${{ matrix.python_version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
helm_version:
- '3.10.0'
- '3.11.0'
- '3.12.0'
os:
- ubuntu-latest
- macos-latest
- windows-latest
python_version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
steps:
- if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf input
- name: Checkout
uses: actions/checkout@v3
- if: matrix.os == 'windows-latest'
name: Install Cygwin
uses: cygwin/cygwin-install-action@v4
with:
packages: curl,unzip
- name: Install Python ${{ matrix.python_version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: Install Tox
run: pip install tox
- name: Install Helm ${{ matrix.helm_version }}
uses: azure/[email protected]
with:
version: ${{ matrix.helm_version }}
- name: Install ShellSpec
uses: ./.github/actions/shellspec
with:
shell: ${{ matrix.os == 'windows-latest' && 'sh -o igncr -e {0}' || 'sh' }}
- name: Run acceptance tests
run: tox -e py${{ matrix.python_version }} -e acceptance
25 changes: 25 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Linting
on:
push:
branches:
- main
tags-ignore:
- '**'
pull_request:
jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: pip install -e .[dev]
- name: Install ShellSpec
uses: ./.github/actions/shellspec
- name: Run pre-commit
uses: pre-commit/[email protected]
43 changes: 43 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Unit tests
on:
push:
branches:
- main
tags-ignore:
- '**'
pull_request:
jobs:
unit-tests:
name: Unit tests (Python ${{ matrix.python_version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python_version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python ${{ matrix.python_version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: Install Tox
run: pip install tox
- name: Install ShellSpec
uses: ./.github/actions/shellspec
- name: Install Kcov
run: |
sudo apt-get install -y kcov
- name: Run unit tests
run: tox -e py${{ matrix.python_version }}
- if: matrix.python_version == '3.11'
name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: coverage/shellspec/cobertura.xml,coverage/pytest/cobertura.xml
fail_ci_if_error: true
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.egg-info
.*_cache
.coverage
.shellspec-quick.log
.tox
.venv
__pycache__
build
coverage
dist
kubeconform
106 changes: 106 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-toml
- id: check-yaml
exclude: ^tests/fixtures/.+?/templates/.+?\.yaml$
- id: end-of-file-fixer
- id: file-contents-sorter
files: ^\.gitignore$
- id: mixed-line-ending
args:
- --fix=lf
- id: trailing-whitespace
- repo: https://github.com/ComPWA/mirrors-taplo
rev: v0.8.1
hooks:
- id: taplo
args:
- format
- --option=reorder_arrays=true
- --option=reorder_keys=true
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies:
- Flake8-pyproject
- repo: https://github.com/PyCQA/pylint
rev: v3.0.0a6
hooks:
- id: pylint
args:
- --enable-all-extensions
additional_dependencies:
- pylint_per_file_ignores
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.280
hooks:
- id: ruff
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
- id: bandit
args:
- -c
- pyproject.toml
additional_dependencies:
- .[toml]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
additional_dependencies:
- .[toml]
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.7.0-1
hooks:
- id: shfmt
args:
- --indent=4
- --binary-next-line
- --case-indent
- --simplify
- --write
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.5
hooks:
- id: shellcheck
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.35.0
hooks:
- id: markdownlint
args:
- --disable=MD013
- repo: local
hooks:
- id: mypy
name: Mypy
entry: mypy
language: system
types:
- python
- id: shellspec-syntax-check
name: Syntax check of ShellSpec specfiles
language: system
entry: shellspec --no-kcov --syntax-check
15 changes: 15 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- id: helm-kubeconform
name: Helm charts validation
description: validate Helm charts using Kubeconform
entry: pre-commit-helm-kubeconform validate-charts
language: python
require_serial: true
- id: helm-kubeconform-values
name: Helm chart values validation
description: validate values against a Helm chart using Kubeconform
entry: pre-commit-helm-kubeconform validate-values
language: python
types_or:
- yaml
- json
5 changes: 5 additions & 0 deletions .shellspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--covdir coverage/shellspec
--default-path tests/shellspec
--helperdir tests/shellspec
--kcov-options "--exclude-path=.tox,.venv,build,tests"
--require spec_helper
Loading

0 comments on commit ace9332

Please sign in to comment.