diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e53c513 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: CI +on: + push: + branches: [ main, feature/LukianenkoVs ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install dependencies + run: pip install pytest + + - name: Run tests + run: | + cd practice/2_cicd + pytest diff --git a/.github/workflows/test-pipeline.yml b/.github/workflows/release-v2.yml similarity index 100% rename from .github/workflows/test-pipeline.yml rename to .github/workflows/release-v2.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7de7ac5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +name: Release + +on: + push: + tags: + - 'v*.*.*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build project + run: echo "Собираем проект..." + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + name: Release ${ { github.ref_name } } + body: Автоматический релиз новой версии diff --git a/Lukianenko/README.md b/Lukianenko/README.md new file mode 100644 index 0000000..8235900 --- /dev/null +++ b/Lukianenko/README.md @@ -0,0 +1 @@ +# Hello, git diff --git a/LukianenkoVs/README.md b/LukianenkoVs/README.md new file mode 100644 index 0000000..2fb36d8 --- /dev/null +++ b/LukianenkoVs/README.md @@ -0,0 +1 @@ +# Hello, git! diff --git a/hello.py b/hello.py new file mode 100644 index 0000000..b811495 --- /dev/null +++ b/hello.py @@ -0,0 +1,2 @@ +def hello(): + return "Hello CI/CD" diff --git a/practice/2_cicd/.github/workflows/ci.yml b/practice/2_cicd/.github/workflows/ci.yml new file mode 100644 index 0000000..ce77de1 --- /dev/null +++ b/practice/2_cicd/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: CI Pipeline + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + cd practice/2_cicd + pip install -r requirements.txt + + - name: Run tests + run: | + cd practice/2_cicd + python -m pytest test_main.py -v diff --git a/practice/2_cicd/__pycache__/main.cpython-312.pyc b/practice/2_cicd/__pycache__/main.cpython-312.pyc new file mode 100644 index 0000000..98b6262 Binary files /dev/null and b/practice/2_cicd/__pycache__/main.cpython-312.pyc differ diff --git a/practice/2_cicd/__pycache__/test_main.cpython-312-pytest-9.0.2.pyc b/practice/2_cicd/__pycache__/test_main.cpython-312-pytest-9.0.2.pyc new file mode 100644 index 0000000..521db9a Binary files /dev/null and b/practice/2_cicd/__pycache__/test_main.cpython-312-pytest-9.0.2.pyc differ diff --git a/practice/2_cicd/main.py b/practice/2_cicd/main.py new file mode 100644 index 0000000..d5312f2 --- /dev/null +++ b/practice/2_cicd/main.py @@ -0,0 +1,2 @@ +def hello(): + return 'Hello, CI/CD!' diff --git a/practice/2_cicd/test_main.py b/practice/2_cicd/test_main.py new file mode 100644 index 0000000..ea182c2 --- /dev/null +++ b/practice/2_cicd/test_main.py @@ -0,0 +1,4 @@ +from main import hello + +def test_hello(): + assert hello() == 'Hello, CI/CD!'