Skip to content

Commit

Permalink
Merge pull request #161 from splunk/DVPL-9687
Browse files Browse the repository at this point in the history
Github Actions: Test & Release implemented.
  • Loading branch information
bparmar-splunk authored Jul 12, 2021
2 parents 0f8727e + 105aaea commit 7c33e51
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 8 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
release:
types: [published]

name: Create Release

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
server-id: splunk-artifactory
- name: build
run: mvn package --file pom.xml -DskipTests=true
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
# body_path: ${{ github.workflow }}-CHANGELOG.txt
files: ./target/*.jar
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to Artifactory
run: mvn --batch-mode deploy -DskipTests=true
env:
MAVEN_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
65 changes: 65 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Java SDK Test

on:
[push, pull_request]

jobs:
test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
java-version:
- 1.8
splunk-version:
- "8.0"
- "8.2.0"
runs-on: ${{ matrix.os }}

services:
splunk:
image: splunk/splunk:${{matrix.splunk-version}}
env:
SPLUNK_START_ARGS: --accept-license
SPLUNK_PASSWORD: changed!
TEST_TCP_PORT: 10667
TEST_UDP_PORT: 10668
SPLUNK_HOME: "/opt/splunk"
ports:
- 8000:8000
- 8089:8089
- 8088:8088
- 10667:10667
- 10668:10668/udp

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

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: Create .splunkrc file
run: |
cd ~
echo host=localhost >> .splunkrc
echo port=8089 >> .splunkrc
echo username=admin >> .splunkrc
echo password=changed! >> .splunkrc
echo scheme=https >> .splunkrc
echo version=${{ matrix.splunk }} >> .splunkrc
- name: Test using maven
run: make test
env:
SPLUNK_HOME: "/opt/splunk"
TEST_TCP_PORT: 10667
TEST_UDP_PORT: 10668
1 change: 1 addition & 0 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<skip>true</skip>
</configuration>
Expand Down
12 changes: 7 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>

<properties>
<version.number>1.6.4</version.number>
<version.number>1.6.5</version.number>
<maven.resources.overwrite>true</maven.resources.overwrite>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>8</maven.compiler.source>
Expand Down Expand Up @@ -58,11 +58,14 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<!-- Below altDeploymentRepository is used for local deployment. Commented out for now. -->
<!--
<altDeploymentRepository>
<!-- local::file:./target/local-deploy-->
localRepository::default::file:./target/local-deploy
</altDeploymentRepository>
-->
<skip>true</skip>
</configuration>
</plugin>
Expand All @@ -77,14 +80,13 @@
</repository>
</repositories>

<!-- Distribution Management is commented for now as we are focusing on local deployment only. -->
<!-- <distributionManagement>
<distributionManagement>
<repository>
<id>splunk-artifactory</id>
<name>Splunk Releases</name>
<url>https://splunk.jfrog.io/splunk/ext-releases-local</url>
</repository>
</distributionManagement>-->
</distributionManagement>

<licenses>
<license>
Expand Down
4 changes: 1 addition & 3 deletions splunk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
<version>1.0.0</version>
</parent>
<properties>
<!-- <jvm.arg.https.protocol>-Dhttps.protocols=TLSv1.1,TLSv1.2</jvm.arg.https.protocol> -->
<https.protocols>TLSv1.2</https.protocols>
<!-- <maven.javadoc.skip>true</maven.javadoc.skip>-->
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -65,7 +63,6 @@
<configuration>
<skipTests>${skipTests}</skipTests>
<runOrder>alphabetical</runOrder>
<!-- <argLine>${jvm.arg.https.protocol}</argLine> -->
<systemProperties>
<https.protocols>${https.protocols}</https.protocols>
</systemProperties>
Expand Down Expand Up @@ -97,6 +94,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<skip>false</skip>
</configuration>
Expand Down

0 comments on commit 7c33e51

Please # to comment.