|
| 1 | +name: kha256 |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, develop] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + FORCE_COLOR: 1 |
| 12 | + |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + name: Test (Python ${{ matrix.python-version }}, ${{ matrix.os }}) |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 21 | + python-version: ["3.11", "3.12", "3.13"] |
| 22 | + exclude: |
| 23 | + - os: windows-latest |
| 24 | + python-version: "3.13" # Windows'ta 3.13 sorunlu olabilir |
| 25 | + include: |
| 26 | + - os: ubuntu-latest |
| 27 | + python-version: "3.14" # Python 3.14 sadece Ubuntu'da test et |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Checkout repository |
| 31 | + uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: Set up Python ${{ matrix.python-version }} |
| 34 | + uses: actions/setup-python@v5 |
| 35 | + with: |
| 36 | + python-version: ${{ matrix.python-version }} |
| 37 | + allow-prereleases: true |
| 38 | + cache: 'pip' # ✅ Cache ekle (hızlandırma) |
| 39 | + |
| 40 | + - name: Install dependencies |
| 41 | + run: | |
| 42 | + python -m pip install --upgrade pip |
| 43 | + pip install flake8 mypy pytest pytest-cov |
| 44 | + pip install . |
| 45 | + |
| 46 | + - name: Lint with Flake8 |
| 47 | + run: | |
| 48 | + # Kod kalitesi kontrolü |
| 49 | + flake8 kha256/ --count --select=E9,F63,F7,F82 --show-source --statistics |
| 50 | + flake8 kha256/ --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics |
| 51 | + |
| 52 | + - name: Type check with MyPy |
| 53 | + run: | |
| 54 | + mypy kha256/ --ignore-missing-imports |
| 55 | + |
| 56 | + - name: Test with pytest |
| 57 | + run: | |
| 58 | + pytest tests/ --cov=kha256 --cov-report=xml --cov-report=html -v |
| 59 | + |
| 60 | + - name: Upload coverage to Codecov |
| 61 | + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' |
| 62 | + uses: codecov/codecov-action@v4 |
| 63 | + with: |
| 64 | + file: ./coverage.xml |
| 65 | + fail_ci_if_error: false |
| 66 | + |
| 67 | + - name: Upload coverage artifacts |
| 68 | + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' |
| 69 | + uses: actions/upload-artifact@v4 |
| 70 | + with: |
| 71 | + name: coverage-report |
| 72 | + path: htmlcov/ |
| 73 | + retention-days: 7 |
| 74 | + |
| 75 | + build: |
| 76 | + name: Build Package |
| 77 | + runs-on: ubuntu-latest |
| 78 | + needs: test # ✅ Testler başarılı olduktan sonra build |
| 79 | + |
| 80 | + steps: |
| 81 | + - name: Checkout repository |
| 82 | + uses: actions/checkout@v4 |
| 83 | + |
| 84 | + - name: Set up Python |
| 85 | + uses: actions/setup-python@v5 |
| 86 | + with: |
| 87 | + python-version: "3.11" |
| 88 | + cache: 'pip' |
| 89 | + |
| 90 | + - name: Install build dependencies |
| 91 | + run: | |
| 92 | + python -m pip install --upgrade pip |
| 93 | + pip install build twine |
| 94 | + |
| 95 | + - name: Build package |
| 96 | + run: | |
| 97 | + python -m build |
| 98 | + |
| 99 | + - name: Check package |
| 100 | + run: | |
| 101 | + twine check dist/* |
| 102 | + |
| 103 | + - name: Upload build artifacts |
| 104 | + uses: actions/upload-artifact@v4 |
| 105 | + with: |
| 106 | + name: package-dist |
| 107 | + path: dist/ |
| 108 | + retention-days: 7 |
0 commit comments