Skip to content

Port poa test

Port poa test #539

Workflow file for this run

# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Gradle-CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Get changed yoko files
id: changed-files
uses: tj-actions/changed-files@v37
with:
files: yoko*/
files_ignore: yoko*/**/*generated*/**
- name: Check for correct copyright in changed Yoko files
run: |
RC=0
echo "Checking copyright in Yoko src files..."
for filePath in ${{ steps.changed-files.outputs.all_changed_files }}; do
author=$(git log -1 --format="%an" $path)
if [[ $author != *"Alan"* ]]; then
if grep -Eq "Copyright ([[:digit:]]{4}?) IBM Corporation and | Licensed under the Apache License, Version 2\.0" $filePath; then
echo "✅ Copyright OK: $filePath"
else
echo "❌ Copyright not found in $filePath"
RC=1
fi
fi
done
exit $RC
- name: Check copyright Tag in Testify source files
run: |
SRC=$(find testify/ -name '*.java')
export year_modified=`git log -n 1 --pretty=format:%cd --date=format:%Y $i`
RC=0
echo "Checking copyright"
for i in $SRC; do
if grep -Eq "Copyright ([[:digit:]]{4}, ?)?$year_modified IBM Corporation and " $i; then
echo "✅ Copyright ok: $i"
else
echo "❌ Copyright not found or incorrect year in $i"
echo "🔴 Last modification year should be: $year_modified"
RC=1
fi
done
exit $RC
- name: Build with Gradle
run: ./gradlew build
- name: Upload test reports
uses: actions/upload-artifact@v3.1.0
if: always()
with:
name: reports
path: '*/build/reports'
- name: Upload xml test results
if: always() # make sure we run it every time even if test step fails
uses: actions/upload-artifact@v3.1.0
with:
name: xml-report
path: "**/test-results/**/*.xml"
- name: Upload test results to Test-hub.io
if: always() # make sure we run it every time even if test step fails
uses: testhub-io/testhub-io.action@v0.62
with:
test_result_pattern: "**/test-results/**/*.xml"
- name: Link to Test-hub.io
if: always()
run: echo "https://test-hub.io/OpenLiberty/projects/yoko/runs/$GITHUB_RUN_NUMBER"
- name: Check JAR licenses
run: |
JARS=$(find ./ -name '*.jar' -type f | grep yoko | grep libs)
SHIPPED_JARS=("osgi" "util" "spec-corba" "rmi-spec" "rmi-impl" "core" "testify")
for shippedJar in ${SHIPPED_JARS[@]}; do
for jar in $JARS; do
if [[ $(basename $jar) == *"$shippedJar"* ]]; then
echo "Checking $(basename $jar)"
if $(unzip -p $jar META-INF/MANIFEST.MF | grep -q "Bundle-License: https://www.apache.org/licenses/LICENSE-2.0.txt"); then
echo "License found"
else
echo "License not found"
exit 1
fi
else
continue
fi
done
done