fix flake8 #60
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: check | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # Fetch all history and tags | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| pip install . | |
| pip install -e .[dev] | |
| - name: Run tests | |
| run: | | |
| pytest --cov=pycoupler --cov-report=xml | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Check code formatting with Black | |
| run: | | |
| black --check . | |
| - name: Lint code with Flake8 | |
| run: | | |
| flake8 . | |
| - name: Debug version detection | |
| run: | | |
| echo "Git describe: $(git describe --tags --abbrev=0)" | |
| echo "Git describe full: $(git describe --tags)" | |
| echo "Current commit: $(git rev-parse HEAD)" | |
| echo "Latest tag: $(git tag --sort=-version:refname | head -1)" | |
| echo "Is on tag: $(git describe --exact-match HEAD 2>/dev/null || echo 'No exact match')" | |
| - name: Update CITATION.cff with current version | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| # Update CITATION.cff with current version using our script | |
| python3 scripts/update_citation.py | |
| # Commit and push changes if there are any | |
| if ! git diff --quiet CITATION.cff; then | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add CITATION.cff | |
| git commit -m "Update CITATION.cff to current version [skip ci]" | |
| git push | |
| else | |
| echo "No changes to CITATION.cff needed" | |
| fi | |
| - name: Build package | |
| run: | | |
| python -m build | |
| - name: Check package | |
| run: | | |
| twine check dist/* | |
| - name: Test package installation | |
| run: | | |
| pip install dist/*.whl | |
| python -c "import pycoupler; print(f'pycoupler version: {pycoupler.__version__}')" | |
| - name: Publish to PyPI | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: twine upload dist/* |