From c9789dd255bf97827f6dc30001b83362fd3322ce Mon Sep 17 00:00:00 2001 From: Kostas Stathoulopoulos Date: Sat, 2 Dec 2023 14:28:49 +0000 Subject: [PATCH] initial setup --- .../poetry/pre-commit-lint/action.yaml | 10 +++++ .github/actions/poetry/setup/action.yaml | 42 +++++++++++++++++++ .github/workflows/status-checks.yaml | 31 ++++++++++++++ .gitignore | 2 +- .yamllint | 31 ++++++++++++++ 5 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 .github/actions/poetry/pre-commit-lint/action.yaml create mode 100644 .github/actions/poetry/setup/action.yaml create mode 100644 .github/workflows/status-checks.yaml create mode 100644 .yamllint diff --git a/.github/actions/poetry/pre-commit-lint/action.yaml b/.github/actions/poetry/pre-commit-lint/action.yaml new file mode 100644 index 0000000..60b87ba --- /dev/null +++ b/.github/actions/poetry/pre-commit-lint/action.yaml @@ -0,0 +1,10 @@ +--- +name: Run Lint +description: Run linters to verify code quality. Credits to Andre Sionek for writing the original GitHub Action. + +runs: + using: "composite" + steps: + - name: Lint + shell: bash + run: poetry run pre-commit run --all-files diff --git a/.github/actions/poetry/setup/action.yaml b/.github/actions/poetry/setup/action.yaml new file mode 100644 index 0000000..76a1f06 --- /dev/null +++ b/.github/actions/poetry/setup/action.yaml @@ -0,0 +1,42 @@ +--- +name: Set Up Poetry Environment +description: Install Python and Poetry. Credits to Andre Sionek for writing the original GitHub Action. + +inputs: + python_version: + description: Python version + required: true + default: '3.11.5' + type: string + + poetry_version: + description: Poetry version + required: true + default: 1.5.1 + type: string + +runs: + using: "composite" + steps: + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python_version }} + + - name: Install and configure Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + version: ${{ inputs.poetry_version }} + + - name: Set up Poetry cache + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python_version }} + cache: poetry + + - name: Install Python Dependencies with Poetry + shell: bash + run: poetry install diff --git a/.github/workflows/status-checks.yaml b/.github/workflows/status-checks.yaml new file mode 100644 index 0000000..5356b15 --- /dev/null +++ b/.github/workflows/status-checks.yaml @@ -0,0 +1,31 @@ +--- +name: Status Checks + +on: + push: + branches-ignore: + - main + +# Stops the currently running workflow if a new one has been triggered +concurrency: + group: "${{ github.ref }}" + cancel-in-progress: true + +jobs: + lint: + name: Lint + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + + - name: Set up + uses: ./.github/actions/poetry/setup + with: + python_version: "3.11.5" + + - name: Install Python Lint Dependencies with Poetry + shell: bash + run: poetry install --with lint + + - name: Lint + uses: ./.github/actions/poetry/pre-commit-lint diff --git a/.gitignore b/.gitignore index 68bc17f..d3237e2 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,7 @@ share/python-wheels/ .installed.cfg *.egg MANIFEST - +.DS_Store # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..91dcb85 --- /dev/null +++ b/.yamllint @@ -0,0 +1,31 @@ +--- +extends: default + +rules: + braces: + level: error + max-spaces-inside: 1 + brackets: + level: error + max-spaces-inside: 1 + colons: + level: error + commas: + level: error + empty-lines: + level: error + hyphens: + level: error + document-start: disable + indentation: + level: error + indent-sequences: consistent + new-lines: + level: warning + trailing-spaces: + level: warning + line-length: + max: 159 + level: error + allow-non-breakable-inline-mappings: true + truthy: disable