Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Archiving

Archiving #75

Workflow file for this run

name: Java CI
on:
pull_request:
push:
tags:
- '*'
branches:
- develop
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
java-version: [ 17 ]
browser: ['googlechromeheadless', 'firefoxheadless', 'edgeheadless']
include:
- os: ubuntu-latest
set_display: export DISPLAY=:99; Xvfb :99 -screen 0 1024x768x24 -ac -noreset & sleep 3
install_dependencies: |
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
sudo rm microsoft.gpg
sudo apt update
sudo apt-get -y -q install xvfb zip curl microsoft-edge-beta
- os: windows-latest
install_dependencies: choco install firefox googlechrome curl zip -y --no-progress
- os: macos-latest
install_dependencies: |
brew install --cask firefox
brew install --cask google-chrome
brew install --cask microsoft-edge
brew install zip
brew install curl
exclude:
- os: macos-latest
browser: firefoxheadless # Webdriver download if not working with Firefox at GHA
java-version: 8
runs-on: ${{ matrix.os }}
name: Test on ${{ matrix.os }} with Java ${{ matrix.java-version }} using browser ${{ matrix.browser }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.java-version }}
java-package: jdk+fx # needed for jbrowser
- name: Set up other dependencies
run: |
${{ matrix.install_dependencies }}
${{ matrix.set_display }}
- name: Build with Maven
run: |
mvn -B -ntp -q verify --file pom.xml -P 'build,${{ matrix.browser }}'
- name: Delete output.xml (on Win)
run: |
Get-ChildItem target/robotframework-reports -Include *output.xml -Recurse | Remove-Item
echo "REPORT_FILE=$(Get-ChildItem target/robotframework-reports -Include *report.html -Recurse -Name)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "SHA=$(("${{ github.event_name }}" -eq "push") ? '${{ github.sha }}' : '${{ github.event.pull_request.head.sha }}')" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
if: always() && runner.os == 'Windows'
- name: Delete output.xml (on Unix-like)
run: |
find target/robotframework-reports -type f -name '*output.xml' -exec rm {} +
echo "REPORT_FILE=$(find target/robotframework-reports -type f -name '*report.html' | sed 's#.*/##')" >> $GITHUB_ENV
echo "SHA=$([ "${{ github.event_name }}" == "push" ] && echo "${{ github.sha }}" || echo "${{ github.event.pull_request.head.sha }}")" >> $GITHUB_ENV
if: always() && runner.os != 'Windows'
- name: Print actual triggering commit
run: echo "${{ env.SHA }}"
- name: Archive acceptances test results
uses: actions/upload-artifact@v4
with:
name: at-results-${{ matrix.browser }}-${{ matrix.os }}-${{ matrix.java-version }}
path: target/robotframework-reports
if: always() && job.status == 'failure'
- name: Upload results on failure
id: upload_results
run: |
echo '<html><head><meta http-equiv = "refresh" content =" 0 ; url = /${{ env.REPORT_FILE }}"></head></html>' > target/robotframework-reports/index.html
zip -r -j site.zip target/robotframework-reports > no_output 2>&1
curl -s -H "Content-Type: application/zip" -H "Authorization: Bearer ${{ secrets.NETLIFY_TOKEN }}" --data-binary "@site.zip" https://api.netlify.com/api/v1/sites > response.json
echo "::set-output name=REPORT_URL::$(cat response.json|python -c "import sys, json; print('https://' + json.load(sys.stdin)['subdomain'] + '.netlify.com')")"
echo "::set-output name=JOB_STATUS::$(python -c "print('${{ job.status }}'.lower())")"
if: always() && job.status == 'failure'
- uses: octokit/request-action@dad4362715b7fb2ddedf9772c8670824af564f0d #v2.4.0
name: Update status with Github Status API
id: update_status_pr
with:
route: POST /repos/{repository}/statuses/{sha}
repository: ${{ github.repository }}
sha: "${{env.SHA}}"
state: "${{steps.upload_results.outputs.JOB_STATUS}}"
target_url: "${{steps.upload_results.outputs.REPORT_URL}}"
description: "Link to test report."
context: at-results-${{ matrix.browser }}-${{ matrix.os }}-${{ matrix.java-version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: always() && job.status == 'failure'
release:
needs: [build_and_test]
if: github.event_name == 'push'
runs-on: ubuntu-latest
name: Release package
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
- name: Release Maven package
run:
echo $GPG_PRIVATE_KEY > .m2/private-key.txt
gpg --import --batch .m2/private-key.txt
rm .m2/private-key.txt
mvn clean deploy --batch-mode --activate-profiles deploy --settings ${{ github.workspace }}/.m2/settings.xml -DskipTests -B -ntp
env:
GPG_PRIVATE_KEY: ${{ secrets.gpg_private_key }}
GPG_PASSPHRASE: ${{ secrets.gpg_passphrase }}
NEXUS_USERNAME: ${{ secrets.nexus_username }}
NEXUS_PASSWORD: ${{ secrets.nexus_password }}