Skip to content

Integration #34557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and Test

on:
push:
branches: [ dev ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go environment
uses: actions/setup-go@v3
with:
go-version: '1.23.4'

- name: Install dependencies
run: go mod download

- name: Run unit tests
run: go test ./... -v
continue-on-error: true

- name: Run linting
run: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run

- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/gitea:latest .

- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push Docker image
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/gitea:latest

28 changes: 28 additions & 0 deletions .github/workflows/notification-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Run Notification Service Tests

on:
pull_request:
branches:
- main

jobs:
notification-service-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: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Pull Latest notification service Image
run: docker pull moslemasaad/gitea-notificator

- name: Run Tests
run: docker run --rm moslemasaad/gitea-notificator test
185 changes: 185 additions & 0 deletions .github/workflows/preproduction.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
name: Pre Production tests

on:
push:
branches:
- main

permissions:
contents: read
actions: read
checks: write

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

notification-service-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: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Pull Latest notification service Image
run: docker pull moslemasaad/gitea-notificator

- name: Run Tests
run: docker run --rm moslemasaad/gitea-notificator test

jmeter:
name: Run JMeter Tests
needs: [api-tests, selenium-tests, notification-service-tests]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run JMeter Action on a test
uses: rbhadti94/[email protected]
with:
testFilePath: tests/jmeter/gite-test-plan.jmx
outputReportsFolder: reports/
args: "--loglevel INFO"

- name: Upload JMeter Test Results
uses: actions/upload-artifact@v4
with:
name: jmeter-test-results
path: reports/

lighthouse-tests:
runs-on: ubuntu-latest
needs: [api-tests, selenium-tests, notification-service-tests]
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Install Lighthouse CLI
run: npm install -g lighthouse

- name: Run Lighthouse Performance Audit
run: |
mkdir -p reports
lighthouse https://fox-one-promptly.ngrok-free.app \
--output=json \
--output=html \
--output-path=reports/lighthouse.html \
--chrome-flags="--headless"

- name: Debug - List Files
run: ls -alh reports

- name: Upload Lighthouse Report
uses: actions/upload-artifact@v4
with:
name: lighthouse-report
path: reports/lighthouse.report.html



# name: Load Testing with JMeter

# on:
# push:
# branches:
# - main

# permissions:
# contents: read
# actions: read
# checks: write

# jobs:
# jmeter:
# name: Run JMeter Tests
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Run JMeter Action on a test
# uses: rbhadti94/[email protected]
# with:
# testFilePath: tests/jmeter/gite-test-plan.jmx
# outputReportsFolder: reports/
# args: "--loglevel INFO"

# - name: Upload JMeter Test Results
# uses: actions/upload-artifact@v4
# with:
# name: jmeter-test-results
# path: reports/
74 changes: 74 additions & 0 deletions .github/workflows/test-runner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Run API & Selenium Tests Separately

on:
pull_request:
branches:
- main

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
54 changes: 54 additions & 0 deletions Gitea-Test-Automation/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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/*
Loading
Loading