Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: lint code & non-code files #182

Merged
merged 9 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
# Scripts and tools
./scripts
Makefile
PULL_REQUEST_TEMPLATE.md
PULL_REQUEST_TEMPLATE.md
32 changes: 23 additions & 9 deletions .github/ISSUE_TEMPLATE/general-purpose.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
Your issue may already be reported!
Please search on the [issue tracker](https://github.com/elixir-cloud-aai/TESK/issues) before creating one.
Your issue may already be reported! Please search on the
[issue tracker](https://github.com/elixir-cloud-aai/TESK/issues) before creating
one.

## Expected Behavior

<!--- If you're describing a bug, tell us what should happen -->

<!--- If you're suggesting a change/improvement, tell us how it should work -->

## Current Behavior

<!--- If describing a bug, tell us what happens instead of the expected behavior -->

<!--- If suggesting a change/improvement, explain the difference from current behavior -->

## Possible Solution

<!--- Not obligatory, but suggest a fix/reason for the bug, -->

<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)

<!--- Provide a link to a live example, or an unambiguous set of steps to -->

<!--- reproduce this bug. Include code to reproduce, if relevant -->

1.
1.
1.
1.
2.
3.
4.

## Context

<!--- How has this issue affected you? What are you trying to accomplish? -->

<!--- Providing context helps us come up with a solution that is most useful in the real world -->

## Your Environment

<!--- Include as many relevant details about the environment you experienced the bug in -->
* Version used:
* Browser Name and version:
* Operating System and version (desktop or mobile):
* Link to your project:

- Version used:
- Browser Name and version:
- Operating System and version (desktop or mobile):
- Link to your project:
47 changes: 30 additions & 17 deletions .github/actions/setup/poetry/action.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
---
name: Setup Python and Poetry Action
description: Install and configure the system, Python, Poetry and requested deps with cache management.
description: Configure system, Python, Poetry and deps and cache management.

inputs:
os:
default: ubuntu-latest
description: The operating system to use
python-version:
default: "3.11"
default: '3.11'
description: The version of Python to use
poetry-version:
default: "1.8.2"
default: '1.8.2'
description: The version of Poetry to install
poetry-install-options:
default: ""
default: ''
description: Additional options to pass to poetry install
poetry-export-options:
default: ""
description: Options to pass to poetry export for hash generation for cache invalidation
default: ''
description: Options to pass to poetry export for hash generation for cache
invalidation

runs:
using: composite
steps:
- uses: "actions/setup-python@v5"
- uses: 'actions/setup-python@v5'
id: setup-python
with:
python-version: "${{ inputs.python-version }}"
python-version: '${{ inputs.python-version }}'

- name: Setup pipx environment Variables
id: pipx-env-setup
Expand All @@ -47,33 +49,44 @@ runs:
uses: actions/cache@v4
with:
path: ${{ steps.pipx-env-setup.outputs.pipx-cache-path }}
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipx-${{ steps.pipx-env-setup.outputs.pipx-version }}-poetry-${{ inputs.poetry-version }}
key: ${{ runner.os }}-python-
${{ steps.setup-python.outputs.python-version }}-
pipx-${{ steps.pipx-env-setup.outputs.pipx-version }}-
poetry-${{ inputs.poetry-version }}

- name: Install poetry
if: steps.pipx-cache.outputs.cache-hit != 'true'
id: install-poetry
shell: bash
run: |-
pipx install poetry --python "${{ steps.setup-python.outputs.python-path }}"
run: |
pipx install poetry \
--python "${{ steps.setup-python.outputs.python-path }}"

- name: Read poetry cache location
id: poetry-cache-location
shell: bash
run: echo "poetry-venv-location=$(poetry config virtualenvs.path)" >> $GITHUB_OUTPUT
run: |
echo "poetry-venv-location=$(poetry config virtualenvs.path)" \
>> $GITHUB_OUTPUT

- name: Generate hash only for required deps
run: |
poetry export ${{ inputs.poetry-export-options }} --format=requirements.txt --output=requirements.txt
echo "DEP_HASH=$(sha256sum requirements.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV
poetry export ${{ inputs.poetry-export-options }} \
--format=requirements.txt --output=requirements.txt
echo "DEP_HASH=$(sha256sum requirements.txt | cut -d ' ' -f 1)" \
>> $GITHUB_ENV
shell: bash

- uses: actions/cache@v4
name: Poetry cache
with:
path: ${{ steps.poetry-cache-location.outputs.poetry-venv-location }}
key: ${{ runner.os }}-[python-${{ steps.setup-python.outputs.python-version }}]-[${{ env.DEP_HASH }}]-[${{ inputs.poetry-install-options }}]
key: ${{ runner.os }}-[python-
${{ steps.setup-python.outputs.python-version }}]-[
${{ env.DEP_HASH }}]-[${{ inputs.poetry-install-options }}]

- name: "Poetry install"
- name: 'Poetry install'
if: steps.poetry-cache.outputs.cache-hit != 'true'
shell: bash
run: poetry install ${{ inputs.poetry-install-options }} --no-interaction
run: poetry install ${{ inputs.poetry-install-options }} --no-interaction
...
10 changes: 6 additions & 4 deletions .github/workflows/build_and_publish_charts.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
JaeAeich marked this conversation as resolved.
Show resolved Hide resolved
name: Build and Publish Helm Charts

on:
Expand All @@ -18,12 +19,12 @@ jobs:
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Create k3s Cluster
uses: debianmaster/[email protected]
with:
version: 'latest'

- name: Create namespace
run: kubectl create ns tesk

Expand Down Expand Up @@ -67,15 +68,16 @@ jobs:
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

- name: Run chart-releaser
uses: helm/[email protected]
with:
skip_existing: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
...
9 changes: 5 additions & 4 deletions .github/workflows/build_and_publish_filer.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
name: Build and Publish Filer

on:
push:
branches: [ 'testing-gh-action' ]
tags: [ '*' ]
branches: ['testing-gh-action']
tags: ['*']

workflow_dispatch:
inputs:
Expand Down Expand Up @@ -38,7 +39,7 @@ jobs:
with:
images: |
elixircloud/${{ github.workflow }}

- name: Build and push Docker images
uses: docker/build-push-action@v3
with:
Expand All @@ -47,4 +48,4 @@ jobs:
file: ./deployment/containers/filer.Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

...
9 changes: 5 additions & 4 deletions .github/workflows/build_and_publish_taskmaster.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
name: Build and Publish Taskmaster

on:
push:
branches: [ 'testing-gh-action' ]
tags: [ '*' ]
branches: ['testing-gh-action']
tags: ['*']

workflow_dispatch:
inputs:
Expand Down Expand Up @@ -37,7 +38,7 @@ jobs:
with:
images: |
elixircloud/${{ github.workflow }}

- name: Build and push Docker images
uses: docker/build-push-action@v3
with:
Expand All @@ -46,4 +47,4 @@ jobs:
file: ./deployment/containers/taskmaster.Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

...
2 changes: 2 additions & 0 deletions .github/workflows/code_quality.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Code Quality

on:
Expand Down Expand Up @@ -80,3 +81,4 @@ jobs:

- name: Check spellings
run: poetry run typos .
...
8 changes: 7 additions & 1 deletion .github/workflows/code_test_unit.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Code Test Unit

on:
Expand Down Expand Up @@ -25,7 +26,11 @@ jobs:
poetry-export-options: "--with=test"

- name: Run tests and generate coverage as test_unit.xml
run: poetry run pytest --cov-report term --cov-report xml:test_unit.xml --cov=tests/test_unit
run: |
poetry run pytest \
--cov-report term \
--cov-report xml:test_unit.xml \
--cov=tests/test_unit

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand All @@ -35,3 +40,4 @@ jobs:
files: ./test_unit.xml
fail_ci_if_error: true
verbose: true
...
12 changes: 8 additions & 4 deletions .github/workflows/validation_pr.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: PR Evaluation

on:
Expand All @@ -6,10 +7,11 @@ on:
branches: ['main']

jobs:
semantic_pr:
semantic_pr:
name: Semantic PR title
runs-on: ubuntu-latest
if: ${{ github.event.action != 'edited' || github.event.changes.title != null }}
if: ${{ github.event.action != 'edited' ||
github.event.changes.title != null }}
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
Expand All @@ -31,7 +33,8 @@ jobs:
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character & not have more than 50 characters.
doesn't start with an uppercase character & not have more than 50
characters.

detect-unresolved-conflicts:
name: Detect unresolved merge conflicts
Expand All @@ -41,5 +44,6 @@ jobs:
- uses: actions/checkout@v3
- name: List files with merge conflict markers
run: git --no-pager grep "<<<<<<<" ":(exclude).github/" || true
- name: Fail or succeed job if any files with merge conflict markers have been checked in
- name: Fail or succeed job if any files with merge conflict markers
run: exit $(git grep "<<<<<<<" ":(exclude).github/" | wc --lines)
...
2 changes: 2 additions & 0 deletions .github/workflows/vulnerabilities.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Vulnerability Test

on:
Expand Down Expand Up @@ -44,3 +45,4 @@ jobs:

- name: Check dependency vulnerabilities with safety
run: poetry run safety check --full-report
...
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ poetry.toml
# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/python
# End of https://www.toptal.com/developers/gitignore/api/python
22 changes: 11 additions & 11 deletions .safety-policy.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: '3.0'

scanning-settings:
Expand All @@ -9,15 +10,15 @@ scanning-settings:

security:
ignore-vulnerabilities:
65213:
reason: 'Fix is downgrading the pyopenssl package to 21.0.0, doing that breaks all the test.'
expires: '2025-5-18'
67599:
reason: 'No fix available.'
expires: '2025-5-18'
70612:
reason: 'No fix available.'
expires: '2025-5-18'
65213:
reason: 'Need the pyopenssl== 21.0.0, which breaks the test.'
expires: '2025-5-18'
67599:
reason: 'No fix available.'
expires: '2025-5-18'
70612:
reason: 'No fix available.'
expires: '2025-5-18'

report:
dependency-vulnerabilities:
Expand All @@ -28,7 +29,6 @@ report:
unpinned-requirements: true
cvss-severity: []


fail-scan-with-exit-code:
dependency-vulnerabilities:
enabled: true
Expand All @@ -46,4 +46,4 @@ security-updates:
dependency-vulnerabilities:
auto-security-updates-limit:
- patch

...
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ run-service:
exit 1; \
fi

.PHONY: clean-service-image
.PHONY: clean-service-image
clean-service-image:
@if [ -x "$(BUILDAH_CMD)" ]; then \
if $(BUILDAH_CMD) inspect $(ELIXIR_CLOUD_REGISTRY)/tesk-core-$(IMAGE):$(TAG) > /dev/null 2>&1; then \
Expand Down
Loading
Loading