Skip to content
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
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Test

on:
push:
branches: [ dev ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code

Check failure on line 12 in .github/workflows/build.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

12:5 [indentation] wrong indentation: expected 6 but found 4
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

Check failure on line 28 in .github/workflows/notification-service.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

28:64 [new-line-at-end-of-file] no new line character at the end of file
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]

Check failure on line 105 in .github/workflows/preproduction.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

105:67 [trailing-spaces] trailing spaces
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/

Check failure on line 123 in .github/workflows/preproduction.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

123:1 [trailing-spaces] trailing spaces
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



Check failure on line 153 in .github/workflows/preproduction.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

153:1 [empty-lines] too many blank lines (3 > 1)
# name: Load Testing with JMeter

Check failure on line 154 in .github/workflows/preproduction.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

154:1 [comments-indentation] comment not indented like content

# 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/

Check failure on line 185 in .github/workflows/preproduction.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

185:27 [new-line-at-end-of-file] no new line character at the end of file
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/*

Check failure on line 12 in Gitea-Test-Automation/docker-compose.yaml

View workflow job for this annotation

GitHub Actions / lint-yaml

12:1 [trailing-spaces] trailing spaces
# 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