From f328eb3ba5418da50d95c254029aa96686543c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vit=C3=B3rio=20A=2E=20Cavalheiro?= Date: Fri, 10 Oct 2025 08:33:00 -0300 Subject: [PATCH] ci: add CI workflow and branch deletion automation Add GitHub Actions workflows for continuous integration testing and automated deletion of merged branches. The CI workflow includes steps for Python setup, dependency installation with Poetry, running tests, and linting with Black, isort, and detect-secrets. The branch deletion workflow removes merged branches upon PR closure. --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++++++ .github/workflows/delete-branch.yml | 19 ++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/delete-branch.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f118a5b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: + push: + branches: [ main, development ] + pull_request: + branches: [ main, development ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.13' + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: Install dependencies + run: | + poetry config virtualenvs.create false + poetry install --with dev + - name: Install pytest + run: poetry add --group dev pytest + - name: Run tests + run: poetry run pytest + - name: Run linting + run: | + poetry run black --check . + poetry run isort --check-only . + poetry run detect-secrets scan \ No newline at end of file diff --git a/.github/workflows/delete-branch.yml b/.github/workflows/delete-branch.yml new file mode 100644 index 0000000..56d5a61 --- /dev/null +++ b/.github/workflows/delete-branch.yml @@ -0,0 +1,19 @@ +name: Delete merged branch + +on: + pull_request: + types: [closed] + +permissions: + contents: write + +jobs: + delete-branch: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Delete merged branch + run: gh branch delete ${{ github.head_ref }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + \ No newline at end of file