From 560485ab165c5eff78d241807ae6be195391afee Mon Sep 17 00:00:00 2001 From: Ryan Westfall Date: Sun, 5 Jul 2026 07:53:59 -0500 Subject: [PATCH] Split CI into unittests and deploy workflows. Unit Tests runs on pull requests and master pushes; Deploy runs only after Unit Tests succeed on a master push. --- .gitea/workflows/deploy.yml | 28 ++++++---------------------- .gitea/workflows/unittests.yml | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 .gitea/workflows/unittests.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 4a5322f..1cfa003 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,36 +1,20 @@ name: Deploy Company Site on: - push: - branches: [master] - pull_request: + workflow_run: + workflows: [Unit Tests] + types: [completed] branches: [master] jobs: - test: - runs-on: self-hosted - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Python environment - run: | - python3 -m venv .venv - .venv/bin/pip install --upgrade pip - .venv/bin/pip install -r requirements.txt - - - name: Run unit tests - run: | - cd company_site - ../.venv/bin/python manage.py test - deploy: - needs: test - if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/master' + if: gitea.event.workflow_run.conclusion == 'success' && gitea.event.workflow_run.event == 'push' runs-on: self-hosted steps: - name: Checkout uses: actions/checkout@v4 + with: + ref: ${{ gitea.event.workflow_run.head_sha }} - name: Deploy to live site run: bash scripts/deploy.sh "${{ gitea.workspace }}" diff --git a/.gitea/workflows/unittests.yml b/.gitea/workflows/unittests.yml new file mode 100644 index 0000000..961af66 --- /dev/null +++ b/.gitea/workflows/unittests.yml @@ -0,0 +1,25 @@ +name: Unit Tests + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + test: + runs-on: self-hosted + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python environment + run: | + python3 -m venv .venv + .venv/bin/pip install --upgrade pip + .venv/bin/pip install -r requirements.txt + + - name: Run unit tests + run: | + cd company_site + ../.venv/bin/python manage.py test