Skip to content

Commit

Permalink
Update tagging logic and add flake8 linter (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
magdyksaleh authored Mar 29, 2024
1 parent e4ad9a7 commit bdb3297
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=,suffix=,format=short
type=raw,value=latest
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}
- name: Create a hash from tags
env:
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/server_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,28 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Adding actions/checkout@v2
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Get changed files
id: changed_files
run: |
echo "files=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -E '*.py$' | tr '\n' ' ')"
echo "files=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -E '*.py$' | tr '\n' ' ')" >> $GITHUB_OUTPUT
- name: Run flake8 on changed files
if: steps.changed_files.outputs.files != ''
run: |
pip install flake8
echo running linter on: ${{ steps.changed_files.outputs.files }}
flake8 ${{ steps.changed_files.outputs.files }}
- name: Install Protoc
uses: arduino/setup-protoc@v1
- name: Filter test dependencies
Expand Down
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0 # Use the latest revision
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/psf/black
rev: 24.2.0
hooks:
- id: black
name: Format code
args:
- --line-length=120
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8

0 comments on commit bdb3297

Please sign in to comment.