Skip to content

Commit

Permalink
Merge pull request #118 from ghga-de/refactor
Browse files Browse the repository at this point in the history
Merge refactor branch into main
  • Loading branch information
lkuchenb authored Jun 19, 2023
2 parents 8d6d0ed + 7b1d0e6 commit 37d28ec
Show file tree
Hide file tree
Showing 1,152 changed files with 12,683 additions and 64,568 deletions.
18 changes: 18 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM mcr.microsoft.com/vscode/devcontainers/python:3.9-bullseye

ENV PYTHONUNBUFFERED 1

# Update args in docker-compose.yaml to set the UID/GID of the "vscode" user.
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then groupmod --gid $USER_GID vscode && usermod --uid $USER_UID --gid $USER_GID vscode; fi

# [Option] Install Node.js
ARG INSTALL_NODE="true"
ARG NODE_VERSION="lts/*"
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

# Copy install and launcher script to bin:
COPY ./dev_install /bin

CMD ["sleep", "infinity"]
7 changes: 7 additions & 0 deletions .devcontainer/dev_build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# build artifacts from the linkml schema

cd /workspace

make all
make gen-creation-schema-artifacts stage-derived-schemas
9 changes: 9 additions & 0 deletions .devcontainer/dev_install
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# install service in dev container

cd /workspace

# install in edit mode with testing dependencies
pip install \
-r \
requirements.txt
81 changes: 81 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/python-3-postgres
// Update the VARIANT arg in docker-compose.yml to pick a Python version: 3, 3.8, 3.7, 3.6
{
"name": "ghga-metadata-schema",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
// Set *default* container specific settings.json values on container create.
"customizations": {
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash"
}
},
"python.pythonPath": "/usr/local/bin/python",
"python.languageServer": "Pylance",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.formatting.provider": "black",
"python.analysis.typeCheckingMode": "basic",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.testing.pytestPath": "/usr/local/py-utils/bin/pytest",
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"editor.formatOnSave": true,
"editor.renderWhitespace": "all",
"editor.rulers": [
88
],
"licenser.license": "Custom",
"licenser.customHeaderFile": "/workspace/.devcontainer/license_header.txt"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"mikestead.dotenv",
"ms-azuretools.vscode-docker",
"ms-python.python",
"ms-python.isort",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter",
"njpwerner.autodocstring",
"redhat.vscode-yaml",
"42crunch.vscode-openapi",
"arjun.swagger-viewer",
"eamodio.gitlens",
"github.vscode-pull-request-github",
"streetsidesoftware.code-spell-checker",
"yzhang.markdown-all-in-one",
"visualstudioexptteam.vscodeintellicode",
"ymotongpoo.licenser",
"editorconfig.editorconfig",
"bierner.markdown-mermaid"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [5000, 5432],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "dev_install",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"enableNonRootDocker": "true",
"moby": true,
"azureDnsAutoDetection": false
}
}
}
30 changes: 30 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3'

services:
app:
build:
context: .
dockerfile: ./Dockerfile
args:
# [Choice] Python version: 3, 3.8, 3.7, 3.6
VARIANT: 3.9
# [Choice] Install Node.js
INSTALL_NODE: "true"
NODE_VERSION: "lts/*"
# Please adapt to package name:
PACKAGE_NAME: "my_microservice"
# On Linux, you may need to update USER_UID and USER_GID below if not your local UID is not 1000.
USER_UID: 1000
USER_GID: 1000

init: true
privileged: true

volumes:
- ..:/workspace:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Uncomment the next line to use a non-root user for all processes.
user: vscode
42 changes: 42 additions & 0 deletions .erdiagrams.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Configuration parameters used by ./scripts/update_entity_relations.py
- title: Global Overview
description: An overview of the entire submission schema.
model: submission.yaml
tree_root: true
include_attributes: false
- title: Sample, Biospecimen, & Individual
description: Focusses on the relation between Sample, Biospecimen, and Individual.
model: submission.yaml
classes: ["Sample", "Biospecimen", "Individual"]
tree_root: false
include_attributes: false
- title: Experiment, Sample, & File
description: Focusses on the relation between Experiment, Sample, and File.
model: submission.yaml
classes: ["SequencingExperiment", "Sample", "File", "SequencingProcess"]
tree_root: false
include_attributes: false
- title: Study, Condition, & Sample
description: Focusses on the relation between Study, Condition, and Sample.
model: submission.yaml
classes: ["Study", "Condition", "Sample"]
tree_root: false
include_attributes: false
- title: Sample, Biospecimen, & Individual (with attributes)
description: Focusses on the details of the relation between Sample, Biospecimen, and Individual.
model: submission.yaml
classes: ["Sample", "Biospecimen", "Individual"]
tree_root: false
include_attributes: true
- title: Experiment, Sample, & File (with attributes)
description: Focusses on the relation between Experiment, Sample, and File.
model: submission.yaml
classes: ["SequencingExperiment", "Sample", "File", "SequencingProcess"]
tree_root: false
include_attributes: true
- title: Study, Condition, & Sample (with attributes)
description: Focusses on the relation between Study, Condition, and Sample.
model: submission.yaml
classes: ["Study", "Condition", "Sample"]
tree_root: false
include_attributes: true
53 changes: 0 additions & 53 deletions .github/workflows/build-artifacts.yml

This file was deleted.

52 changes: 13 additions & 39 deletions .github/workflows/build-documentation.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,23 @@
# This is a basic workflow to help you get started with Actions

name: Build Documentation

# Controls when the workflow will run
on:
workflow_run:
workflows: ["Build and update artifacts"]
branches: [main]
types:
- completed
push:
branches: [ main ]
paths:
- docs/*

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
on: push

jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
build-docs:
name: Build documentation
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: 3.9

- name: Install dependencies
run: |
run: >-
pip install -r requirements.txt
- name: Build docs and push to gh-pages
run: |
git pull
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
make gh-deploy
- name: Build docs
run: >-
./scripts/generate_linkml_docs.py --check
50 changes: 0 additions & 50 deletions .github/workflows/build.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/check_erdiagrams.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check entity relationship diagrams

on: push

jobs:
check-erdiagrams:
name: check entity relationship diagrams
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: Install dependencies
run: >-
pip install -r requirements.txt
- name: check entity relationship diagrams
run: >-
./scripts/update_entity_relations.py --check
Loading

0 comments on commit 37d28ec

Please sign in to comment.