forked from eclipse-archived/reddeer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce github actions PR check job, fixes eclipse-archived#2131
Signed-off-by: Ondrej Dockal <[email protected]>
- Loading branch information
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Build and Test | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} # compiles and test on Ubuntu | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
java: ["11"] | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Checkout PR branch | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: 0 | ||
|
||
# Java JDK 11 used for maven build | ||
- name: Setup Java ${{ matrix.java }} | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk | ||
architecture: x64 | ||
|
||
# Try to find and apply jbosstools cache | ||
- name: Cache local Maven repository for RedDeer components | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2/repository | ||
key: reddeer-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
reddeer-${{ runner.os }}-maven- | ||
# Build and compile using Maven | ||
- name: Build/Compile and run unit tests | ||
uses: GabrielBB/xvfb-action@v1 | ||
with: | ||
run: mvn clean verify -U -fae -Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true --quiet | ||
|
||
# Archive artifacts to be applied in Publish Reports workflow | ||
- name: Archiving test artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ matrix.os }}-test-reports | ||
path: | | ||
*tests/*/target/surefire-reports/ | ||
*/*tests/*/target/surefire-reports/ | ||
**/*.log |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Publish reports | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Build And Test"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
publish: | ||
name: Publish Test Report | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
var artifacts = await github.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: ${{github.event.workflow_run.id}}, | ||
}); | ||
for (var artifact of artifacts.data.artifacts) { | ||
if (artifact.name.endsWith('test-reports')) { | ||
var zipfile = await github.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: artifact.id, | ||
archive_format: 'zip', | ||
}); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var pathFile = path.format({ | ||
root: '${{github.workspace}}/', | ||
name: artifact.name, | ||
ext: '.zip' | ||
}); | ||
fs.writeFileSync(pathFile, Buffer.from(zipfile.data)); | ||
} | ||
} | ||
- name: Unzip artifacts | ||
run: | | ||
find . -name '*.zip' -exec sh -c 'unzip -d "${1%.*}" "$1"' _ {} \; | ||
- name: Publish aggregated tests reports | ||
uses: scacap/action-surefire-report@v1 | ||
with: | ||
github_token: ${{secrets.GITHUB_TOKEN}} | ||
report_paths: '${{github.workspace}}/*test-reports/**/TEST-*.xml' | ||
commit: ${{github.event.workflow_run.head_sha}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ target | |
*.swp | ||
*.out | ||
.* | ||
!.github | ||
!.gitignore | ||
# Eclipse files | ||
.project | ||
|