diff --git a/.github/workflows/github-actions-build.yml b/.github/workflows/github-actions-build.yml new file mode 100644 index 0000000..9ad3350 --- /dev/null +++ b/.github/workflows/github-actions-build.yml @@ -0,0 +1,46 @@ +name: Java CI + +# Trigger workflow on push or pull_request +# Note - the first pull_request from a forked repo will need to be given approval to run +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + + - name: Cache Maven Repo + uses: actions/cache@v4 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Build Test and Verify + run: mvn -B -U clean install + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'adopt' + + - name: SonarCloud Scan + run: | + if ["$SONAR_TOKEN" == ""]; then + echo "Sonar secure variables NOT available" + else + echo "Sonar secure variables ARE available" + mvn -B sonar:sonar -Dsonar.projectKey="bordertech-sample-app" -Dsonar.organization="bordertech-github" -Dsonar.host.url="https://sonarcloud.io" + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fa32822..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -dist: trusty - -cache: - directories: - - $HOME/.m2 - -addons: - chrome: stable - sonarcloud: - organization: "bordertech-github" - token: $SONAR_TOKEN - -before_install: -- echo "MAVEN_OPTS='-Xmx512m -XX:MaxPermSize=128m'" > ~/.mavenrc -- mvn clean -## Chromedriver setup -- wget -N http://chromedriver.storage.googleapis.com/80.0.3987.106/chromedriver_linux64.zip -P ~/ -- unzip ~/chromedriver_linux64.zip -d ~/ -- rm ~/chromedriver_linux64.zip -- sudo mv -f ~/chromedriver /usr/local/share/ -- sudo chmod +x /usr/local/share/chromedriver -- sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver - -language: Java -jdk: - - oraclejdk8 - -## Travis installs the project with the following maven command:- "mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V" -script: - - mvn package sonar:sonar -Dsonar.projectKey="bordertech-sample-app" diff --git a/README.md b/README.md index 39f360a..3cf3eeb 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Sample application demonstrates how a project can be structured with RESTful ser This project can be cloned as a template. ## Status -[![Build Status](https://travis-ci.com/BorderTech/sample-app.svg?branch=master)](https://travis-ci.com/BorderTech/sample-app) +[![Java CI](https://github.com/BorderTech/sample-app/actions/workflows/github-actions-build.yml/badge.svg)](https://github.com/BorderTech/sample-app/actions/workflows/github-actions-build.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bordertech-sample-app&metric=alert_status)](https://sonarcloud.io/dashboard?id=bordertech-sample-app) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=bordertech-sample-app&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=bordertech-sample-app) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=bordertech-sample-app&metric=coverage)](https://sonarcloud.io/dashboard?id=bordertech-sample-app) @@ -19,18 +19,7 @@ Follow these commands to fetch the source and build: 1. git clone https://github.com/BorderTech/sample-app.git my-dir (first time only) 2. cd my-dir - -#### Quick build - -Quick build profile has QA and Tests turned off - -3. ```mvn install -Pquick-build``` - -#### Full build - -On windows make sure chromedriver is in PATH, on *NIX in current user profile. Otherwise provide system property `-Dwebdriver.chrome.driver`. See [ChromeDriver](https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver) for more information. - -4. ```mvn install -Dwebdriver.chrome.driver=/path/to/chromedriver.exe``` +3. mvn clean install -Pquick-build (The profile quick-build has QA and Tests turned off) ### Run REST Service diff --git a/pom.xml b/pom.xml index 1bb7036..2c0e4d2 100644 --- a/pom.xml +++ b/pom.xml @@ -5,20 +5,17 @@ com.github.bordertech.common qa-parent - 1.0.16 + 1.0.21 pom false - - 11 - - 168 ${project.build.finalName} ${project.build.finalName} + true sample-app-parent diff --git a/web-ui/pom.xml b/web-ui/pom.xml index 05c8995..4c97d6d 100644 --- a/web-ui/pom.xml +++ b/web-ui/pom.xml @@ -90,7 +90,13 @@ com.github.bordertech.webfriends webfriends-selenium-wc - 0.0.4 + 0.0.6 + test + + + com.github.bordertech.webfriends + webfriends-selenium-junit + 0.0.6 test @@ -105,7 +111,7 @@ com.google.guava guava - 27.1-jre + 33.5.0-jre test diff --git a/web-ui/src/test/java/com/sample/app/ui/test/SampleUiTest.java b/web-ui/src/test/java/com/sample/app/ui/test/SampleUiTest.java index 021d1e8..32862ce 100644 --- a/web-ui/src/test/java/com/sample/app/ui/test/SampleUiTest.java +++ b/web-ui/src/test/java/com/sample/app/ui/test/SampleUiTest.java @@ -1,10 +1,11 @@ package com.sample.app.ui.test; +import com.github.bordertech.webfriends.junit.runner.AbstractFriendTestCase; import com.github.bordertech.webfriends.selenium.common.tag.SeleniumTags; import com.github.bordertech.webfriends.selenium.element.form.SButton; import com.github.bordertech.webfriends.selenium.element.sections.SHeading1; import com.github.bordertech.webfriends.selenium.element.table.STable; -import com.github.bordertech.webfriends.selenium.smart.junit.SmartDriverTestCase; +import com.github.bordertech.webfriends.selenium.smart.driver.SmartDriver; import com.sample.app.test.Smoke; import com.sample.app.test.Unit; import org.junit.Assert; @@ -15,7 +16,7 @@ * Sample UI Unit tests. */ @Category({Unit.class, Smoke.class}) -public class SampleUiTest extends SmartDriverTestCase { +public class SampleUiTest extends AbstractFriendTestCase { // ## SMOKE Properties // ##bordertech.webfriends.selenium.launchServer=false // ##bordertech.webfriends.selenium.serverUrl=http://localhost:8081/lde diff --git a/web-ui/src/test/resources/bordertech-app.properties b/web-ui/src/test/resources/bordertech-app.properties index e3f2476..4a52836 100644 --- a/web-ui/src/test/resources/bordertech-app.properties +++ b/web-ui/src/test/resources/bordertech-app.properties @@ -17,3 +17,5 @@ bordertech.factory.impl.com.github.bordertech.webfriends.selenium.util.driver.Pa ## SMOKE Properties ##bordertech.webfriends.selenium.launchServer=false ##bordertech.webfriends.selenium.serverUrl=http://localhost:8081/lde + +##bordertech.webfriends.selenium.driver.runner=firefox