From 98ef38c352556da4c9511108701a818fa64fc8a2 Mon Sep 17 00:00:00 2001 From: moslem-asaad Date: Wed, 5 Mar 2025 11:42:26 +0200 Subject: [PATCH] integration env --- .github/workflows/build.yml | 2 +- .github/workflows/load-test.yml | 54 ++++----- .github/workflows/notification-service.yml | 3 - .github/workflows/preproduction.yml | 122 +++++++++++++++++++++ .github/workflows/test-runner.yaml | 3 - 5 files changed, 150 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/preproduction.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84dc4182e3..90842a51aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Build and Test on: push: - branches: [ main, dev ] + branches: [ dev ] jobs: build: diff --git a/.github/workflows/load-test.yml b/.github/workflows/load-test.yml index 9b674303c1..133ae457eb 100644 --- a/.github/workflows/load-test.yml +++ b/.github/workflows/load-test.yml @@ -1,32 +1,32 @@ -name: Load Testing with JMeter +# name: Load Testing with JMeter -on: - push: - branches: - - main +# on: +# push: +# branches: +# - main -permissions: - contents: read - actions: read - checks: write +# 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 +# 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/apache-jmeter-action@v0.5.0 - with: - testFilePath: tests/jmeter/gite-test-plan.jmx - outputReportsFolder: reports/ - args: "--loglevel INFO" +# - name: Run JMeter Action on a test +# uses: rbhadti94/apache-jmeter-action@v0.5.0 +# 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/ \ No newline at end of file +# - name: Upload JMeter Test Results +# uses: actions/upload-artifact@v4 +# with: +# name: jmeter-test-results +# path: reports/ \ No newline at end of file diff --git a/.github/workflows/notification-service.yml b/.github/workflows/notification-service.yml index 0ecb804db3..6350117d0c 100644 --- a/.github/workflows/notification-service.yml +++ b/.github/workflows/notification-service.yml @@ -1,9 +1,6 @@ name: Run Notification Service Tests on: - push: - branches: - - main pull_request: branches: - main diff --git a/.github/workflows/preproduction.yml b/.github/workflows/preproduction.yml new file mode 100644 index 0000000000..8545a737fd --- /dev/null +++ b/.github/workflows/preproduction.yml @@ -0,0 +1,122 @@ +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/apache-jmeter-action@v0.5.0 + 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/ \ No newline at end of file diff --git a/.github/workflows/test-runner.yaml b/.github/workflows/test-runner.yaml index 1f0bb9f3e3..b6f7f6aba0 100644 --- a/.github/workflows/test-runner.yaml +++ b/.github/workflows/test-runner.yaml @@ -1,9 +1,6 @@ name: Run API & Selenium Tests Separately on: - push: - branches: - - main pull_request: branches: - main