Skip to content

Commit

Permalink
Init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JanisSaldabols committed Nov 15, 2023
0 parents commit e8d8b53
Show file tree
Hide file tree
Showing 56 changed files with 3,765 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# http://editorconfig.org/

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
continuation_indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
91 changes: 91 additions & 0 deletions .github/workflows/api-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: api-doc

# https://dev.folio.org/guides/api-doc/

# API_TYPES: string: The space-separated list of types to consider.
# One or more of 'RAML OAS'.
# e.g. 'OAS'
#
# API_DIRECTORIES: string: The space-separated list of directories to search
# for API description files.
# e.g. 'src/main/resources/openapi'
# NOTE: -- Also add each separate path to each of the "on: paths:" sections.
# e.g. 'src/main/resources/openapi/**'
#
# API_EXCLUDES: string: The space-separated list of directories and files
# to exclude from traversal, in addition to the default exclusions.
# e.g. ''

env:
API_TYPES: 'OAS'
API_DIRECTORIES: 'src/main/resources/openapi'
API_EXCLUDES: ''
OUTPUT_DIR: 'folio-api-docs'
AWS_S3_BUCKET: 'foliodocs'
AWS_S3_FOLDER: 'api'
AWS_S3_REGION: 'us-east-1'
AWS_S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
AWS_S3_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}

on:
push:
branches: [ main, master ]
paths:
- 'src/main/resources/openapi/**'
tags: '[vV][0-9]+.[0-9]+.[0-9]+*'

jobs:
api-doc:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.REF }}
submodules: recursive
- name: Prepare folio-tools
run: |
git clone https://github.com/folio-org/folio-tools
cd folio-tools/api-doc \
&& yarn install \
&& pip3 install -r requirements.txt
- name: Obtain version if release tag
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
version=$(echo ${GITHUB_REF#refs/tags/[vV]} | awk -F'.' '{ printf("%d.%d", $1, $2) }')
echo "VERSION_MAJ_MIN=${version}" >> $GITHUB_ENV
- name: Set some vars
run: |
echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Report some info
run: |
echo "REPO_NAME=${{ env.REPO_NAME }}"
- name: Do api-doc
run: |
if test -n "${{ env.VERSION_MAJ_MIN }}"; then
echo "Docs for release version ${{ env.VERSION_MAJ_MIN }}"
option_release=$(echo "--version ${{ env.VERSION_MAJ_MIN }}")
else
option_release=""
fi
python3 folio-tools/api-doc/api_doc.py \
--loglevel info \
--types ${{ env.API_TYPES }} \
--directories ${{ env.API_DIRECTORIES }} \
--excludes ${{ env.API_EXCLUDES }} \
--output ${{ env.OUTPUT_DIR }} $option_release
- name: Show generated files
working-directory: ${{ env.OUTPUT_DIR }}
run: ls -R
- name: Publish to AWS S3
uses: sai-sharan/[email protected]
with:
access_key: ${{ env.AWS_S3_ACCESS_KEY_ID }}
secret_access_key: ${{ env.AWS_S3_ACCESS_KEY }}
region: ${{ env.AWS_S3_REGION }}
source: ${{ env.OUTPUT_DIR }}
destination_bucket: ${{ env.AWS_S3_BUCKET }}
destination_prefix: ${{ env.AWS_S3_FOLDER }}
delete: false
quiet: false

65 changes: 65 additions & 0 deletions .github/workflows/api-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: api-lint

# https://dev.folio.org/guides/api-lint/

# API_TYPES: string: The space-separated list of types to consider.
# One or more of 'RAML OAS'.
# e.g. 'OAS'
#
# API_DIRECTORIES: string: The space-separated list of directories to search
# for API description files.
# e.g. 'src/main/resources/openapi'
# NOTE: -- Also add each separate path to each of the "on: paths:" sections.
# e.g. 'src/main/resources/openapi/**'
#
# API_EXCLUDES: string: The space-separated list of directories and files
# to exclude from traversal, in addition to the default exclusions.
# e.g. ''
#
# API_WARNINGS: boolean: Whether to cause Warnings to be displayed,
# and to fail the workflow.
# e.g. false

env:
API_TYPES: 'OAS'
API_DIRECTORIES: 'src/main/resources/openapi'
API_EXCLUDES: ''
API_WARNINGS: false

on:
push:
paths:
- 'src/main/resources/openapi/**'
pull_request:
paths:
- 'src/main/resources/openapi/**'

jobs:
api-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Prepare folio-tools
run: |
git clone https://github.com/folio-org/folio-tools
cd folio-tools/api-lint \
&& yarn install \
&& pip3 install -r requirements.txt
- name: Configure default options
run: |
echo "OPTION_WARNINGS=''" >> $GITHUB_ENV
- name: Configure option warnings
if: ${{ env.API_WARNINGS == 'true' }}
run: |
echo "OPTION_WARNINGS=--warnings" >> $GITHUB_ENV
- name: Do api-lint
run: |
python3 folio-tools/api-lint/api_lint.py \
--loglevel info \
--types ${{ env.API_TYPES }} \
--directories ${{ env.API_DIRECTORIES }} \
--excludes ${{ env.API_EXCLUDES }} \
${{ env.OPTION_WARNINGS }}
46 changes: 46 additions & 0 deletions .github/workflows/api-schema-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: api-schema-lint

# https://dev.folio.org/guides/describe-schema/

# API_DIRECTORIES: string: The space-separated list of directories to search
# for JSON Schema files.
# e.g. 'src/main/resources/openapi'
# NOTE: -- Also add each separate path to each of the "on: paths:" sections.
# e.g. 'src/main/resources/openapi/**'
#
# API_EXCLUDES: string: The space-separated list of directories and files
# to exclude from traversal, in addition to the default exclusions.
# e.g. ''

env:
API_DIRECTORIES: 'src/main/resources/openapi'
API_EXCLUDES: ''

on:
push:
paths:
- 'src/main/resources/openapi/**'
pull_request:
paths:
- 'src/main/resources/openapi/**'

jobs:
api-schema-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Prepare folio-tools
run: |
git clone https://github.com/folio-org/folio-tools
cd folio-tools/api-schema-lint \
&& yarn install \
&& pip3 install -r requirements.txt
- name: Do api-schema-lint
run: |
python3 folio-tools/api-schema-lint/api_schema_lint.py \
--loglevel info \
--directories ${{ env.API_DIRECTORIES }} \
--excludes ${{ env.API_EXCLUDES }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.idea/
target/
.vscode/
*.code-workspace
.DS_Store
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Contribution guidelines

Guidelines for Contributing Code:
[dev.folio.org/guidelines/contributing](https://dev.folio.org/guidelines/contributing)
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM folioci/alpine-jre-openjdk17:latest

ENV VERTICLE_FILE mod-batch-print-fat.jar

# Set the location of the verticles
ENV VERTICLE_HOME /usr/verticles

# Copy your fat jar to the container
COPY target/${VERTICLE_FILE} ${VERTICLE_HOME}/${VERTICLE_FILE}

# Expose this port locally in the container.
EXPOSE 8081
14 changes: 14 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
buildMvn {
publishModDescriptor = true
mvnDeploy = true
buildNode = 'jenkins-agent-java17'

doDocker = {
buildJavaDocker {
publishMaster = true
healthChk = true
healthChkCmd = 'wget --no-verbose --tries=1 --spider http://localhost:8081/admin/health || exit 1'
}
}
}

Loading

0 comments on commit e8d8b53

Please sign in to comment.