-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unify the platform workflow by defining reusable workflows
Currently there is a quite inconsitent mixture of ci workflows, some are outdated or use different aproaches and configs, some have no workflow defined at all. This defines (and documents) a set of reusable workflows that can be adjusted / updated at a central place and then reused in the platform repositories.
- Loading branch information
Showing
4 changed files
with
195 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,16 @@ | ||
{ | ||
"problemMatcher": [ | ||
{ | ||
"owner": "api-problems", | ||
"pattern": [ | ||
{ | ||
"regexp": "^\\[API\\s(\\w+)\\].*line\\s(\\d+):\\s(.+)\\(location:\\s(.+)\\)$", | ||
"severity": 1, | ||
"line": 2, | ||
"message": 3, | ||
"file": 4 | ||
} | ||
] | ||
} | ||
] | ||
} |
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
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,72 @@ | ||
name: Maven Build | ||
on: | ||
workflow_call: | ||
inputs: | ||
maven-goals: | ||
description: maven goals to use, defaults to 'clean verify' | ||
required: false | ||
default: 'clean verify' | ||
type: string | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
event_file: | ||
name: "Upload Event File" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Upload | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Event File | ||
path: ${{ github.event_path }} | ||
build: | ||
runs-on: ${{ matrix.config.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- { name: Linux, os: ubuntu-latest } | ||
- { name: Windows, os: windows-latest } | ||
- { name: MacOS, os: macos-latest } | ||
name: Verify ${{ matrix.config.name }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # required for jgit timestamp provider to work | ||
- name: Set up Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: | | ||
8 | ||
11 | ||
17 | ||
distribution: 'temurin' | ||
cache: maven | ||
- name: Download the API Tools matcher | ||
uses: suisei-cn/[email protected] | ||
id: api-tools-matcher | ||
with: | ||
url: "https://raw.githubusercontent.com/eclipse-platform/eclipse.platform.releng.aggregator/master/.github/matcher/api-tools.json" | ||
target: .github/matcher | ||
- run: echo "::add-matcher::.github/matcher/${{ steps.api-tools-matcher.outputs.filename }}" | ||
- name: Build with Maven | ||
uses: coactions/setup-xvfb@v1 | ||
with: | ||
run: >- | ||
mvn --batch-mode -V -U | ||
-ntp | ||
-Dcompare-version-with-baselines.skip=false | ||
-Pbree-libs | ||
-Papi-check | ||
--fail-at-end | ||
${{ inputs.maven-goals }} | ||
- name: Upload Test Results for ${{ matrix.config.name }} | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-results-${{ matrix.config.native }}-java${{ matrix.java }} | ||
if-no-files-found: warn | ||
path: | | ||
${{ github.workspace }}/**/target/surefire-reports/*.xml |
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,90 @@ | ||
name: Publish Test Results | ||
on: | ||
workflow_call: | ||
inputs: | ||
gist-url: | ||
description: passing an url to the gist where results should be published as a badge | ||
required: false | ||
default: '' | ||
type: string | ||
gist-file: | ||
description: passing the name of the gist file to update, defaults to badge.svg | ||
required: false | ||
default: 'badge.svg' | ||
type: string | ||
secrets: | ||
gist-token: | ||
required: false | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
unit-test-results: | ||
name: Publish Test Results | ||
runs-on: ubuntu-latest | ||
if: github.event.workflow_run.conclusion != 'skipped' | ||
permissions: | ||
checks: write | ||
pull-requests: write | ||
contents: read | ||
issues: read | ||
actions: read | ||
|
||
steps: | ||
- name: Download and Extract Artifacts | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
run: | | ||
mkdir -p artifacts && cd artifacts | ||
artifacts_url=${{ github.event.workflow_run.artifacts_url }} | ||
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact | ||
do | ||
IFS=$'\t' read name url <<< "$artifact" | ||
gh api $url > "$name.zip" | ||
unzip -d "$name" "$name.zip" | ||
done | ||
- name: Publish Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
id: test-results | ||
with: | ||
commit: ${{ github.event.workflow_run.head_sha }} | ||
event_file: artifacts/Event File/event.json | ||
event_name: ${{ github.event.workflow_run.event }} | ||
files: "artifacts/**/*.xml" | ||
- name: Set badge color | ||
if: github.ref == 'refs/heads/master' && inputs.config-path != '' | ||
shell: bash | ||
run: | | ||
case ${{ fromJSON( steps.test-results.outputs.json ).conclusion }} in | ||
success) | ||
echo "BADGE_COLOR=31c653" >> $GITHUB_ENV | ||
;; | ||
failure) | ||
echo "BADGE_COLOR=800000" >> $GITHUB_ENV | ||
;; | ||
neutral) | ||
echo "BADGE_COLOR=696969" >> $GITHUB_ENV | ||
;; | ||
esac | ||
- name: Create badge | ||
if: github.ref == 'refs/heads/master' && inputs.config-path != '' | ||
uses: emibcn/badge-action@4209421db54c8764d8932070ffd0f81715a629bf | ||
with: | ||
label: Tests | ||
status: '${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests_succ }} passed, ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests_fail }} failed' | ||
color: ${{ env.BADGE_COLOR }} | ||
path: badge.svg | ||
|
||
- name: Upload badge to Gist | ||
if: github.ref == 'refs/heads/master' && inputs.config-path != '' | ||
uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d | ||
with: | ||
token: ${{ secrets.gist-token }} | ||
gistURL: ${{ inputs.gist-url }} | ||
file: ${{ inputs.gist-file }} | ||
|
||
|