forked from apache/geronimo-yoko
-
Notifications
You must be signed in to change notification settings - Fork 7
100 lines (95 loc) · 3.56 KB
/
gradle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# 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
export yearModified=`git log -1 --pretty=format:%cd --date=format:%Y -- "$filePath"`
if grep -Eq "Licensed under the Apache License, Version 2\.0" $filePath; then
if grep -Eq "Copyright $yearModified IBM Corporation and" $filePath; then
echo "✅ Copyright OK: $filePath"
else
existingModifiedYear=$(awk '/Copyright ([[:digit:]]{4}?) IBM Corporation and/ {print $3}' $filePath)
echo "🔴 Existing copyright year $existingModifiedYear does not match last modification year $yearModified: $filePath"
RC=1
fi
else
echo "❌ Copyright not found: $filePath"
RC=1
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: 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