Skip to content

Commit

Permalink
[feature] Switch from Ant build to Maven and add GitHub Actions CI
Browse files Browse the repository at this point in the history
  • Loading branch information
adamretter committed Aug 25, 2023
1 parent 9c43d19 commit 7a06c68
Show file tree
Hide file tree
Showing 18 changed files with 199 additions and 100 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI
on: [push, pull_request]
jobs:
build:
name: Build and Test (${{ matrix.os }} / OpenJDK ${{ matrix.jdk }})
strategy:
fail-fast: true
matrix:
jdk: ['8']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.jdk }}
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Maven Build
run: mvn clean package -DskipTests
- name: Test
run: mvn verify
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
build/
.*
target/
!.gitignore
1 change: 0 additions & 1 deletion VERSION.txt

This file was deleted.

12 changes: 0 additions & 12 deletions build.properties.xml

This file was deleted.

36 changes: 0 additions & 36 deletions build.xml

This file was deleted.

6 changes: 0 additions & 6 deletions collection.xconf

This file was deleted.

6 changes: 0 additions & 6 deletions expath-pkg.xml.tmpl

This file was deleted.

9 changes: 0 additions & 9 deletions index.html

This file was deleted.

104 changes: 104 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?xml version="1.0"?>
<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">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.exist-db</groupId>
<artifactId>exist-apps-parent</artifactId>
<version>1.12.0</version>
<relativePath/>
</parent>

<groupId>org.exist-db.apps</groupId>
<artifactId>existdb-saml-xquery</artifactId>
<version>1.7.0-SNAPSHOT</version>


<name>eXist-db SAML XQuery</name>
<description>SAML v2.0 Implementation in XQuery</description>
<url>https://github.com/eXist-db/existdb-saml</url>

<scm>
<url>https://github.com/eXist-db/existdb-saml.git</url>
<connection>scm:git:https://github.com/eXist-db/existdb-saml.git</connection>
<developerConnection>scm:git:https://github.com/eXist-db/existdb-saml.git</developerConnection>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- used in the EXPath Package Descriptor -->
<package-name>http://exist-db.org/apps/exsaml</package-name>

<exist.version>6.0.1</exist.version>
</properties>

<build>
<resources>
<resource>
<directory>src/main/xar-resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/xar-resources-filtered</directory>
<filtering>true</filtering>
</resource>
</resources>

<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>false</filtering>
</testResource>
<testResource>
<directory>src/test/resources-filtered</directory>
<filtering>true</filtering>
</testResource>
</testResources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>

<plugin>
<groupId>ro.kuberam.maven.plugins</groupId>
<artifactId>kuberam-expath-plugin</artifactId>
<executions>
<execution>
<id>create-xar</id>
<phase>package</phase>
<goals>
<goal>make-xar</goal>
</goals>
<configuration>
<descriptor>xar-assembly.xml</descriptor>
<finalName>${package-final-name}</finalName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<configuration>
<useAgent>true</useAgent>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<mavenExecutorId>forked-path </mavenExecutorId>
<!-- avoid a bug with GPG plugin hanging http://jira.codehaus.org/browse/MGPG-9 -->
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>@{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</build>

</project>
6 changes: 0 additions & 6 deletions post-install.xql

This file was deleted.

13 changes: 0 additions & 13 deletions repo.xml.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion saml-request-ids/KEEPME

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
xquery version "3.1";

import module namespace exsaml="http://exist-db.org/xquery/exsaml" at "/db/apps/existdb-saml/content/exsaml.xqm";
import module namespace exsaml = "http://exist-db.org/xquery/exsaml" at "/db/system/repo/${project.artifactId}-${project.version}/modules/exsaml.xqm";
import module namespace functx = "http://www.functx.com";

declare function local:clean-reqids() {
let $reqid-col := "/db/apps/existdb-saml/saml-request-ids"
let $reqid-col := "/db/system/repo/${project.artifactId}-${project.version}/saml-request-ids"
let $reqids := for $reqid in collection($reqid-col)/reqid
let $duration := xs:dateTime(current-dateTime()) - xs:dateTime($reqid)
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
xquery version "3.1";

import module namespace scheduler="http://exist-db.org/xquery/scheduler" at "java:org.exist.xquery.modules.scheduler.SchedulerModule";


declare namespace sc="http://exist-db.org/xquery/scheduler";
import module namespace scheduler = "http://exist-db.org/xquery/scheduler";

declare variable $local:job-name := "clean-up-sso-reqids";
declare variable $local:cron := "0 0 11 * * ? *";

declare function local:start-job() {
scheduler:schedule-xquery-cron-job("/db/apps/existdb-saml/content/clean-reqids.xql", $local:cron, $local:job-name)
scheduler:schedule-xquery-cron-job("/db/system/repo/${project.artifactId}-${project.version}/clean-reqids.xql", $local:cron, $local:job-name)
};

declare function local:show-job() {
let $jobs := scheduler:get-scheduled-jobs()
return
$jobs//sc:job[@name=$local:job-name]
$jobs//scheduler:job[@name=$local:job-name]
};

declare function local:stop-job() {
Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions src/main/xar-resources/post-install.xq
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
xquery version "3.1";

import module namespace sm = "http://exist-db.org/xquery/securitymanager";
import module namespace xmldb = "http://exist-db.org/xquery/xmldb";

(: the target collection into which the app is deployed :)
declare variable $target external;

declare variable $saml-request-ids-collection-name := "saml-request-ids";
declare variable $saml-request-ids-collection-path := $target || "/" || $saml-request-ids-collection-name;

let $_ :=
if (fn:not(xmldb:collection-available($saml-request-ids-collection-path)))
then
xmldb:create-collection($target, $saml-request-ids-collection-name)
else()
return
sm:chmod(xs:anyURI($saml-request-ids-collection-path), "rwx------")
43 changes: 43 additions & 0 deletions xar-assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://expath.org/ns/pkg" name="${package-name}" abbrev="${package-abbrev}" version="${project.version}"
spec="1.0">
<title>${package-title}</title>
<author id="eXist-db">${project.organization.name}</author>
<description>${project.description}</description>
<website>${project.url}</website>
<license>GNU LGPL 2.1</license>
<copyright>true</copyright>

<type>library</type>

<status>stable</status>

<tag>${project.artifactId}</tag>

<dependency processor="http://exist-db.org" semver-min="${exist.version}"/>
<dependency package="http://expath.org/ns/crypto" semver-min="6.0.1"/>

<target>${package-abbrev}</target>

<finish>post-install.xq</finish>

<!-- includes everything in target, README.md, and LICENSE -->
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
</fileSet>
<fileSet>
<directory>${project.basedir}</directory>
<includes>
<include>README.md</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}</directory>
<includes>
<include>LICENSE</include>
</includes>
</fileSet>
</fileSets>

</package>

0 comments on commit 7a06c68

Please sign in to comment.