0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-07-24 16:05:33 +02:00

api and selenuim tests triggered

This commit is contained in:
moslem-asaad 2025-02-28 17:08:13 +02:00
parent 0aa505a010
commit 130fe33053
2 changed files with 129 additions and 0 deletions

75
.github/workflows/test-runner.yaml vendored Normal file
View File

@ -0,0 +1,75 @@
name: Run API & Selenium Tests Separately
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
jobs:
api-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Pull Latest Test Image
run: docker pull moslemasaad/gitea-test-automation
- name: Run API Tests
run: |
cd Gitea-Test-Automation
docker-compose up --exit-code-from api-test-runner api-test-runner
- name: Stop API Containers
run: |
cd Gitea-Test-Automation
docker-compose down
selenium-tests:
runs-on: ubuntu-latest
needs: api-tests
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Pull Latest Test Image
run: docker pull moslemasaad/gitea-test-automation
- name: Start Selenium Grid & Run Selenium Tests
run: |
cd Gitea-Test-Automation
docker-compose up --exit-code-from selenium-test-runner selenium-hub chrome-node firefox-node selenium-test-runner
- name: Stop Selenium Containers
run: |
cd Gitea-Test-Automation
docker-compose down

View File

@ -0,0 +1,54 @@
version: "3.8"
services:
# API Test Runner - Runs first, then stops
api-test-runner:
image: moslemasaad/gitea-test-automation
container_name: api-test-runner
environment:
- GITEA_API_TOKEN=9829d39ece8b5ad3a7dcf2c8b273b55043ceaca6
- Password=80517moslem
command: mvn clean test -Dtest=**/apiTests/*
# Selenium Grid Hub
selenium-hub:
image: selenium/hub:latest
container_name: selenium-hub
ports:
- "4444:4444"
# Chrome Node
chrome-node:
image: selenium/node-chrome:latest
container_name: selenium-chrome
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
shm_size: "2g"
# Firefox Node
firefox-node:
image: selenium/node-firefox:latest
container_name: selenium-firefox
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
shm_size: "2g"
# Selenium Test Runner - Runs after API tests
selenium-test-runner:
image: moslemasaad/gitea-test-automation
container_name: selenium-test-runner
depends_on:
- selenium-hub
environment:
- GITEA_API_TOKEN=9829d39ece8b5ad3a7dcf2c8b273b55043ceaca6
- Password=80517moslem
- GRID_URL=http://selenium-hub:4444/
command: mvn clean test -Dtest=**/seleniumTests/*