Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #884

Merged
merged 46 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7e2086e
wip: submission flow updates
CS76 Sep 12, 2023
2241609
build: push image to Docker
NishaSharma14 Oct 18, 2023
5ab3f7e
build: remove github ref
NishaSharma14 Oct 18, 2023
f148589
fix: ui updates
CS76 Oct 18, 2023
b2c6bc5
Merge branch 'development' into new-submission-flow
CS76 Oct 18, 2023
d3f2e8f
fix: inertia migration update
CS76 Oct 18, 2023
3c82888
build: update nginx docker imahe build path
NishaSharma14 Oct 18, 2023
f8d448a
build: correct nginx image path
NishaSharma14 Oct 18, 2023
6a37e86
fix: push images to Docker Hub
NishaSharma14 Oct 18, 2023
7981b1d
fix: updated default message on nmrium
CS76 Oct 18, 2023
aa960ad
build: seperate test and invoke on workflow call
NishaSharma14 Oct 18, 2023
ee6c9b0
fix: updated spectra viewer
CS76 Oct 18, 2023
514fe93
Merge pull request #882 from NFDI4Chem/issue-#877
CS76 Oct 18, 2023
afe16e3
fix: updated spectra viewer and public study page
CS76 Oct 18, 2023
2917b02
Merge branch 'development' of https://github.com/NFDI4Chem/nmrxiv int…
CS76 Oct 18, 2023
ff42756
fix: avoiding unnecessary processing of folders
CS76 Oct 19, 2023
a805398
build: test php unit test
NishaSharma14 Oct 19, 2023
aa20bcc
fix: migrated spectra editor to support latest study based nmrium jso…
CS76 Oct 19, 2023
12305b9
Merge branch 'development' of https://github.com/NFDI4Chem/nmrxiv int…
CS76 Oct 19, 2023
d326ed4
build: rename workflow
NishaSharma14 Oct 19, 2023
40bc0d7
build: docs deploy
NishaSharma14 Oct 19, 2023
27d2add
build: add environment
NishaSharma14 Oct 19, 2023
598f571
docs: update basepath and add search
NishaSharma14 Oct 19, 2023
c2c0cc5
fix: moving full path to relative paths
CS76 Oct 19, 2023
330f92b
Merge branch 'development' of https://github.com/NFDI4Chem/nmrxiv int…
CS76 Oct 19, 2023
cbac9e7
docs: correct identatiom in the index page
NishaSharma14 Oct 19, 2023
139da25
fix: exclude nmrium and versions tables
NishaSharma14 Oct 19, 2023
401f9b2
fix: url path update
CS76 Oct 19, 2023
ce52a43
Merge branch 'development' of https://github.com/NFDI4Chem/nmrxiv int…
CS76 Oct 19, 2023
bad18af
fix: enabled nmredata detection and other minor ui changes
CS76 Oct 19, 2023
a015858
Merge branch 'development' into new-submission-flow
CS76 Oct 19, 2023
aeeaa7c
Merge pull request #883 from NFDI4Chem/backup
CS76 Oct 20, 2023
2eced5d
docs: remove base path
NishaSharma14 Oct 24, 2023
509ad93
pint
NishaSharma14 Oct 24, 2023
9081375
fix: updated submission flow - upload/publish and other changes
CS76 Oct 25, 2023
ec8e6ea
fix: more submission pipeline updates and added organism input details
CS76 Oct 26, 2023
d8c20f7
feat: new submission flow updates and various bug fixes (UI and func…
CS76 Nov 4, 2023
cb5610b
fix: minor formatting updates
CS76 Nov 4, 2023
001cc15
fix: more bug fixes and exceptions handling
CS76 Nov 6, 2023
3d59b06
fix: more bug fixes and updates
CS76 Nov 7, 2023
7939179
fix: more updates, bug fixes and refactoring
CS76 Nov 7, 2023
3c0639b
fix: bioschemas bug fix and formatting
CS76 Nov 7, 2023
2eed0ed
feat: various bug fixes, ui improvements, updated commands, php 8.2 m…
CS76 Nov 9, 2023
06be025
fix: various updates and bug fixes
CS76 Nov 10, 2023
9c0e05c
Merge branch 'new-submission-flow' into development
CS76 Nov 10, 2023
30cc6e1
fix: upload screen updates and various bug fixes
CS76 Nov 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
33 changes: 33 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Docs Deployment - GitHub pages
on:
workflow_dispatch: {}
push:
branches:
- development
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- run: npm ci
- name: Build
run: npm run docs:build
- uses: actions/configure-pages@v2
- uses: actions/upload-pages-artifact@v1
with:
path: docs/.vitepress/dist
- name: Deploy
id: deployment
uses: actions/deploy-pages@v2.0.2
79 changes: 46 additions & 33 deletions .github/workflows/build.yml → .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name : Deploy to Dev
name : Setup, Build and Publish to Dev

on:
push:
Expand All @@ -11,11 +11,16 @@ env:
DEPLOYMENT_NAME: nmrxiv-nmrxiv-app
SCHEDULER_DEPLOYMENT_NAME: nmrxiv-scheduler
WORKER_DEPLOYMENT_NAME: nmrxiv-worker
REPOSITORY_NAME: nmrxiv-dev
APP_IMAGE: nmrxiv-app
NGINX_IMAGE: nmrxiv-nginx
DOCKER_HUB_USERNAME : ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD : ${{ secrets.DOCKER_HUB_PASSWORD }}
REPOSITORY_NAME: nmrxiv
REPOSITORY_NAMESPACE: nfdi4chem
DEV_URL: https://dev.nmrxiv.org

jobs:
# php-unit-test:
# uses: NFDI4Chem/nmrxiv/.github/workflows/test.yml@development

php-unit-test:
name: Run test
runs-on: ubuntu-latest
Expand Down Expand Up @@ -43,7 +48,7 @@ jobs:
composer install --ignore-platform-reqs
- name: Prepare Laravel Application
run: |
php -r "file_exists('.env') || copy('.env.ci.dev', '.env');"
php -r "file_exists('.env') || copy('.env.ci.test', '.env');"

echo AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID_DEV }} >> .env
echo AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }} >> .env
Expand All @@ -63,12 +68,13 @@ jobs:
- name: Run Test
run: php artisan test --parallel


setup-build-publish-deploy:
name: Build & deploy to development
if: github.ref == 'refs/heads/development'
runs-on: ubuntu-latest
needs: php-unit-test
environment:
name: Dev
url: ${{ env.DEV_URL }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -79,40 +85,47 @@ jobs:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}

# Configure docker to use the gcloud command-line tool as a credential helper
- run: |-
gcloud auth configure-docker europe-west3-docker.pkg.dev
# Get the GKE credentials so we can deploy to the cluster
# Get the GKE credentials
- uses: google-github-actions/get-gke-credentials@v0.3.0
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}

# Build the Docker image
- name: Build App Image
run: |-
docker build -f ./resources/ops/docker/app/app.dockerfile \
--tag "europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$APP_IMAGE:latest" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" \
.
- name: Build Nginx Image
run: |-
docker build -f ./resources/ops/docker/nginx/nginx.dockerfile \
--tag "europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$NGINX_IMAGE:latest" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" \
.
# Push the Docker image to Google Container Registry
- name: Publish App Image to GCR
run: |-
docker push "europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$APP_IMAGE:latest"
# Login to Docker
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_PASSWORD }}

- name: Publish Nginx Image to GCR
run: |-
docker push "europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$NGINX_IMAGE:latest"
# Build and push the app Docker image
- name: Build and push App Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./resources/ops/docker/app/app.dockerfile
push: true
build-args: |
RELEASE_VERSION=dev-app-latest
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-app-latest
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_PASSWORD }}

# Build and push the nginx Docker image
- name: Build and push Nginx Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./resources/ops/docker/nginx/nginx.dockerfile
push: true
build-args: |
RELEASE_VERSION=dev-nginx-latest
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-nginx-latest
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_PASSWORD }}

# Deploy the latest Docker image to the GKE cluster
- name: Deploy
run: |-
kubectl rollout restart deployment/$DEPLOYMENT_NAME
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name : Test

on:
workflow_call:

jobs:
php-unit-test:
name: Run test
runs-on: ubuntu-latest
container:
image: kirschbaumdevelopment/laravel-test-runner:8.2

services:
postgres:
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: nmrxiv
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Install composer dependencies
run: |
composer install --ignore-platform-reqs
- name: Prepare Laravel Application
run: |
php -r "file_exists('.env') || copy('.env.ci.test', '.env');"

echo AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID_DEV }} >> .env
echo AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }} >> .env
echo MEILISEARCH_KEY=${{ secrets.MEILISEARCH_KEY_DEV }} >> .env
echo MEILISEARCH_PUBLICKEY=${{ secrets.MEILISEARCH_PUBLICKEY_DEV }} >> .env
echo TWITTER_CLIENT_ID=${{ secrets.TWITTER_CLIENT_ID_DEV }} >> .env
echo TWITTER_CLIENT_SECRET=${{ secrets.TWITTER_CLIENT_SECRET_DEV }} >> .env
echo GITHUB_CLIENT_ID=${{ secrets.CLIENT_ID_GITHUB_DEV }} >> .env
echo GITHUB_CLIENT_SECRET=${{ secrets.CLIENT_SECRET_GITHUB_DEV }} >> .env

php artisan key:generate
php artisan migrate --seed
- name: Install front-end dependencies
run: |
npm install
npm run build
- name: Run Test
run: php artisan test --parallel
146 changes: 81 additions & 65 deletions app/Actions/Project/AssignIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
namespace App\Actions\Project;

use App\Models\Project;
use App\Models\Study;
use App\Models\Ticker;
use App\Services\DOI\DOIService;
use Illuminate\Support\Collection;

class AssignIdentifier
{
Expand All @@ -21,83 +23,97 @@ public function __construct(DOIService $doiService)
}

/**
* Archive the given project.
* Archive the given model.
*
* @param mixed $project
* @param mixed $model
* @return void
*/
public function assign($project)
public function assign($model)
{
$projectIdentifier = $project->identifier ? $project->identifier : null;

if ($projectIdentifier == null) {
$projectTicker = Ticker::whereType('project')->first();
$projectIdentifier = $projectTicker->index + 1;
$projectTicker->index = $projectIdentifier;
$projectTicker->save();

$project->identifier = $projectIdentifier;
$project->save();
$project->fresh()->generateDOI($this->doiService);
$project = null;
$studies = null;
if ($model instanceof Project) {
$project = $model;
} elseif ($model instanceof Collection) {
$studies = $model;
}

$studies = $project->studies;
foreach ($studies as $study) {
$studyIdentifier = $study->identifier ? $study->identifier : null;

if ($studyIdentifier == null) {
$studyTicker = Ticker::whereType('study')->first();
$studyIdentifier = $studyTicker->index + 1;
$study->identifier = $studyIdentifier;
$studyTicker->index = $studyIdentifier;
$studyTicker->save();
}
$study->save();
$study->generateDOI($this->doiService);
if ($project) {
$projectIdentifier = $project->identifier ? $project->identifier : null;

$sample = $study->sample;
$sampleIdentifier = $sample->identifier ? $sample->identifier : null;
if ($projectIdentifier == null) {
$projectTicker = Ticker::whereType('project')->first();
$projectIdentifier = $projectTicker->index + 1;
$projectTicker->index = $projectIdentifier;
$projectTicker->save();

if ($sampleIdentifier == null) {
$sampleTicker = Ticker::whereType('sample')->first();
$sampleIdentifier = $sampleTicker->index + 1;
$sample->identifier = $sampleIdentifier;
$sample->save();

$sampleTicker->index = $sampleIdentifier;
$sampleTicker->save();
$project->identifier = $projectIdentifier;
$project->save();
$project->fresh()->generateDOI($this->doiService);
}

$molecules = $sample->molecules;

foreach ($molecules as $molecule) {
$moleculeIdentifier = $molecule->identifier ? $molecule->identifier : null;
if ($moleculeIdentifier == null) {
$moleculeTicker = Ticker::whereType('molecule')->first();
$moleculeIdentifier = $moleculeTicker->index + 1;
$molecule->identifier = $moleculeIdentifier;
$molecule->save();

$moleculeTicker->index = $moleculeIdentifier;
$moleculeTicker->save();
}
}

$datasets = $study->datasets;
foreach ($datasets as $dataset) {
$dsIdentifier = $dataset->identifier ? $dataset->identifier : null;

if ($dsIdentifier == null) {
$dsTicker = Ticker::whereType('dataset')->first();
$dsIdentifier = $dsTicker->index + 1;
$dataset->identifier = $dsIdentifier;
$studies = $project->studies;
}

$dsTicker->index = $dsIdentifier;
$dsTicker->save();
if ($studies) {
foreach ($studies as $study) {
if ($study instanceof Study) {
$studyIdentifier = $study->identifier ? $study->identifier : null;
if ($studyIdentifier == null) {
$studyTicker = Ticker::whereType('study')->first();
$studyIdentifier = $studyTicker->index + 1;
$study->identifier = $studyIdentifier;
$studyTicker->index = $studyIdentifier;
$studyTicker->save();
}
$study->save();
$study->generateDOI($this->doiService);

$sample = $study->sample;
$sampleIdentifier = $sample->identifier ? $sample->identifier : null;

if ($sampleIdentifier == null) {
$sampleTicker = Ticker::whereType('sample')->first();
$sampleIdentifier = $sampleTicker->index + 1;
$sample->identifier = $sampleIdentifier;
$sample->save();

$sampleTicker->index = $sampleIdentifier;
$sampleTicker->save();
}

$molecules = $sample->molecules;

foreach ($molecules as $molecule) {
$moleculeIdentifier = $molecule->identifier ? $molecule->identifier : null;
if ($moleculeIdentifier == null) {
$moleculeTicker = Ticker::whereType('molecule')->first();
$moleculeIdentifier = $moleculeTicker->index + 1;
$molecule->identifier = $moleculeIdentifier;
$molecule->save();

$moleculeTicker->index = $moleculeIdentifier;
$moleculeTicker->save();
}
}

$datasets = $study->datasets;
foreach ($datasets as $dataset) {
$dsIdentifier = $dataset->identifier ? $dataset->identifier : null;

if ($dsIdentifier == null) {
$dsTicker = Ticker::whereType('dataset')->first();
$dsIdentifier = $dsTicker->index + 1;
$dataset->identifier = $dsIdentifier;

$dsTicker->index = $dsIdentifier;
$dsTicker->save();
}

$dataset->save();
$dataset->generateDOI($this->doiService);
}
}

$dataset->save();
$dataset->generateDOI($this->doiService);
}
}
}
Expand Down
Loading
Loading