From f423defca91d0bda2626b6f33061cc3f1b7a651d Mon Sep 17 00:00:00 2001 From: Skulldorom <51134009+Skulldorom@users.noreply.github.com> Date: Mon, 20 Jul 2026 13:28:38 +0300 Subject: [PATCH] ci: split test and Docker workflows for independent maintenance - Extract tests into .github/workflows/test.yml (runs on PR + push to main) - Docker build+push now triggers via workflow_run only when tests pass on main - Tests can run without building an image; build+push gated behind test success - Update README badge to point to test.yml --- .github/workflows/docker.yml | 32 +++++--------------------------- .github/workflows/test.yml | 29 +++++++++++++++++++++++++++++ README.md | 3 ++- 3 files changed, 36 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b34481e..c16b826 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,36 +1,14 @@ -name: Test, Build, and Push Docker image +name: Build and Push Docker image on: - pull_request: - push: + workflow_run: + workflows: ["Test"] + types: [completed] branches: [main] jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v6 - with: - enable-cache: true - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version-file: .python-version - - - name: Install dependencies - run: uv sync --frozen - - - name: Run tests - run: uv run pytest - build-push: - needs: test - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + if: github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..8cfe081 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,29 @@ +name: Test + +on: + pull_request: + push: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version-file: .python-version + + - name: Install dependencies + run: uv sync --frozen + + - name: Run tests + run: uv run pytest diff --git a/README.md b/README.md index 523e9b8..a0137af 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # rss-api -[![Tests](https://github.com/Skulldorom/rss-api/actions/workflows/docker.yml/badge.svg)](https://github.com/Skulldorom/rss-api/actions/workflows/docker.yml) +[![Tests](https://github.com/Skulldorom/rss-api/actions/workflows/test.yml/badge.svg)](https://github.com/Skulldorom/rss-api/actions/workflows/test.yml) +[![Docker](https://github.com/Skulldorom/rss-api/actions/workflows/docker.yml/badge.svg)](https://github.com/Skulldorom/rss-api/actions/workflows/docker.yml) Simple API to fetch rss feeds for github releases using fresh rss (powered by FastAPI)