Skip to content

refactor: github action push test results #42

refactor: github action push test results

refactor: github action push test results #42

Workflow file for this run

name: Java Gradle Build and Test
on:
push:
branches:
- master
- staging
pull_request:
branches:
- master
- staging
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'corretto'
- name: Build and Test with Gradle
run: ./gradlew build
- name: Upload Test Results
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: test-results
path: sdk-java/build/reports/tests/
- name: Comment on PR with HTML Report Link
if: ${{ always() }}
uses: actions/github-script@v6
with:
script: |
const artifactLink = `<a href="test/index.html" target="_blank">HTML Test Report</a>`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Test report is available here: ${artifactLink}`,
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}