Skip to content

Commit

Permalink
add db-dist job to test and build pipeline on develop
Browse files Browse the repository at this point in the history
  • Loading branch information
erikspears committed Nov 18, 2024
1 parent 0a9534f commit fea0c02
Showing 1 changed file with 70 additions and 1 deletion.
71 changes: 70 additions & 1 deletion .github/workflows/test-build-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
- README.md
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
unit-tests:
runs-on: ubuntu-latest
Expand All @@ -29,9 +33,74 @@ jobs:
- name: Run the Unit Tests
run: pytest

qa-suite:
db-dist:
needs: unit-tests
runs-on: ubuntu-latest
concurrency: db-dist-cgos
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout the Code
uses: actions/checkout@v4
- name: Pull the Latest (for just this branch)
run: git pull origin ${{ github.ref_name }}
- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: '3.12.6'
cache: 'pip'
- name: Install Swirl (with a timeout)
run: ./install.sh
timeout-minutes: 10
- name: Delete the db.sqlite3 File
run: rm db.sqlite3
- name: Setup Swirl
run: python swirl.py setup
- name: Create the Superuser
run: DJANGO_SUPERUSER_PASSWORD=password python manage.py createsuperuser --email [email protected] --username admin --noinput
- name: Start Swirl
run: python swirl.py start
- name: Load the Default SearchProviders
run: python swirl_load.py -u admin -p password -s http://localhost:8000/ 'SearchProviders/preloaded.json'
- name: Stop Swirl
run: python swirl.py stop
- name: Create a New db.dist File
run: cp db.sqlite3 db.sqlite3.dist
- name: Create a Pull Request
id: createpr
uses: peter-evans/create-pull-request@v7
with:
add-paths: db.sqlite3.dist
branch: db_dist/autoupdate
delete-branch: true
commit-message: Update the db.sqlite3.dist file
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
title: 'New db.sqlite3.dist generated by a db-dist.yml workflow'
body: |
New `db.sqlite3.dist` file generated by GitHub Action run ${{ github.run_number }}
- name: Auto-Approve the PR
if: steps.createpr.outputs.pull-request-operation == 'created'
run: |
echo "${{ secrets.GH_ACTIONS_TOKEN }}" | gh auth login --with-token
gh pr review --approve "${{ steps.createpr.outputs.pull-request-number }}"
- name: Auto-Merge the PR
if: steps.createpr.outputs.pull-request-operation == 'created'
run: |
echo "${{ secrets.GH_ACTIONS_TOKEN }}" | gh auth login --with-token
gh pr merge --merge --auto "${{ steps.createpr.outputs.pull-request-number }}"
qa-suite:
needs: db-dist
runs-on: ubuntu-latest
services:
redis:
image: redis
Expand Down

0 comments on commit fea0c02

Please sign in to comment.