Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
Merge pull request #7 from FAIRDataTeam/release/0.1.0
Browse files Browse the repository at this point in the history
Release 0.1.0
  • Loading branch information
MarekSuchanek authored Jun 16, 2020
2 parents b868d15 + e494a68 commit 6f8a5cb
Show file tree
Hide file tree
Showing 51 changed files with 4,030 additions and 2 deletions.
120 changes: 120 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: FAIRDataPoint-index CI

on:
push:
pull_request:

jobs:
btp:
name: Build-Tag-Push
runs-on: ubuntu-latest

env:
PUBLIC_IMAGE: fairdata/fairdatapoint-index
PRIVATE_IMAGE: ${{ secrets.PRIVATE_REGISTRY_URL }}/fairdatapoint-index
TAG_DEVELOP: develop
TAG_LATEST: latest
JDK_VERSION: 11

services:
mongo:
image: mongo:4.2
ports:
- 27017:27017

steps:
- uses: actions/checkout@v2

- name: Prepare JDK folder
run: mkdir -p ~/jdk

# (1) -> Prepare cache and Java
- name: Cache ~/.m2
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}

# (2) -> Prepare Java
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: ${{ env.JDK_VERSION }}
java-package: jdk
architecture: x64

- name: Verify Maven and Java
run: |
mvn --version
# (3) -> Test and build
- name: Run tests
run: |
mvn -U -B org.jacoco:jacoco-maven-plugin:prepare-agent test
- name: Build package and verify
run: |
mvn -U -B --fail-fast -DskipTests tidy:check com.github.spotbugs:spotbugs-maven-plugin:check license:check verify
# (4) -> Build Docker image
- name: Docker build
run: |
docker build -t $PRIVATE_IMAGE:$GITHUB_SHA .
# (5) -> Docker image tagging
- name: Docker login
if: github.event_name == 'push'
run: |
docker login -u "$DOCKER_HUB_USERNAME" -p "$DOCKER_HUB_PASSWORD"
docker login -u "$PRIVATE_REGISTRY_USERNAME" -p "$PRIVATE_REGISTRY_PASSWORD" "$PRIVATE_REGISTRY_URL"
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
PRIVATE_REGISTRY_URL: ${{ secrets.PRIVATE_REGISTRY_URL }}
PRIVATE_REGISTRY_USERNAME: ${{ secrets.PRIVATE_REGISTRY_USERNAME }}
PRIVATE_REGISTRY_PASSWORD: ${{ secrets.PRIVATE_REGISTRY_PASSWORD }}

- name: Docker push - commit SHA (private)
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')
run: |
docker push $PRIVATE_IMAGE:$GITHUB_SHA
- name: Docker tag and push - branch (private)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/') && !contains(github.ref, 'release')
run: |
GITHUB_BRANCH=`echo $GITHUB_REF | cut -d/ -f3- | sed 's#/#-#g'`
docker image tag $PRIVATE_IMAGE:$GITHUB_SHA $PRIVATE_IMAGE:$GITHUB_BRANCH
docker push $PRIVATE_IMAGE:$GITHUB_BRANCH
- name: Docker tag and push - develop (public)
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
run: |
docker image tag $PRIVATE_IMAGE:$GITHUB_SHA $PUBLIC_IMAGE:$TAG_DEVELOP
docker push $PUBLIC_IMAGE:$TAG_DEVELOP
- name: Docker tag and push - latest (public)
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
docker image tag $PRIVATE_IMAGE:$GITHUB_SHA $PUBLIC_IMAGE:$TAG_LATEST
docker push $PUBLIC_IMAGE:$TAG_LATEST
- name: Docker tag and push - version tag (public)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: |
GITHUB_TAG=`echo $GITHUB_REF | cut -d/ -f3`
# Release vX.Y.Z
if [[ $GITHUB_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
IMAGE_TAG_MAJOR="$PUBLIC_IMAGE:"`echo $GITHUB_TAG | sed -E "s/v(.*)\..*\..*/\1/g"`
IMAGE_TAG_MINOR="$PUBLIC_IMAGE:"`echo $GITHUB_TAG | sed -E "s/v(.*)\..*/\1/g"`
IMAGE_TAG_PATCH="$PUBLIC_IMAGE:"`echo $GITHUB_TAG | sed -E "s/v//g"`
echo "Publishing release: $IMAGE_TAG_PATCH";
docker image tag $PRIVATE_IMAGE:$GITHUB_SHA $IMAGE_TAG_MAJOR && docker push $IMAGE_TAG_MAJOR;
docker image tag $PRIVATE_IMAGE:$GITHUB_SHA $IMAGE_TAG_MINOR && docker push $IMAGE_TAG_MINOR;
docker image tag $PRIVATE_IMAGE:$GITHUB_SHA $IMAGE_TAG_PATCH && docker push $IMAGE_TAG_PATCH;
fi
# Release candidate vX.Y.Z-rc.R
if [[ $GITHUB_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$ ]]; then
IMAGE_TAG_RC="$PUBLIC_IMAGE:"`echo $GITHUB_TAG | sed -E "s/v//g"`
echo "Publishing release candidate: $IMAGE_TAG_RC";
docker image tag $PRIVATE_IMAGE:$GITHUB_SHA $IMAGE_TAG_RC && docker push $IMAGE_TAG_RC;
fi
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0]

Initial version for simple list of FAIR Data Points.

### Added

- Endpoint for "call home" ping and storing entries in MongoDB
- REST API to retrieve entries list (both all and paged) documented using Swagger/OpenAPI
- Simple webpage with table to browse entries including sorting and pagination

[Unreleased]: /../../compare/v0.1.0...develop
[0.1.0]: /../../tree/v0.1.0
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM openjdk:11-jdk-slim

WORKDIR /app

ADD target/fairdatapoint-index.jar /app/app.jar
ADD target/classes/application.yml /app/application.yml

ENTRYPOINT java -jar app.jar --spring.config.location=classpath:/application.yml,file:/app/application.yml
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
# fair-metadata-index
Index of FAIR Data Points.
# FAIRDataPoint-index

Index of FAIR Data Points

[![FAIRDataPoint-index CI](https://github.com/FAIRDataTeam/FAIRDataPoint-index/workflows/FAIRDataPoint-index%20CI/badge.svg?branch=master)](https://github.com/FAIRDataTeam/FAIRDataPoint-index/actions)
[![License](https://img.shields.io/github/license/FAIRDataTeam/FAIRDataPoint-index)](LICENSE)

# Introduction

The index serves as a registry for [FAIR Data Point](https://github.com/FAIRDataTeam/FAIRDataPoint) deployments.

# Quickstart

- build the app by running `mvn package`
- start whole stack by running `docker-compose up -d`
- visit `http://localhost:8080/`
- see API docs `http://localhost:8080/swagger-ui.html`

# License

This project is licensed under the [MIT License](LICENSE).
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3.7"
services:
index:
build: .
ports:
- "127.0.0.1:8080:8080"
- "127.0.0.1:27017:27017"
# volumes:
# - ./application.yml:/app/application.yml
mongo:
image: mongo
network_mode: service:index
# volumes:
# - ./mongo-data:/data/db
Loading

0 comments on commit 6f8a5cb

Please sign in to comment.