Skip to content

Commit

Permalink
Added CI instructions (#7)
Browse files Browse the repository at this point in the history
Updated pom.xml with necessary plugins for release
Added licence headers for C code to satisfy licence audit
  • Loading branch information
Laukkala authored Aug 20, 2024
1 parent 98ad66b commit f22b5a1
Show file tree
Hide file tree
Showing 6 changed files with 323 additions and 1 deletion.
51 changes: 51 additions & 0 deletions .github/workflow/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on: push

jobs:
verify:
name: Verify Code
runs-on: ubuntu-latest

env:
COVERITY: coverity_tool

steps:
- uses: actions/checkout@v2

- name: Setup Maven Central
uses: actions/setup-java@v2
with:
java-version: 8.0.292+10
distribution: 'adopt'

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

- name: Compile Test and Verify
run: mvn --batch-mode clean verify

- name: Cache Coverity
id: cache_coverity
uses: actions/cache@v2
with:
path: ${{ env.COVERITY }}
key: coverity

- name: Download Coverity
if: steps.cache_coverity.outputs.cache-hit != 'true'
run: |
wget --quiet https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_TOKEN }}&project=teragrep%20jos_01" -O ${{ env.COVERITY }}.tgz
mkdir -p ${{ env.COVERITY }}
tar zxvf ${{ env.COVERITY }}.tgz -C ${{ env.COVERITY }} --strip-components 1
- name: Compile Coverity
run: |
${{ env.COVERITY }}/bin/cov-build --dir cov-int mvn -DskipTests=true --batch-mode clean compile
tar czvf jos_01.tgz cov-int
- name: Upload to Coverity
run: curl --silent --form token=${{ secrets.COVERITY_TOKEN }} --form email=${{ secrets.COVERITY_EMAIL }} --form file=@jos_01.tgz --form version="${GITHUB_REF##*/}" --form description="automated upload" https://scan.coverity.com/builds?project=teragrep%20jos_01
59 changes: 59 additions & 0 deletions .github/workflow/upload_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Upload Release

on:
release:
types: [published]

jobs:
upload:
name: Upload
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

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

- name: Setup Signing
uses: actions/setup-java@v2
with:
java-version: 8.0.292+10
distribution: 'adopt'
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Setup GitHub Packages
uses: actions/setup-java@v2
with:
java-version: 8.0.292+10
distribution: 'adopt'
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Publish to GitHub Packages
run: mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= clean deploy -Ppublish-github-packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}


- name: Setup Maven Central
uses: actions/setup-java@v2
with:
java-version: 8.0.292+10
distribution: 'adopt'

server-id: central-sonatype-org
server-username: CENTRAL_SONATYPE_ORG_USERNAME
server-password: CENTRAL_SONATYPE_ORG_PASSWORD
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Publish to Maven Central
run: mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= clean deploy -Ppublish-maven-central
env:
CENTRAL_SONATYPE_ORG_USERNAME: ${{ secrets.CENTRAL_SONATYPE_ORG_USERNAME }}
CENTRAL_SONATYPE_ORG_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_ORG_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
128 changes: 128 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,77 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<version>0.15</version>
<inherited>false</inherited>
<configuration>
<addDefaultLicenseMatchers>false</addDefaultLicenseMatchers>
<licenses>
<license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense">
<notes>Also allow the license url to be https.</notes>
<patterns>
<pattern>Java Operating System Statistics JOS-01</pattern>
</patterns>
</license>
</licenses>
<consoleOutput>true</consoleOutput>
<excludeSubProjects>false</excludeSubProjects>
<excludes>
<!-- git -->
<exclude>.git/**</exclude>
<exclude>.gitattributes</exclude>
<exclude>.gitignore</exclude>
<exclude>.gitmodules</exclude>
<!-- ci -->
<exclude>.github/**</exclude>
<exclude>toolchains.xml</exclude>
<exclude>settings.xml</exclude>
<!-- readme -->
<exclude>README.adoc</exclude>
<!-- spotless formatter -->
<exclude>eclipse-java-formatter.xml</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<source>8</source>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down Expand Up @@ -287,6 +358,39 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten.clean</id>
<goals>
<goal>clean</goal>
</goals>
<phase>clean</phase>
</execution>
<execution>
<id>flatten</id>
<goals>
<goal>flatten</goal>
</goals>
<phase>process-resources</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
Expand Down Expand Up @@ -349,6 +453,30 @@
<url>https://maven.pkg.github.com/teragrep/jos_01</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<goals>
<goal>sign</goal>
</goals>
<phase>verify</phase>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
42 changes: 42 additions & 0 deletions src/main/c/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
#
# Sysconf plugin for Java Operating System Statistics JOS-01
# Copyright (C) 2021 Fail-Safe IT Solutions Oy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
#
# Additional permission under GNU Affero General Public License version 3
# section 7
#
# If you modify this Program, or any covered work, by linking or combining it
# with other code, such other code is not for that reason alone subject to any
# of the requirements of the GNU Affero GPL version 3 as long as this Program
# is the same Program as licensed from Fail-Safe IT Solutions Oy without any
# additional modifications.
#
# Supplemented terms under GNU Affero General Public License version 3
# section 7
#
# Origin of the software must be attributed to Fail-Safe IT Solutions Oy.
# Any modified versions must be marked as "Modified version of" The Program.
#
# Names of the licensors and authors may not be used for publicity purposes.
#
# No rights are granted for use of trade names, trademarks, or service marks
# which are in The Program if any.
#
# Licensee must indemnify licensors and authors for any liability that these
# contractual assumptions impose on licensors and authors.
#
#
pkglib_LTLIBRARIES = sysconf.la

sysconf_la_SOURCES = sysconf.c
Expand Down
42 changes: 42 additions & 0 deletions src/main/c/configure.ac
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
#
# Sysconf plugin for Java Operating System Statistics JOS-01
# Copyright (C) 2021 Fail-Safe IT Solutions Oy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
#
# Additional permission under GNU Affero General Public License version 3
# section 7
#
# If you modify this Program, or any covered work, by linking or combining it
# with other code, such other code is not for that reason alone subject to any
# of the requirements of the GNU Affero GPL version 3 as long as this Program
# is the same Program as licensed from Fail-Safe IT Solutions Oy without any
# additional modifications.
#
# Supplemented terms under GNU Affero General Public License version 3
# section 7
#
# Origin of the software must be attributed to Fail-Safe IT Solutions Oy.
# Any modified versions must be marked as "Modified version of" The Program.
#
# Names of the licensors and authors may not be used for publicity purposes.
#
# No rights are granted for use of trade names, trademarks, or service marks
# which are in The Program if any.
#
# Licensee must indemnify licensors and authors for any liability that these
# contractual assumptions impose on licensors and authors.
#
#
AC_INIT([sysconf], 1.0)
#AC_CONFIG_MACRO_DIRS([m4]
AM_INIT_AUTOMAKE
Expand Down
2 changes: 1 addition & 1 deletion src/main/c/sysconf.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* ExtractFields plugin for Pentaho PTH-04
* Sysconf plugin for Java Operating System Statistics JOS-01
* Copyright (C) 2021 Fail-Safe IT Solutions Oy
*
* This program is free software: you can redistribute it and/or modify
Expand Down

0 comments on commit f22b5a1

Please sign in to comment.