Links
Comment on page
🔄

Continuous İntegration (CI)

Python ve GitHub üzerinde sürekli entegrasyon, otomatik testler ve pytest kullanımı

👀 Hızlı Bakış

📂 CI Dizini Oluşturma

  • 👨‍💼 Daha verimli çalışma adına CI dosyaları aynı dizinde toplanır

📃 Gereksinimleri tanımlama

requirements.txt
pytest
wheel
flake8

🏗️ Kurulum işlemlerini tanımlama

✴️ Windows
🐧 Linux
ci\install.bat
python -m venv venv
call venv\Scripts\activate.bat
python -m pip install --upgrade pip
python -m pip install --upgrade -r .\ci\requirements.txt
python -m pip install --upgrade .
call deactivate
ci/install.sh
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade -r ./ci/requirements.txt
python3 -m pip install --upgrade .

⚗️ Test işlemlerini tanımlama

✴️ Windows
🐧 Linux
ci\test.bat
call venv\Scripts\activate.bat
pytest
call deactivate
ci/test.sh
pytest

🧪 Kod kalitesini test etme

✴️ Windows
🐧 Linux
ci/quality_test.bat
call venv\Scripts\activate.bat
flake8 --exclude=venv* --statistics
call deactivate
ci/quality_test.sh
flake8 --exclude=venv* --statistics

👷‍♂️ Derleme işlemleri

✴️ Windows
🐧 Linux
ci/build.bat
call venv\Scripts\activate.bat
python setup.py sdist bdist_wheel
call deactivate
ci/build.sh
python3 setup.py sdist bdist_wheel

🛰️ Yayınlama işlemleri

✴️ Windows
🐧 Linux
ci/upload.bat
call venv\Scripts\activate.bat
twine upload dist/*
call deactivate
ci/upload.sh
twine upload dist/*

🔀 GitHub Workflow Oluşturma

.github/workflows/pythonpackage.yml
name: 🕵️‍♂️ Continuous integration
on: [pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
fail-fast: false # 1 test başarısız olursa diğerleri kapanmaz
matrix:
python-version: [3.8]
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
INSTALL: .\ci\install.bat
TEST: .\ci\test.bat
QUALITY_TEST: .\ci\quality_test.bat
- os: macos-latest
INSTALL: |
chmod u+x ./ci/install.sh &&
./ci/install.sh
TEST: |
chmod u+x ./ci/test.sh &&
./ci/test.sh
QUALITY_TEST: |
chmod u+x ./ci/quality_test.sh &&
./ci/quality_test.sh
- os: ubuntu-latest
INSTALL: |
chmod u+x ./ci/install.sh &&
./ci/install.sh
TEST: |
chmod u+x ./ci/test.sh &&
./ci/test.sh
QUALITY_TEST: |
chmod u+x ./ci/quality_test.sh &&
./ci/quality_test.sh
steps:
- uses: actions/checkout@v1
- name: 🏗️ Python ${{ matrix.python-version }} setup
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: 📦 Installing dependencies
run: |
${{matrix.INSTALL}}
- name: ⚗️ Functional testing
run: |
${{matrix.TEST}}
- name: 🧐 Python code style testing
run: |
${{matrix.QUALITY_TEST}}

👮‍♂️ Branch Korumasını Ayarlama

  • ⚙️ Projenizin Settings kısmından Branch sekmesinde Add rule butonuna tıklayın
  • 💁‍♂️ Eğer zaten bir kural varsa, Edit butonuna tıklayabilirsiniz
  • 👇 Açılan ekranda alttaki resimde kırmızı oklarla gösterilen ayarlamaları yapın
  • 🚀 Artık durum kontrolü yapılmadan projeye merge edilemeyecek

🔗 Faydalı Linkler

🚀 Bu alandaki bağlantılar YEmoji ~Bağlantılar yapısına uygundur
2023 © Yunus Emre AK