Skip to content

Commit 4a24f96

Browse files
authored
Merge pull request #90 from OpenLiberty/qa
Merge qa to master: Add daily build to GH actions (#89)
2 parents a0f4aef + d8d22fd commit 4a24f96

File tree

6 files changed

+67
-73
lines changed

6 files changed

+67
-73
lines changed

.github/workflows/test.yml

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,57 @@
1-
# This workflow will test the guide application.
2-
# For more information about building and testing Java,
3-
# see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
4-
51
name: Test application
62

73
on:
84
pull_request:
9-
branches: [ qa ]
5+
branches: [ master, qa ]
106

117
jobs:
8+
needTest:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
canSkip: ${{ steps.checkFiles.outputs.canSkip }}
12+
steps:
13+
- name: Check files in PR
14+
id: checkFiles
15+
run: |
16+
PR_FILES_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${{github.event.pull_request.number}}/files"
17+
FILES_CHANGED=$(curl -s -X GET -G $PR_FILES_URL | jq -r '.[] | .filename')
18+
echo $FILES_CHANGED
19+
if [ ${#FILES_CHANGED[@]} == 1 ] && [ ${FILES_CHANGED[0]} == README.adoc ]; then
20+
echo "Test can be skipped because only updated README.adoc"
21+
echo "::set-output name=canSkip::true"
22+
else
23+
echo "Need to run test"
24+
echo "::set-output name=canSkip::false"
25+
fi
26+
1227
java8build:
1328
runs-on: ubuntu-latest
29+
needs: [needTest]
30+
if: "!contains(needs.needTest.outputs.canSkip, 'true')"
1431
defaults:
1532
run:
1633
working-directory: finish
1734

1835
steps:
19-
- uses: actions/checkout@v2
20-
- name: Set up JDK 1.8
21-
uses: actions/setup-java@v1
22-
with:
23-
java-version: 1.8
24-
- run: unset _JAVA_OPTIONS
25-
26-
- name: Run tests
27-
run: chmod +x ../scripts/travisTest.sh && sudo ../scripts/travisTest.sh
28-
29-
- name: Post tests
30-
if: always()
31-
run: |
36+
- uses: actions/checkout@v2
37+
- name: Set up JDK 8
38+
uses: actions/setup-java@v1
39+
with:
40+
java-version: 8
41+
- run: unset _JAVA_OPTIONS
42+
43+
- name: Run tests
44+
run: sudo ../scripts/testApp.sh
45+
46+
- name: Post tests
47+
if: always()
48+
run: |
3249
logsPath=$(sudo find . -name "console.log");
3350
sudo cat $logsPath | sudo grep Launching
34-
35-
- name: Archive server logs if failed
36-
if: failure()
37-
uses: actions/upload-artifact@v2
38-
with:
39-
name: server-logs
40-
path: finish/target/liberty/wlp/usr/servers/defaultServer/logs/
51+
52+
- name: Archive server logs if failed
53+
if: failure()
54+
uses: actions/upload-artifact@v2
55+
with:
56+
name: server-logs
57+
path: finish/target/liberty/wlp/usr/servers/defaultServer/logs/

.travis.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

finish/pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
43

54
<modelVersion>4.0.0</modelVersion>
65

@@ -47,7 +46,7 @@
4746
<plugin>
4847
<groupId>io.openliberty.tools</groupId>
4948
<artifactId>liberty-maven-plugin</artifactId>
50-
<version>3.2</version>
49+
<version>3.2.3</version>
5150
</plugin>
5251
<!-- tag::frontend-plugin[] -->
5352
<plugin>

scripts/dailyBuild.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
while getopts t:d:b:u: flag; do
3+
case "${flag}" in
4+
t) DATE="${OPTARG}" ;;
5+
d) DRIVER="${OPTARG}" ;;
6+
b) BUILD="${OPTARG}" ;;
7+
u) DOCKER_USERNAME="${OPTARG}" ;;
8+
esac
9+
done
10+
11+
sed -i "\#<artifactId>liberty-maven-plugin</artifactId>#a<configuration><install><runtimeUrl>https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/nightly/"$DATE"/"$DRIVER"</runtimeUrl></install></configuration>" pom.xml
12+
cat pom.xml
13+
14+
../scripts/testApp.sh
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -euxo pipefail
33

44
##############################################################################
55
##
6-
## Travis CI test script
6+
## GH action sCI test script
77
##
88
##############################################################################
99

@@ -25,6 +25,11 @@ mvn -q clean package liberty:create liberty:install-feature liberty:deploy
2525
# failsafe:verify - Verifies that the integration tests of an application passed.
2626
mvn liberty:start
2727

28-
status="$(curl --write-out "%{http_code}\n" --silent --output /dev/null "http://localhost:9080/artists")"; if [ "$status" == "200" ]; then echo ENDPOINT OK; else echo "$status"; echo ENDPOINT NOT OK; exit 1; fi;
28+
status="$(curl --write-out "%{http_code}\n" --silent --output /dev/null "http://localhost:9080/artists")"
29+
if [ "$status" == "200" ]; then echo ENDPOINT OK; else
30+
echo "$status"
31+
echo ENDPOINT NOT OK
32+
exit 1
33+
fi
2934

3035
mvn liberty:stop

start/pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
43

54
<modelVersion>4.0.0</modelVersion>
65

@@ -47,7 +46,7 @@
4746
<plugin>
4847
<groupId>io.openliberty.tools</groupId>
4948
<artifactId>liberty-maven-plugin</artifactId>
50-
<version>3.2</version>
49+
<version>3.2.3</version>
5150
</plugin>
5251
<plugin>
5352
<groupId>com.github.eirslett</groupId>

0 commit comments

Comments
 (0)