Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit bd2bc786 authored by Bennet Sundaramurthy's avatar Bennet Sundaramurthy Committed by rui rodrigues
Browse files

Pipeline Improvements

parent 6efe5f71
No related branches found
No related tags found
No related merge requests found
# Define default image to use
default:
image: mcr.microsoft.com/playwright/java:v1.43.0-jammy
# Define stages in the pipeline
stages:
- test
- quality
- test
- report
# SonarQube quality check job
sonarqube-check:
stage: quality
image: mcr.microsoft.com/playwright:v1.46.1-jammy # Use the Playwright image based on Ubuntu 22.04
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
GIT_DEPTH: "0"
cache:
key: "${CI_JOB_NAME}"
paths:
- .m2/repository
- .sonar/cache
before_script:
# Install Maven manually
- apt-get update && apt-get install -y maven
- mkdir -p ~/.m2
- echo '<settings><mirrors><mirror><id>central</id><url>https://repo.maven.apache.org/maven2</url><mirrorOf>central</mirrorOf></mirror></mirrors></settings>' > ~/.m2/settings.xml
# Install Xvfb and necessary 32-bit libraries for Java AWT
- dpkg --add-architecture i386 # Enable 32-bit architecture
- apt-get update && apt-get install -y xvfb libxtst6:i386 libxi6:i386 libxrender1:i386 libxrandr2:i386 libfreetype6:i386 libfontconfig1:i386
script:
# Start Xvfb
- export DISPLAY=:99
- Xvfb :99 -screen 0 1024x768x24 &
- mvn verify sonar:sonar -Dsonar.projectKey=pso-test-automation
tags:
- pso
allow_failure: true
only:
- develop
# Job to run tests on PRs
pr_test_job:
stage: test
image: mcr.microsoft.com/playwright:v1.46.1-jammy # Use the Playwright image based on Ubuntu 22.04
cache:
key: "${CI_JOB_NAME}"
paths:
- target/*
before_script:
# Export the contents of masked file variable containing config properties to src/main/resources/config.properties after applying a couple of translations
- cat "$CONFIG_FILE_VAR" | sed -e 's/-LF-/\n/g' | sed -e 's/-WS-/ /g' > src/main/resources/config.properties
# Install Maven manually
- apt-get update && apt-get install -y maven
- mkdir -p ~/.m2
- echo '<settings><mirrors><mirror><id>central</id><url>https://repo.maven.apache.org/maven2</url><mirrorOf>central</mirrorOf></mirror></mirrors></settings>' > ~/.m2/settings.xml
# Install Xvfb and necessary 32-bit libraries for Java AWT
- dpkg --add-architecture i386 # Enable 32-bit architecture
- apt-get update && apt-get install -y xvfb libxtst6:i386 libxi6:i386 libxrender1:i386 libxrandr2:i386 libfreetype6:i386 libfontconfig1:i386
- apt-get install -y default-jre
script:
# Start Xvfb
- export DISPLAY=:99
- Xvfb :99 -screen 0 1024x768x24 &
# Run the tests using the specified Cucumber runner and tags
- mvn clean test -Dtest=UiSimplOpenRunner -Dcucumber.filter.tags="@wizard"
# Install atf-reports artifact with jar and pom
- mvn org.apache.maven.plugins:maven-install-plugin:3.1.3:install-file -Dfile=./reports-plugin/atf-reports-1.1.0.jar -DpomFile=./reports-plugin/atf-reports-1.1.0.pom
# Install maven-atf-reports artifact with jar and pom
- mvn org.apache.maven.plugins:maven-install-plugin:3.1.3:install-file -Dfile=./reports-plugin/maven-atf-reports-1.0.0.jar -DpomFile=./reports-plugin/maven-atf-reports-1.0.0.pom
# Generate the HTML report using the maven-atf-reports plugin
- mvn com.qa.atf.reports:maven-atf-reports:1.0.0:generate@execution
tags:
- pso
artifacts:
when: always
paths:
- target/cucumber-reports/cucumber.json # JSON report if needed
- target/pluma-report/* # HTML and related resource files
expire_in: 1 week
allow_failure: false
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
include:
- local: '/includes/sonarqube_check.yml'
- local: '/includes/test_job.yml'
- local: '/includes/report_job.yml'
# Job to report test results on Merge Requests and on Schedule
report_job:
stage: report
before_script:
# Install atf-reports artifact with jar and pom
- mvn org.apache.maven.plugins:maven-install-plugin:3.1.3:install-file -Dfile=./reports-plugin/atf-reports-1.1.0.jar -DpomFile=./reports-plugin/atf-reports-1.1.0.pom
# Install maven-atf-reports artifact with jar and pom
- mvn org.apache.maven.plugins:maven-install-plugin:3.1.3:install-file -Dfile=./reports-plugin/maven-atf-reports-1.0.0.jar -DpomFile=./reports-plugin/maven-atf-reports-1.0.0.pom
script:
# Generate the HTML report using the maven-atf-reports plugin
- mvn com.qa.atf.reports:maven-atf-reports:1.0.0:generate@execution
tags:
- pso
artifacts:
when: always
paths:
- ./target/pluma-report/* # HTML and related resource files
expire_in: 1 week
allow_failure: false
rules:
- if: ($CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "schedule")
# SonarQube quality check job - To do
sonarqube_check:
stage: quality
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
GIT_DEPTH: "0"
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
# - mvn verify sonar:sonar -Dsonar.projectKey=pso-test-automation
- mvn verify sonar:sonar -Dsonar.host.url=${SONAR_HOST_URL} -Dsonar.token=${SONAR_TOKEN} -Dsonar.projectKey=pso-test-automation -Dsonar.projectName=pso-test-automation
tags:
- pso
allow_failure: true
only:
- develop
# Job to run tests on Merge Requests and on Schedule
test_job:
stage: test
before_script:
# Export the contents of masked file variable containing config properties to src/main/resources/config.properties after applying a couple of translations
- cat "$CONFIG_FILE_VAR" | sed -e 's/-LF-/\n/g' | sed -e 's/-WS-/ /g' > ./src/main/resources/config.properties
script:
# Run the tests in headed mode using the specified Cucumber runner and tags
- xvfb-run mvn clean test -Dtest=UiSimplOpenRunner -Dcucumber.filter.tags="@wizard"
artifacts:
paths:
- ./target/*
expire_in: 60 mins
tags:
- pso
allow_failure: false
rules:
- if: ($CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "schedule")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment