Commit 5be3e792 authored by Enrique Garcia's avatar Enrique Garcia
Browse files

Update documentation

parent 39993313
......@@ -6,17 +6,18 @@
Library to manage an upload to Zenodo through its REST API.
## _Quickstart_
## _Quickstart_ - Test the full OSSR-CI and the communication to Zenodo
1. Add a `codementa.json` file to your project.
2. Create a token at (sandbox)zenodo and add it as a variable to your project (see below).
- [CodeMeta generator](https://codemeta.github.io/codemeta-generator/).
2. Create a token at (sandbox)zenodo and add it as a variable to your project (see [below](#zenodo-token-gitlab-ci-environment-variable)).
3. **TEST** that you can communicate correctly with Zenodo. You will test and debug at the same time that all the
stages of the GitLabCI-Zenodo pipeline will work correctly.
```bash
$ python .zenodoci/test_connection_zenodo.py --token YOUR_ZENODO_TOKEN --sandbox False
```
## Continuous Deployment to Zenodo
## Continuous Integration to Zenodo
The source code contained in this folder is based on the [ZenodoCI](https://gitlab.in2p3.fr/escape2020/wp3/zenodoci)
project. The library was developed specifically to perform a deploy stage (to the Zenodo repository) in a GitLab CI
......@@ -24,7 +25,8 @@ pipeline that **could be implemented in any external project**.
The library (composed of the scripts within the `.zenodoci` directory) provides a module to handle the upload of
specified file(s) to the [ESCAPE2020 Zenodo community](https://zenodo.org/communities/escape2020/). Please **JUST** upload stable versions/releases of source code and/or image
specified file(s) to the [ESCAPE2020 Zenodo community](https://zenodo.org/communities/escape2020/). Please **JUST**
upload stable versions/releases of source code and/or image
containers!
......@@ -78,7 +80,10 @@ The environment variable will look like this:
$ python .zenodoci/upload_new_deposit.py --input-directory build --token $ZENODO_TOKEN --sandbox False
```
## License of the `template_project_repository`:
-------------
# License of the `template_project_repository`:
The `template_project_repository` contains code from different projects. This 'mixing' can be done because:
- Both 'parent' projects are Open Source.
- None of the original licenses are copy-left.
......
......@@ -5,7 +5,6 @@
import json
import requests
import numpy as np
from utils_zenodoci import (find_root_directory,
parse_codemeta_and_write_zenodo_metadata_file
)
......@@ -221,7 +220,7 @@ class ZenodoAPI:
if zenodo_metadata_file.exists():
print("\n * Found .zenodo.json file within the project !")
self.exist_zenodo_metadata_file = True
self.path_codemeta_file = zenodo_metadata_file
self.path_zenodo_metadata_file = zenodo_metadata_file
else:
print("\n ! .zenodo.json file NOT found in the root directory of the project !")
......@@ -260,19 +259,17 @@ class ZenodoAPI:
# 1 - Test connection
print("Testing communication with Zenodo...")
test_connection = self.fetch_user_entries()
try:
np.testing.assert_equal(test_connection.status_code, 200)
if test_connection.status_code == 200:
print("OK !")
except:
else:
print(test_connection.json())
# 2 - Test new entry
print("Testing the creation of a dummy entry to (sandbox)Zenodo...")
new_entry = self.create_new_entry()
try:
np.testing.assert_equal(new_entry.status_code, 201)
if new_entry.status_code == 201:
print("OK !")
except:
else:
print(new_entry.json())
# 3 - Test upload metadata
......@@ -285,19 +282,17 @@ class ZenodoAPI:
update_metadata = self.update_metadata_entry(test_entry_id,
data=metadata_entry
)
try:
np.testing.assert_equal(update_metadata.status_code, 200)
if update_metadata.status_code == 200:
print("OK !")
except:
else:
print(update_metadata.json())
# 4 - Test delete entry
print("Testing the deletion of the dummy entry...")
delete_test_entry = self.erase_entry(test_entry_id)
try:
np.testing.assert_equal(delete_test_entry.status_code, 204)
if delete_test_entry.status_code == 204:
print("OK !")
except:
else:
print(delete_test_entry.json())
print("\n\tYAY ! Successful testing of the connection to Zenodo ! \n\n"
......@@ -307,4 +302,4 @@ class ZenodoAPI:
else:
print("\n ! Please add a codemeta.json file to the ROOT directory of your project.\n")
print("\n ! Please add a codemeta.json file to the ROOT directory of your project.\n")
\ No newline at end of file
......@@ -6,7 +6,7 @@ https://gitlab.in2p3.fr/escape2020/wp3/escape_metadata_template) project.
# ESCAPE metadata template
ESCAPE will be following the **CodeMeta** schema context to describe metadata.
The OSSR will be following the **CodeMeta** schema context to describe metadata.
Create and incorporate a `codemeta.json` file to your project before uploading it to the ESCAPE repository.
......@@ -14,19 +14,21 @@ Comments are welcome. Open an issue here or [contact](mailto:vuillaume@lapp.in2p
## Quickstart
1. Go to the [CodeMeta generator](https://codemeta.github.io/codemeta-generator/). Create a `codemeta.json` file based on your library/repository.
- Check in the same web application that the generate / your own file is valid !
1. Go to the [CodeMeta generator](https://codemeta.github.io/codemeta-generator/). Create a `codemeta.json` file based on your library/project.
- Check - in the same web application - that the generated file is valid !
- Please for the moment restrict the list of keywords to the the ones that we propose (see below).
2. Include the `codemeta.json` file in the root directory of your project.
2. Include the `codemeta.json` file in the **root directory** of your project.
3. To automate the upload to the [ESCAPE repository](https://zenodo.org/communities/escape2020) through the GitLab-CI pipelines
- Include the `.zenodoci` library in the root directory of your project.
- Add the `ZenodoCI` library in the **root directory** of your project.
- Generate a `.zenodo.json` file (see below).
- Configure the pipeline (Quikstart and tutorials [here](https://escape2020.pages.in2p3.fr/wp3/ossr-pages/page/repository/publish_in_repository/)).
-----------------
-----------------
## Create a Zenodo metadata file from the CodeMeta schema
## Create a Zenodo metadata file from the a CodeMeta schema file
The zenodo repository does not accept codemeta metadata files yet. In the meanwhile, this library provides a simple tool
to create a native Zenodo metadata file (`.zenodo.json`) from a `codemeta.json` file. To do so;
......@@ -97,4 +99,4 @@ Please restrict the list of keywords within the `codemeta.json` file to the foll
- ESO
- Astronomy
- Astroparticle physics
- Particle physics
\ No newline at end of file
- Particle physics
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment