diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..ab3eee9 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,26 @@ +name: Release + +on: + push: + tags: + - 'v*.*.*' + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build project + run: echo "Building..." + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + name: Release ${{ github.ref_name }} + body: Автоматический релиз новой версии + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9087a3a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + +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: pytest diff --git a/.github/workflows/test-pipeline.yml b/.github/workflows/test-pipeline.yml index b16d2ae..a2f528e 100644 --- a/.github/workflows/test-pipeline.yml +++ b/.github/workflows/test-pipeline.yml @@ -2,17 +2,15 @@ name: Test pipeline run-name: Testing our repository on: [push] jobs: - Build: + build: runs-on: ubuntu-latest steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - - name: Check out repository code - uses: actions/checkout@v5 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository - run: | - ls ${{ github.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." + - uses: actions/checkout@v4 + - run: make build + + test: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v4 + - run: make test diff --git a/main.py b/main.py new file mode 100644 index 0000000..5c251f3 --- /dev/null +++ b/main.py @@ -0,0 +1,2 @@ +def hello(): + return "Hello, CI/CD!" diff --git a/test_main.py b/test_main.py new file mode 100644 index 0000000..c49be78 --- /dev/null +++ b/test_main.py @@ -0,0 +1,4 @@ +from main import hello + +def test_hello(): + assert hello() == "Hello, CI/CD!"