Skip to content

Commit

Permalink
chore: update requirements management
Browse files Browse the repository at this point in the history
  • Loading branch information
looztra committed Jun 24, 2023
1 parent a2a3666 commit 779c2ce
Show file tree
Hide file tree
Showing 10 changed files with 245 additions and 177 deletions.
13 changes: 6 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@ trim_trailing_whitespace = true
[*.{js,py}]
charset = utf-8


# 4 space indentation (let black do the job)
# 4 space indentation
[*.py]
indent_style = space
indent_size = 4
max_line_length = unset

[tests/test_{convert,output}.py]
indent_size = unset

# Tab indentation (no size specified)
[Makefile]
indent_style = tab
Expand All @@ -54,7 +50,7 @@ trim_trailing_whitespace = false
max_line_length = off

[*.rst]
indent_size = none
indent_size = unset
trim_trailing_whitespace = false
max_line_length = off

Expand Down Expand Up @@ -82,11 +78,14 @@ max_line_length = unset
[poetry.lock]
max_line_length = unset

[requirements.txt]
[requirements*.txt]
max_line_length = unset

[.pylintrc]
max_line_length = unset

[*.bats]
max_line_length = unset

[tests/test_{convert,output}.py]
indent_size = unset
41 changes: 24 additions & 17 deletions .github/workflows/build_it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Tools with asdf
uses: asdf-vm/actions/install@v1.1.0
uses: asdf-vm/actions/install@v2.2.0

- name: Run pre-commit checks
uses: pre-commit/action@v3.0.0
run: |
poetry install --only=dev
source .venv/bin/activate
pre-commit run -a
# We only check docs for now
- uses: dorny/paths-filter@v2
Expand All @@ -57,28 +61,31 @@ jobs:
- name: Lint Docs
if: steps.filter.outputs.can_apply == 'true'
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: true
VALIDATE_MARKDOWN: true
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MARKDOWN_CONFIG_FILE: .markdownlint.yaml
LINTER_RULES_PATH: "."
uses: DavidAnson/markdownlint-cli2-action@v9
with:
globs: |
**/*.md
- name: Check requirements.txt is up to date with poetry.lock
- name: Check if requirements*.txt are up to date with poetry.lock
run: |
make generate-requirements-file
changes_count=$(git status --porcelain --untracked-files requirements.txt | wc -l)
if ! test -f "requirements.txt" || ! test -f "requirements_dev.txt"; then
echo "[ERROR] Either requirements.txt or requirements_dev.txt (or both) does not exist"
echo "[ERROR] Make sure to run 'make generate-requirements-files' with remote make targets >= mk-0.7.0"
exit 1
fi
make generate-requirements-files
changes_count=$(git status --porcelain --untracked-files requirements.txt requirements_dev.txt | wc -l)
if [[ "$changes_count" -ne 0 ]] ; then
echo "You failed to keep requirements.txt synchronized with poetry.lock"
echo "You failed to keep requirements files synchronized with poetry.lock"
git status --porcelain --untracked-files requirements.txt
git diff requirements.txt
git diff requirements.txt requirements_dev.txt
echo
exit 1
else
echo "Nothing to say, requirements.txt seems OK"
echo "Nothing to say, requirements*.txt files seem OK"
fi
build-python:
name: Build python artifacts
runs-on: ubuntu-latest
Expand Down Expand Up @@ -223,7 +230,7 @@ jobs:
- name: Docker build
if: "${{ env.NEED_RELEASE == 'yes' }}"
run: |
make docker-build "APP_VERSION=${GITHUB_REF_SLUG:1}"
make docker-build APP_VERSION="${GITHUB_REF_SLUG:1}"
echo "Checking built image"
docker image ls
Expand Down
33 changes: 16 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ repos:
hooks:
- id: trailing-whitespace # Trims trailing whitespace
- id: check-yaml # Validates YAML files
exclude: |
(?x)^(
test-assets/source/mixed-content-valid-invalid-and-empty-resources.yml |
test-assets/source/mixed-content-valid-invalid-empty-and-list-resources.yml |
test-assets/source/all-in-one.yml
)$
args: [--allow-multiple-documents]
- id: check-json # Validates JSON files
- id: check-toml # Validates TOML files
- id: check-added-large-files # Checks for files that are added to the repository that are larger than a threshold
- id: check-case-conflict # Checks for files that would conflict in case-insensitive filesystems
- id: check-merge-conflict # Checks for files that contain merge conflict strings
Expand All @@ -28,19 +24,22 @@ repos:
(?x)^(
.*\.bats
)$
- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.11.2
hooks:
- id: isort
name: isort
args:
- --dont-order-by-type
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.6.1
hooks:
- id: editorconfig-checker-system # Check editorconfig compliance
alias: ec
- repo: local
hooks:
- id: black
name: black
language: system
types: [python]
require_serial: true
entry: poetry run black
- id: isort
name: isort
language: system
types: [python]
require_serial: true
entry: poetry run isort --dont-order-by-type
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
poetry 1.3.1
poetry 1.5.1
editorconfig-checker 2.6.0
actionlint 1.6.22
shfmt 3.6.0
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ APP_NAME ?= kubesplit
MK_ACTIONLINT_SHA256 := fbbf3b567ac9854481cf32274f480c501f093d9436151e50d584ed89bc2afdcc
MK_COMMON_SHA256 := 2d49615c5fa43b30d739e4a00c175fc7f295665c9a01f32a52792f6aa80a3bfa
MK_DOCKER_SHA256 := 8dddb0f5b71d24b4b205a36f514aa7c9ddd4ca771557694e6d1410c5fbbdf8f2
MK_MDLINT_SHA256 := 7ddab45f6476376dc8b05cbb2970716b94d297f3d30bae94e593b543b0e53440
MK_PRE_COMMIT_SHA256 := 0c73900d816a266dfaa230b3223f25f53caff97d102e8fced7dbab997c2a46f1
MK_PYTHON_POETRY_APP_SHA256 := 65204fedf5a5bfe1915f55b2af9414f9aa65e26d0c0da84a695964ded8129b48
MK_PYTHON_POETRY_VENV_SHA256 := 9cf4d57d6acea5bf2dcd2e0bf4b771528ae2a4c4dfc492188d09c7eaee2c8014
MK_PYTHON_POETRY_APP_SHA256 := 318b8ebede6324bee2cd10adfcd2672389e25333fa2f13d5ed5e480a3630bd1c
MK_PYTHON_POETRY_VENV_SHA256 := ed1513b743db40823c7f4432dd6b46749f80abf4ada1ecc95ba1e9c52e6f6274

MK_GIT_REF ?= mk-1.1.0
MK_GIT_REF ?= mk-1.4.0

include toolbox/mk/remote-mk.mk

Expand All @@ -17,3 +18,4 @@ include generated/mk/pre-commit.mk
include generated/mk/python-poetry-venv.mk
include generated/mk/python-poetry-app.mk
include generated/mk/docker.mk
include generated/mk/mdlint.mk
28 changes: 0 additions & 28 deletions local.Dockerfile

This file was deleted.

Loading

0 comments on commit 779c2ce

Please sign in to comment.