Skip to content

Commit

Permalink
Add daily build to GH actions (#128)
Browse files Browse the repository at this point in the history
* daily build and refactoring

* changed to executable

* removed dockfile sed

* changed to executable

* Sed fix

* Fix sed command

* Remove `<failOnMissingWebXml>` (see OpenLiberty/guides-common#436)

* Update test.yml

Co-authored-by: Gilbert Kwan <gkwan@ca.ibm.com>
Co-authored-by: Austin Seto <austin.seto@ibm.com>
  • Loading branch information
3 people authored Jan 8, 2021
1 parent 9d65309 commit dd215bb
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 72 deletions.
66 changes: 41 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,56 @@
# This workflow will test the guide application.
# For more information about building and testing Java,
# see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Test application

on:
pull_request:
branches: [ qa ]
branches: [ master, qa ]

jobs:
java8build:
needTest:
runs-on: ubuntu-latest
outputs:
canSkip: ${{ steps.checkFiles.outputs.canSkip }}
steps:
- name: Check files in PR
id: checkFiles
run: |
PR_FILES_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${{github.event.pull_request.number}}/files"
FILES_CHANGED=$(curl -s -X GET -G $PR_FILES_URL | jq -r '.[] | .filename')
echo $FILES_CHANGED
if [ ${#FILES_CHANGED[@]} == 1 ] && [ ${FILES_CHANGED[0]} == README.adoc ]; then
echo "Test can be skipped because only updated README.adoc"
echo "::set-output name=canSkip::true"
else
echo "Need to run test"
echo "::set-output name=canSkip::false"
fi
java8build:
runs-on: ubuntu-latest
needs: [needTest]
if: "!contains(needs.needTest.outputs.canSkip, 'true')"
defaults:
run:
working-directory: finish

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- run: unset _JAVA_OPTIONS
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 8
- run: unset _JAVA_OPTIONS

- name: Run tests
run: mvn -q clean install
- name: Post tests
if: always()
run: |
- name: Run tests
run: sudo ../scripts/testApp.sh
- name: Post tests
if: always()
run: |
logsPath=$(sudo find . -name "console.log" | grep inventory);
sudo cat $logsPath | sudo grep Launching
- name: Archive server logs if failed
if: failure()
uses: actions/upload-artifact@v2
with:
name: server-logs
path: finish/target/liberty/wlp/usr/servers/defaultServer/logs/
- name: Archive server logs if failed
if: failure()
uses: actions/upload-artifact@v2
with:
name: server-logs
path: finish/target/liberty/wlp/usr/servers/defaultServer/logs/
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

4 changes: 0 additions & 4 deletions finish/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${version.maven-war-plugin}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>pom.xml</packagingExcludes>
</configuration>
</plugin>
<!-- Liberty Maven plugin -->
<plugin>
Expand Down
14 changes: 14 additions & 0 deletions scripts/dailyBuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
while getopts t:d:b:u: flag; do
case "${flag}" in
t) DATE="${OPTARG}" ;;
d) DRIVER="${OPTARG}" ;;
b) BUILD="${OPTARG}" ;;
u) DOCKER_USERNAME="${OPTARG}" ;;
esac
done

sed -i "\#<assemblyArtifact>#,\#</assemblyArtifact>#c<install><runtimeUrl>https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/nightly/"$DATE"/"$DRIVER"</runtimeUrl></install>" pom.xml
cat pom.xml

../scripts/testApp.sh
10 changes: 10 additions & 0 deletions scripts/testApp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -euxo pipefail

##############################################################################
##
## GH actions CI test script
##
##############################################################################

mvn -q clean install
4 changes: 0 additions & 4 deletions start/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${version.maven-war-plugin}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>pom.xml</packagingExcludes>
</configuration>
</plugin>
<!-- Liberty Maven plugin -->
<plugin>
Expand Down

0 comments on commit dd215bb

Please sign in to comment.