Commit 765598dc authored by Enrique Garcia's avatar Enrique Garcia
Browse files

Merge branch 'updates_documentation' into 'master'

Update documentation

See merge request !17
parents 39993313 5be3e792
Pipeline #94131 passed with stage
in 3 minutes and 27 seconds
...@@ -6,17 +6,18 @@ ...@@ -6,17 +6,18 @@
Library to manage an upload to Zenodo through its REST API. 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. 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 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. stages of the GitLabCI-Zenodo pipeline will work correctly.
```bash ```bash
$ python .zenodoci/test_connection_zenodo.py --token YOUR_ZENODO_TOKEN --sandbox False $ 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) 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 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**. ...@@ -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 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! containers!
...@@ -78,7 +80,10 @@ The environment variable will look like this: ...@@ -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 $ 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: The `template_project_repository` contains code from different projects. This 'mixing' can be done because:
- Both 'parent' projects are Open Source. - Both 'parent' projects are Open Source.
- None of the original licenses are copy-left. - None of the original licenses are copy-left.
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
import json import json
import requests import requests
import numpy as np
from utils_zenodoci import (find_root_directory, from utils_zenodoci import (find_root_directory,
parse_codemeta_and_write_zenodo_metadata_file parse_codemeta_and_write_zenodo_metadata_file
) )
...@@ -221,7 +220,7 @@ class ZenodoAPI: ...@@ -221,7 +220,7 @@ class ZenodoAPI:
if zenodo_metadata_file.exists(): if zenodo_metadata_file.exists():
print("\n * Found .zenodo.json file within the project !") print("\n * Found .zenodo.json file within the project !")
self.exist_zenodo_metadata_file = True self.exist_zenodo_metadata_file = True
self.path_codemeta_file = zenodo_metadata_file self.path_zenodo_metadata_file = zenodo_metadata_file
else: else:
print("\n ! .zenodo.json file NOT found in the root directory of the project !") print("\n ! .zenodo.json file NOT found in the root directory of the project !")
...@@ -260,19 +259,17 @@ class ZenodoAPI: ...@@ -260,19 +259,17 @@ class ZenodoAPI:
# 1 - Test connection # 1 - Test connection
print("Testing communication with Zenodo...") print("Testing communication with Zenodo...")
test_connection = self.fetch_user_entries() test_connection = self.fetch_user_entries()
try: if test_connection.status_code == 200:
np.testing.assert_equal(test_connection.status_code, 200)
print("OK !") print("OK !")
except: else:
print(test_connection.json()) print(test_connection.json())
# 2 - Test new entry # 2 - Test new entry
print("Testing the creation of a dummy entry to (sandbox)Zenodo...") print("Testing the creation of a dummy entry to (sandbox)Zenodo...")
new_entry = self.create_new_entry() new_entry = self.create_new_entry()
try: if new_entry.status_code == 201:
np.testing.assert_equal(new_entry.status_code, 201)
print("OK !") print("OK !")
except: else:
print(new_entry.json()) print(new_entry.json())
# 3 - Test upload metadata # 3 - Test upload metadata
...@@ -285,19 +282,17 @@ class ZenodoAPI: ...@@ -285,19 +282,17 @@ class ZenodoAPI:
update_metadata = self.update_metadata_entry(test_entry_id, update_metadata = self.update_metadata_entry(test_entry_id,
data=metadata_entry data=metadata_entry
) )
try: if update_metadata.status_code == 200:
np.testing.assert_equal(update_metadata.status_code, 200)
print("OK !") print("OK !")
except: else:
print(update_metadata.json()) print(update_metadata.json())
# 4 - Test delete entry # 4 - Test delete entry
print("Testing the deletion of the dummy entry...") print("Testing the deletion of the dummy entry...")
delete_test_entry = self.erase_entry(test_entry_id) delete_test_entry = self.erase_entry(test_entry_id)
try: if delete_test_entry.status_code == 204:
np.testing.assert_equal(delete_test_entry.status_code, 204)
print("OK !") print("OK !")
except: else:
print(delete_test_entry.json()) print(delete_test_entry.json())
print("\n\tYAY ! Successful testing of the connection to Zenodo ! \n\n" print("\n\tYAY ! Successful testing of the connection to Zenodo ! \n\n"
...@@ -307,4 +302,4 @@ class ZenodoAPI: ...@@ -307,4 +302,4 @@ class ZenodoAPI:
else: 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. ...@@ -6,7 +6,7 @@ https://gitlab.in2p3.fr/escape2020/wp3/escape_metadata_template) project.
# ESCAPE metadata template # 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. 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 ...@@ -14,19 +14,21 @@ Comments are welcome. Open an issue here or [contact](mailto:vuillaume@lapp.in2p
## Quickstart ## Quickstart
1. Go to the [CodeMeta generator](https://codemeta.github.io/codemeta-generator/). Create a `codemeta.json` file based on your library/repository. 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 generate / your own file is valid ! - 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). - 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 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/)). - 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 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; 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 ...@@ -97,4 +99,4 @@ Please restrict the list of keywords within the `codemeta.json` file to the foll
- ESO - ESO
- Astronomy - Astronomy
- Astroparticle physics - Astroparticle physics
- Particle physics - Particle physics
\ No newline at end of file
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