aligned dev setup with github action #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install dependencies | |
| run: | | |
| uv sync --all-groups | |
| - name: Run tests | |
| run: | | |
| uv run pytest -v | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install dependencies | |
| run: | | |
| uv sync --all-groups | |
| - name: Run trailing-whitespace | |
| run: | | |
| # Check for trailing whitespace | |
| if git grep -n '[[:space:]]$' -- '*.py' '*.yml' '*.yaml' '*.md' '*.txt' '*.json' '*.toml'; then | |
| echo "Error: Found trailing whitespace in files" | |
| exit 1 | |
| fi | |
| echo "No trailing whitespace found" | |
| - name: Run end-of-file-fixer | |
| run: | | |
| # Check for missing newline at end of files | |
| for file in $(git ls-files -- '*.py' '*.yml' '*.yaml' '*.md' '*.txt' '*.json' '*.toml'); do | |
| if [ -s "$file" ] && [ "$(tail -c 1 "$file" | wc -l)" -eq 0 ]; then | |
| echo "Error: Missing newline at end of $file" | |
| exit 1 | |
| fi | |
| done | |
| echo "All files end with proper newlines" | |
| - name: Run check-yaml | |
| run: | | |
| # Check YAML syntax | |
| for file in $(git ls-files -- '*.yml' '*.yaml'); do | |
| python -c "import yaml; yaml.safe_load(open('$file'))" || { | |
| echo "Error: Invalid YAML syntax in $file" | |
| exit 1 | |
| } | |
| done | |
| echo "All YAML files are valid" | |
| - name: Run check-merge-conflict | |
| run: | | |
| # Check for merge conflict markers | |
| if git grep -n '^<<<<<<< ' -- '*.py' '*.yml' '*.yaml' '*.md' '*.txt' '*.json' '*.toml'; then | |
| echo "Error: Found merge conflict markers" | |
| exit 1 | |
| fi | |
| echo "No merge conflict markers found" | |
| - name: Run pycln (remove unused imports) | |
| run: | | |
| uv pip install pycln | |
| uv run pycln --all --check odf_decrypt | |
| - name: Run isort (import sorting) | |
| run: | | |
| uv pip install isort | |
| uv run isort --profile black --check-only odf_decrypt | |
| - name: Run black (code formatting) | |
| run: | | |
| uv run black --check . | |
| - name: Run flake8 (linting) | |
| run: | | |
| uv run flake8 odf_decrypt --extend-ignore=E203,E501 |