Skip to content

Commit

Permalink
Merge pull request #63 from TEIC/dev
Browse files Browse the repository at this point in the history
Add new tei guidelines and stylesheets to docker image
  • Loading branch information
peterstadler authored Nov 28, 2023
2 parents e21b896 + 7857da5 commit 7f4bc8c
Show file tree
Hide file tree
Showing 11 changed files with 162 additions and 54 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
80 changes: 80 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "dev", main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "dev" ]
schedule:
- cron: '28 18 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'java' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

- name: maven-settings
uses: s4u/[email protected]
with:
servers: '[{"id": "teic", "username": "${github.actor}", "password": "${GITHUB_TOKEN}"}]'

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
#- name: Autobuild
# uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
- name: Build with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn clean package --file pom.xml

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
15 changes: 15 additions & 0 deletions .github/workflows/fair-software.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: fair-software

on: push

jobs:
verify:
name: "fair-software"
runs-on: ubuntu-latest
steps:
- uses: fair-software/[email protected]
name: Measure compliance with fair-software.eu recommendations
env:
PYCHARM_HOSTED: "Trick colorama into displaying colored output"
with:
MY_REPO_URL: "https://github.com/${{ github.repository }}"
2 changes: 1 addition & 1 deletion .howfairis.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
skip_registry_checks_reason : "will be registered in NFDI4Culture Registry for Tools & Services"
skip_registry_checks_reason : "registered in NFDI4Culture Registry for Tools & Services at https://nfdi4culture.de/de/ressourcen/registry/details/teigarage"
1 change: 0 additions & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ authors:
given-names: "Anne"
title: "TEIGarage"
version: 1.0.0
doi:
date-released: 2022-09-14
url: "https://github.com/TEIC/TEIGarage"
21 changes: 15 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# of both the ege-webclient and the TEIGarage (backend),
# and installs it in a Tomcat application server
#########################################
FROM tomcat:9-jdk11-openjdk
FROM tomcat:9-jdk11

LABEL org.opencontainers.image.source=https://github.com/teic/teigarage

Expand Down Expand Up @@ -36,6 +36,7 @@ RUN apt-get update \
libgcc-10-dev \
librsvg2-bin \
curl \
unzip \
&& ln -s ${OFFICE_HOME} /usr/lib/openoffice \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -55,15 +56,23 @@ COPY log4j.xml /var/cache/oxgarage/log4j.xml
# && unzip /tmp/webservice.zip -d /tmp/

# download artifacts to /tmp and deploy them at ${CATALINA_WEBAPPS}
# these war-files are zipped so we need to unzip them twice
#conditional copy in docker needs a strange hack
COPY log4j.xml artifact/teigarage.wa[r] /tmp/


# if the action is run on github, the war is already located in the artifact folder because of the previous github action
#RUN if [ "$BUILDTYPE" = "github" ] ; then \
# cp artifact/teigarage.war /tmp/ ; \
# fi
COPY artifac[t]/teigarage.wa[r] /tmp/

# if docker build is local the latest artifact needs to be downloaded using the nightly link url
RUN if [ "$BUILDTYPE" = "local" ] ; then \
curl -Ls ${WEBSERVICE_ARTIFACT} -o /tmp/teigarage.zip \
&& unzip -o -q /tmp/teigarage.zip -d /tmp/; \
fi \
&& unzip -q /tmp/teigarage.war -d ${CATALINA_WEBAPPS}/ege-webservice/ \
fi

# these war-files are zipped so we need to unzip them twice
# the GUI/webclient needs to be downloaded locally and on github
RUN unzip -q /tmp/teigarage.war -d ${CATALINA_WEBAPPS}/ege-webservice/ \
&& rm -Rf ${CATALINA_WEBAPPS}/ROOT \
&& curl -Ls ${WEBCLIENT_ARTIFACT} -o /tmp/webclient.zip \
&& unzip -q /tmp/webclient.zip -d /tmp/ \
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@
[![GitHub license](https://img.shields.io/github/license/teic/TEIGarage.svg)](https://github.com/TEIC/TEIGarage/blob/main/LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/TEIC/TEIGarage.svg)](https://github.com/TEIC/TEIGarage/releases)
[![Docker](https://img.shields.io/docker/pulls/teic/teigarage)](https://hub.docker.com/r/teic/teigarage)
[![fair-software.eu](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu)
[![fair-software.eu](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F-green)](https://fair-software.eu)
[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/6925/badge)](https://bestpractices.coreinfrastructure.org/projects/6925)
[![NFDI4C Registry](https://img.shields.io/badge/NFDI4Culture%20Registry-64BEA0)](https://nfdi4culture.de/id/E4102)

<!-- TABLE OF CONTENTS -->
## Table of Contents

* [About the Project](#about)
* [How to use](#how-to-use)
* [Installation](#installation)
* [With Docker](#installing-with-docker)
* [Without Docker](#installing-without-docker)
* [Building with Maven](#building-with-maven)


# About

TEIGarage is a webservice and RESTful service to transform, convert and validate various formats, focussing on the [TEI](https://tei-c.org/) format.
Expand All @@ -25,6 +28,14 @@ Further information on the **code structure** of MEIGarage and TEIGarage can be

A running instance of TEIGarage can be found at [teigarage.tei-c.org](https://teigarage.tei-c.org/).

# How to use

Open API documentation can be found at https://github.com/TEIC/TEIGarage/blob/main/src/main/webapp/openapi.json or at the running instance https://teigarage.tei-c.org/ege-webservice/. A curl example call to the API to convert an existing .docx to a TEI file looks like

```
curl -o output.xml -F [email protected] https://teigarage.tei-c.org/ege-webservice/Conversions/docx%3Aapplication%3Avnd.openxmlformats-officedocument.wordprocessingml.document/TEI%3Atext%3Axml/
```

# Installation

## Installing with Docker
Expand Down
34 changes: 28 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>pl.psnc.dl.ege.webapp</groupId>
<artifactId>teigarage</artifactId>
<version>1.1.1</version>
<version>1.2.1</version>
<packaging>war</packaging>
<name>TEI Garage</name>
<properties>
Expand Down Expand Up @@ -142,7 +142,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.11.0 </version>
<configuration>
<source>11</source>
<target>11</target>
Expand All @@ -159,6 +159,28 @@
<finalName>${project.artifactId}-${project.version}</finalName>
</configuration>
</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.21.2</version>
<configuration>
<failOnViolation>false</failOnViolation>
<printFailingErrors>true</printFailingErrors>
<linkXRef>false</linkXRef>
</configuration>
</plugin>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>9.0.1</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
Expand All @@ -172,17 +194,17 @@
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId>
<version>2.2.0</version>
<version>2.2.19</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2-servlet-initializer-v2</artifactId>
<version>2.2.0</version>
<version>2.2.19</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1</version>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>pl.psnc.dl.ege</groupId>
Expand All @@ -205,7 +227,7 @@
<dependency>
<groupId>pl.psnc.dl.ege.tei</groupId>
<artifactId>tei-converter</artifactId>
<version>0.6.4</version>
<version>0.6.5</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
30 changes: 0 additions & 30 deletions src/main/java/pl/psnc/dl/ege/webapp/servlet/ConversionServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;


import io.swagger.v3.oas.annotations.ExternalDocumentation;
Expand All @@ -26,8 +25,6 @@

import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;

import org.json.XML;

Expand Down Expand Up @@ -57,24 +54,6 @@
)
public class ConversionServlet extends HttpServlet {

private static final String imagesDirectory = "media";

private static final String EZP_EXT = ".ezp";

private static final String FORMAT_DOCX = "docx";

private static final String FORMAT_ODT = "oo";

private static final String APPLICATION_MSWORD = "application/msword";

private static final String APPLICATION_EPUB = "application/epub+zip";

private static final String APPLICATION_ODT = "application/vnd.oasis.opendocument.text";

private static final String APPLICATION_OCTET_STREAM = "application/octet-stream";

private static final Logger LOGGER = LogManager.getLogger(ConversionServlet.class);

private static final long serialVersionUID = 1L;

public static final String SLASH = "/";
Expand All @@ -83,16 +62,8 @@ public class ConversionServlet extends HttpServlet {

public static final String SEMICOLON = ";";

public static final String R_WRONG_METHOD = "Wrong method: GET, expected: POST.";

public static final String CONVERSIONS_SLICE_BASE = "Conversions/";

public static final String ZIP_EXT = ".zip";

public static final String DOCX_EXT = ".docx";

public static final String EPUB_EXT = ".epub";

public static final String ODT_EXT = ".odt";

Conversion conversion;
Expand All @@ -102,7 +73,6 @@ public class ConversionServlet extends HttpServlet {
*/
public ConversionServlet() {
super();
Conversion conversion = new Conversion();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.json.XML;
import pl.psnc.dl.ege.webapp.servlethelpers.Customization;

Expand All @@ -28,9 +26,6 @@
})
public class CustomizationServlet extends HttpServlet {

private static final Logger LOGGER = LogManager
.getLogger(CustomizationServlet.class);

private static final long serialVersionUID = 1L;

Customization customization = new Customization();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;


import pl.psnc.dl.ege.types.DataType;
Expand All @@ -37,8 +35,6 @@ public class ValidationServlet
extends HttpServlet
{

private static final Logger LOGGER = LogManager
.getLogger(ValidationServlet.class);

private static final long serialVersionUID = 1L;

Expand Down

0 comments on commit 7f4bc8c

Please sign in to comment.