Skip to content

Commit

Permalink
Deploy c8cf68b to api-clients
Browse files Browse the repository at this point in the history
  • Loading branch information
Deploy from CI committed Dec 7, 2023
0 parents commit 9ac5789
Show file tree
Hide file tree
Showing 12 changed files with 11,444 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Create a report to help us improve Galv
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.
Note that this should be a bug in Galv's specification or overall design, not a bug in a specific implementation of Galv.
For bugs in a specific implementation, please open an issue in the relevant repository.
- [Backend](/Battery-Intelligence-Lab/galv-backend/issues/new/choose)
- [Frontend](/Battery-Intelligence-Lab/galv-frontend/issues/new/choose)
- [Harvester](/Battery-Intelligence-Lab/galv-harvester/issues/new/choose)

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Additional context**
Add any other context or screenshots about the feature request here.
91 changes: 91 additions & 0 deletions .github/workflows/clients.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Generate documentation and associated files
# If file gets unweildy with just one job, could refactor to use outputs:
# https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs

# This name is referenced by gh-pages.yml workflow. Update there if this changes.
name: Clients
on:
workflow_run:
branches:
- main
workflows: [Validate]
types:
- completed
workflow_dispatch:
inputs:
save_output:
type: boolean
description: 'Run the deploy-to-api-clients branch step'
required: false
default: false
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false

jobs:
make-clients:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
env:
POSTGRES_PASSWORD: "galv"
DJANGO_SECRET_KEY: "long-and-insecure-key-12345"
steps:
- uses: actions/checkout@v3

# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}

- name: Make clients directory
run: |
mkdir clients
- name: Create API client - python
run: |
echo "{\"lang\": \"python\", \"type\": \"CLIENT\", \"codegenVersion\": \"V3\", \"spec\": $(cat galv-spec.json)}" > payload.json
curl -d @payload.json --output clients/galv-client-python.zip -H "Content-Type: application/json" https://generator3.swagger.io/api/generate
# Check size
if [ ! -s clients/galv-client-python.zip ]; then
echo "Downloaded python client zip file is zero bytes"
exit 1
fi
# Check we can unzip
unzip -t clients/galv-client-python.zip
- name: Create API client - typescript-axios
run: |
echo "{\"lang\": \"python\", \"type\": \"CLIENT\", \"codegenVersion\": \"V3\", \"spec\": $(cat galv-spec.json)}" > payload.json
curl -d @payload.json --output clients/galv-client-typescript-axios.zip -H "Content-Type: application/json" https://generator3.swagger.io/api/generate
# Check size
if [ ! -s clients/galv-client-typescript-axios.zip ]; then
echo "Downloaded typescript-axios client zip file is zero bytes"
exit 1
fi
# Check we can unzip
unzip -t clients/galv-client-typescript-axios.zip
- name: Push to api-clients branch
if: (github.ref_name == 'main' && github.event_name == 'workflow_run') || inputs.save_output
run: |
git worktree add api-clients
git config user.name "Deploy from CI"
git config user.email ""
cd api-clients
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/api-clients
rm -rf *
mv ../clients .
mv ../galv-spec.json .
mv ../LICENCE .
mv ../README.md .
git add .
git commit -m "Deploy $GITHUB_SHA to api-clients"
git push --set-upstream origin api-clients --force
- name: Explain skip
if: (github.ref_name != 'main' || github.event_name != 'workflow_run') && !inputs.save_output
run: |
echo "Skipping push to api-clients branch because ${{ github.ref_name }} != 'main' or ${{ github.event_name }} != 'workflow_run' and inputs.save_output is ${{ inputs.save_output }}"
59 changes: 59 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Simple workflow for deploying static content to GitHub Pages
name: Create Release

on:
# Run when Docs workflow completes
workflow_run:
branches:
- main
workflows: [Clients]
types:
- completed

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false

# Allow one concurrent deployment
concurrency:
group: "create-release"
cancel-in-progress: true

jobs:
create-release:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'api-clients'

# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}

- name: Check release version
run: |
# Extract release version from galv-spec.json
RELEASE_VERSION=$(jq -r '.info.version' galv-spec.json)
echo "Release version: $RELEASE_VERSION"
# Check if release version already exists
if git rev-parse "release/v$RELEASE_VERSION" >/dev/null 2>&1; then
echo "Release version $RELEASE_VERSION already exists"
exit 1
fi
- name: Create release branch
run: |
# Extract release version from galv-spec.json
RELEASE_VERSION=v$(jq -r '.info.version' galv-spec.json)
echo "Release version: $RELEASE_VERSION"
# Create release branch
git checkout -b "$RELEASE_VERSION"
git push --set-upstream origin "$RELEASE_VERSION"
31 changes: 31 additions & 0 deletions .github/workflows/issue-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Simple workflow for deploying static content to GitHub Pages
name: Issue Release

on:
# Run when Docs workflow completes
push:
branches:
- v*.*.*

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

jobs:
issue-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'api-clients'

- name: Release
uses: ncipollo/release-action@v1
with:
tag: github.ref_name
body: "Release ${{ github.ref_name }}."
artifacts: "galv-spec.json,clients/*"
commit: github.ref_name
artifactErrorsFailBuild: true
31 changes: 31 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Validate
on:
push:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false

jobs:
validate-spec:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
statuses: write
steps:
- uses: actions/checkout@v3
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}

- name: Lint Code Base
uses: super-linter/super-linter/slim@v5
env:
VALIDATE_OPENAPI: true
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
*.pyc
.vscode
.venv
.removed
galv/protobuf
galv/webapp/assets/protobuf
libs/galv-js-protobufs
galv-protobuf.js
webstack/.env
.pnpm-store
*.egg-info
env

.idea/

.run/

.test-data/

frontend/src/demo_matlab_code.m

**/.env.*
dev.sh
backend/backend_django/django_celery_beat.schedulersDatabaseScheduler

.harvester/

*.pptx

docker-compose.override.yml
backend/backend_django/galv/migrations/*.py
!backend/backend_django/galv/migrations/__init__.py

docs/build/

.certs/

.vhost/

.static_files/

node_modules/

.DS_Store

.tmp/test/
10 changes: 10 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Copyright (c) 2020-2023, The Chancellor, Masters and Scholars of the University
of Oxford, and the 'Galv' Developers. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Galv

[![GitHub Super-Linter](https://github.com/Battery-Intelligence-Lab/galv-spec/actions/workflows/validate.yml/badge.svg)](https://github.com/marketplace/actions/super-linter)

Galv is an open-source platform for automated storage of battery data with advanced metadata support for battery scientists.
Galv is deployed with [Docker](https://docs.docker.com/) to support robust local and cloud instances.
An example frontend view is displayed below.

<p align="center">
<img src="img/galv_frontend_v1.png" width="900" />
</p>

## Features:
- REST API for easy data storage and retrieval
- A Python, Julia, and MATLAB client for the REST API
- Metadata support using ontology definitions from BattINFO/EMMO
- A distributed platform with local data harvesters
- Docker based deployment

## Specification

Galv is built on a REST API specification.

The schema can be downloaded from the [documentation page](https://Battery-Intelligence-Lab.github.io/galv-spec/UserGuide.html#api-spec).
If you run your own instance of Galv, it will make its own schema available at `/schema/`,
and provide Swagger-UI and ReDoc documentation at `/schema/swagger-ui/` and `/schema/redoc/` respectively.

The below diagram presents an overview of Galv's architecture.
The arrows indicate the direction of data flow.

<p align="center">
<img src="docs/source/img/GalvStructure.PNG" alt="Data flows from battery cycling machines to Galv Harvesters, then to the Galv server and REST API. Metadata can be updated and data read using the web client, and data can be downloaded by the Python client." width="600" />
</p>
Binary file added clients/galv-client-python.zip
Binary file not shown.
Binary file added clients/galv-client-typescript-axios.zip
Binary file not shown.
Loading

0 comments on commit 9ac5789

Please sign in to comment.