Added testcases and made few changes #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Workflow | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- develop | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
java-package: 'jdk' | |
architecture: 'x64' | |
check-latest: false | |
server-id: 'github' | |
server-username: ${{ github.actor }} | |
server-password: ${{ github.token }} | |
overwrite-settings: true | |
job-status: 'success' | |
- name: Cache Maven dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Set up WireGuard # Setting up the Wiregaurd to access the openg2p url's | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y wireguard | |
sudo cp scripts/openg2p-e2e.conf /etc/wireguard/ | |
sudo systemctl start wg-quick@openg2p-e2e.service | |
- name: Chrome setup | |
uses: browser-actions/setup-chrome@v1 | |
- run: chrome --version | |
- uses: actions/checkout@v2 | |
- name: Chromedriver setup | |
uses: nanasess/setup-chromedriver@v2 | |
- run: | | |
export DISPLAY=:99 | |
chromedriver --url-base=/wd/hub & | |
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional | |
- name: Build with Maven | |
run: mvn clean install -DskipTests=true | |
- name: Clear Allure report history | |
run: rm -rf allure-results/* | |
- name: Run Sanity tests | |
run: mvn clean test | |
- name: Notify Slack on Test Failures | |
if: ${{ failure() }} | |
# env: | |
# SLACK_WEBHOOK_URL: "https://hooks.slack.com/services/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" | |
run: | | |
curl -X POST -H 'Content-type: application/json' --data '{"text":"Test failures detected in the workflow"}' https://hooks.slack.com/services/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 | |
# WORKFLOW_NAME=$(echo "${{ github.workflow }}" | sed "s/'//g") | |
# REPOSITORY_NAME=$(echo "${{ github.repository }}" | sed "s/'//g") | |
# MESSAGE="Test failures detected in the workflow: '$WORKFLOW_NAME' of repository '$REPOSITORY_NAME'." | |
# SLACK_WEBHOOK_URL="https://hooks.slack.com/services/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" | |
# JSON_PAYLOAD="{\"text\":\"$MESSAGE\"}" | |
# curl -X POST -H 'Content-type: application/json' --data "$JSON_PAYLOAD" "$SLACK_WEBHOOK_URL" | |
- name: Allure setup | |
uses: simple-elf/allure-report-action@master | |
if: always() | |
id: allure-report | |
with: | |
allure_results: build/allure-results | |
gh_pages: gh-pages | |
allure_report: allure-report | |
allure_history: allure-results | |
- name: Deploy report to Github Pages | |
if: always() | |
uses: peaceiris/actions-gh-pages@v2 | |
env: | |
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PUBLISH_BRANCH: gh-pages | |
PUBLISH_DIR: allure-results | |
- name: Post the link to the report | |
if: always() | |
uses: Sibz/github-status-action@v1 | |
with: | |
authToken: ${{secrets.GITHUB_TOKEN}} | |
context: 'Test report' | |
state: 'success' | |
sha: ${{ github.sha }} | |
target_url: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}//${{ github.run_number }} |