Commit e4561ebd authored by Vuillaume's avatar Vuillaume
Browse files

Fix update_codemeta, eossr version and skip_ci during CI

parent 33f94c00
......@@ -10,8 +10,6 @@
# GITLAB_USERNAME Username associated with the personal access token.
# COMMIT_MESSAGE Commit message Automatic update of CodeMeta
stages:
- update_codemeta
update_codemeta:
......@@ -23,8 +21,12 @@ update_codemeta:
- git config --global user.email "${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}"
- git config --global user.name "${GIT_USER_NAME:-$GITLAB_USER_NAME}"
- git fetch && git checkout "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"
- git config pull.rebase false
- git fetch && git checkout "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" && git pull origin "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"
script:
# setuptools_scm needs to be installed before or it can't be used to determine eossr version during install
- pip install setuptools_scm
- pip install .
- python eossr/scripts/update_codemeta_eossr.py -c codemeta.json
- cat codemeta.json
......@@ -39,7 +41,7 @@ update_codemeta:
git status
# Commit all changes
git commit -m "Auto-update codemeta.json"
git commit -m "Auto-update codemeta.json [skip ci]"
# Update the repository and make sure to skip the pipeline create for this commit
git push https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" -o ci.skip
......
stages:
- install
- test
- update_codemeta
- test_codemeta
- build_containers
- zenodo
- deploy_pages
- pypi_publish
- update_codemeta
include: '.gitlab-ci-update-codemeta.yml'
.junit_template: &junit_definition
......@@ -19,7 +20,7 @@ install:
stage: install
image: python:slim
script:
- apt-get -y update
- apt-get -y update && apt-get install git -y
- pip install --upgrade pip
- pip install .
- eossr-codemeta2zenodo --help
......@@ -33,7 +34,7 @@ test:
stage: test
image: python:slim
script:
- apt-get -y update
- apt-get -y update && apt-get install git -y
- pip install -e ".[tests]"
- pytest eossr/
--junitxml=junit_py37.xml
......@@ -60,7 +61,7 @@ test_ci_eossr:
test_codemeta_ingestion:
stage: test
stage: test_codemeta
image: gitlab-registry.in2p3.fr/escape2020/wp3/eossr:dev
script:
- eossr-check-connection-zenodo --token $ZENODO_TOKEN -p $CI_PROJECT_DIR
......
......@@ -2,7 +2,7 @@ FROM docker.io/python:3.8-slim
SHELL [ "/bin/bash", "-c"]
RUN apt update
RUN apt update && apt-get install -y git
COPY . eossr
RUN pip install "./eossr"
RUN rm -rf eossr
......
......@@ -2,10 +2,10 @@
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"name": "eossr",
"description": "<p align=\"left\"><img src=\"docs/images/eossr_logo.png\" width=\"400px\" ></p><h1>The ESCAPE OSSR library</h1><p>The eOSSR Python library gathers all the developments made for the OSSR. In particular, it includes:- an API to programmatically access the OSSR, retrieve records and publish content- functions to map and crosswalk metadata between the CodeMeta schema adopted for the OSSR and Zenodo internal schema- functions to help developers automatically contribute to the OSSR, in particular using their continuous integration (see also code snippets)</p><p>Code: <a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr\">https://gitlab.in2p3.fr/escape2020/wp3/eossr</a>Documentation: <a href=\"https://escape2020.pages.in2p3.fr/wp3/eossr/\">https://escape2020.pages.in2p3.fr/wp3/eossr/</a></p><p><a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/commits/master\"><img alt=\"\" src=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/badges/master/pipeline.svg\" /></a><a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/commits/master\"><img alt=\"\" src=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/badges/master/coverage.svg\" /></a><a href=\"https://bestpractices.coreinfrastructure.org/projects/5712\"><img alt=\"CII Best Practices\" src=\"https://bestpractices.coreinfrastructure.org/projects/5712/badge\" /></a><a href=\"https://opensource.org/licenses/MIT\"><img alt=\"\" src=\"https://img.shields.io/badge/License-MIT-blue.svg\" /></a><a href=\"https://doi.org/10.5281/zenodo.5524912\"><img alt=\"\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.5524912.svg\" /></a><a href=\"https://mybinder.org/v2/git/https%3A%2F%2Fgitlab.in2p3.fr%2Fescape2020%2Fwp3%2Feossr/HEAD\"><img alt=\"\" src=\"https://mybinder.org/badge_logo.svg\" /></a></p><h2>Former stable versions</h2><ul><li>v0.5: <a href=\"https://doi.org/10.5281/zenodo.6352039\"><img alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.6352039.svg\" /></a></li><li>v0.4: <a href=\"https://doi.org/10.5281/zenodo.6326454\"><img alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.6326454.svg\" /></a></li><li>v0.3.3: <a href=\"https://doi.org/10.5281/zenodo.5592584\"><img alt=\"\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.5592584.svg\" /></a></li><li>v0.2 : <a href=\"https://doi.org/10.5281/zenodo.5524913\"><img alt=\"\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.5524913.svg\" /></a></li></ul><h2>Install</h2><p>Commands to be run in your terminal.</p><h3>For users</h3><pre><code>pip install eossr</code></pre><p>You can also run it with docker:</p><pre><code>docker run -it gitlab-registry.in2p3.fr/escape2020/wp3/eossr:latest</code></pre><p><a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/container_registry\">Visit our registry</a> to see the available docker containers.</p><p>Note that <code>latest</code> tag always point to the latest stable released container.</p><h3>For developers</h3><pre><code>git clone https://gitlab.in2p3.fr/escape2020/wp3/eossr.gitpip install -e &quot;./eossr&quot;</code></pre><h4>Running tests</h4><p>To run tests locally, run:</p><pre><code>pip install -e &quot;./eossr[tests]&quot;pytest eossr</code></pre><p>Some tests will be skiped if <code>SANDBOX_ZENODO_TOKEN</code> is not defined in your environment variables.If you want to run these tests, you will need to create a <a href=\"https://sandbox.zenodo.org/account/settings/applications/tokens/new/\">sandbox zenodo token</a> and add it to your env:</p><pre><code>export SANDBOX_ZENODO_TOKEN=&quot;your_sandbox_token&quot;</code></pre><h2>License</h2><p>See <a href=\"LICENSE\">LICENSE</a></p><h2>Cite</h2><p>To cite this library, use the cite section in <a href=\"https://zenodo.org/record/5592584#.YiALJRPMI-Q\">the Zenodo page</a> (rightcolumn, below the <code>Versions</code> section).</p>",
"description": "<p align=\"left\"><img src=\"docs/images/eossr_logo.png\" width=\"400px\" ></p><h1>The ESCAPE OSSR library</h1><p>The eOSSR Python library gathers all the developments made for the OSSR. In particular, it includes:- an API to programmatically access the OSSR, retrieve records and publish content- functions to map and crosswalk metadata between the CodeMeta schema adopted for the OSSR and Zenodo internal schema- functions to help developers automatically contribute to the OSSR, in particular using their continuous integration (see also code snippets)</p><p>Code: <a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr\">https://gitlab.in2p3.fr/escape2020/wp3/eossr</a>Documentation: <a href=\"https://escape2020.pages.in2p3.fr/wp3/eossr/\">https://escape2020.pages.in2p3.fr/wp3/eossr/</a></p><p><a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/commits/master\"><img alt=\"\" src=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/badges/master/pipeline.svg\" /></a><a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/commits/master\"><img alt=\"\" src=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/badges/master/coverage.svg\" /></a><a href=\"https://bestpractices.coreinfrastructure.org/projects/5712\"><img alt=\"CII Best Practices\" src=\"https://bestpractices.coreinfrastructure.org/projects/5712/badge\" /></a><a href=\"https://opensource.org/licenses/MIT\"><img alt=\"\" src=\"https://img.shields.io/badge/License-MIT-blue.svg\" /></a><a href=\"https://doi.org/10.5281/zenodo.5524912\"><img alt=\"\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.5524912.svg\" /></a><a href=\"https://mybinder.org/v2/git/https%3A%2F%2Fgitlab.in2p3.fr%2Fescape2020%2Fwp3%2Feossr/HEAD\"><img alt=\"\" src=\"https://mybinder.org/badge_logo.svg\" /></a></p><h2>Former stable versions</h2><ul><li>v0.6: <a href=\"https://doi.org/10.5281/zenodo.6475946\"><img alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.6475946.svg\" /></a></li><li>v0.5: <a href=\"https://doi.org/10.5281/zenodo.6352039\"><img alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.6352039.svg\" /></a></li><li>v0.4: <a href=\"https://doi.org/10.5281/zenodo.6326454\"><img alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.6326454.svg\" /></a></li><li>v0.3.3: <a href=\"https://doi.org/10.5281/zenodo.5592584\"><img alt=\"\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.5592584.svg\" /></a></li><li>v0.2 : <a href=\"https://doi.org/10.5281/zenodo.5524913\"><img alt=\"\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.5524913.svg\" /></a></li></ul><h2>Install</h2><p>Commands to be run in your terminal.</p><h3>For users</h3><pre><code>pip install eossr</code></pre><p>You can also run it with docker:</p><pre><code>docker run -it gitlab-registry.in2p3.fr/escape2020/wp3/eossr:latest</code></pre><p><a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/container_registry\">Visit our registry</a> to see the available docker containers.</p><p>Note that <code>latest</code> tag always point to the latest stable released container.</p><h3>For developers</h3><pre><code>git clone https://gitlab.in2p3.fr/escape2020/wp3/eossr.gitpip install -e &quot;./eossr&quot;</code></pre><h4>Running tests</h4><p>To run tests locally, run:</p><pre><code>pip install -e &quot;./eossr[tests]&quot;pytest eossr</code></pre><p>Some tests will be skiped if <code>SANDBOX_ZENODO_TOKEN</code> is not defined in your environment variables.If you want to run these tests, you will need to create a <a href=\"https://sandbox.zenodo.org/account/settings/applications/tokens/new/\">sandbox zenodo token</a> and add it to your env:</p><pre><code>export SANDBOX_ZENODO_TOKEN=&quot;your_sandbox_token&quot;</code></pre><h2>License</h2><p>See <a href=\"LICENSE\">LICENSE</a></p><h2>Cite</h2><p>To cite this library, use the cite section in <a href=\"https://zenodo.org/record/5592584#.YiALJRPMI-Q\">the Zenodo page</a> (rightcolumn, below the <code>Versions</code> section).</p>",
"license": "https://spdx.org/licenses/MIT",
"version": "v0.6",
"softwareVersion": "v0.6",
"version": "v0.7.dev32+g33d2f4f",
"softwareVersion": "v0.7.dev32+g33d2f4f",
"codeRepository": "https://gitlab.in2p3.fr/escape2020/wp3/eossr",
"developmentStatus": "active",
"isAccessibleForFree": true,
......@@ -43,11 +43,11 @@
"zenodo"
],
"runtimePlatform": "Python 3",
"downloadUrl": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v0.6/eossr-v0.6.zip",
"downloadUrl": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v0.7.dev32+g33d2f4f/eossr-v0.7.dev32+g33d2f4f.zip",
"releaseNotes": "eossr v0.6 Minor bug fixes and documentation improvements. Full changelog: https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/releases/v0.6",
"dateCreated": "2021-08-31",
"datePublished": "2022-04-22",
"dateModified": "2022-04-22",
"datePublished": "2022-05-04",
"dateModified": "2022-05-04",
"operatingSystem": "",
"maintainer": {
"@type": "Person",
......
......@@ -65,8 +65,12 @@ def test_zip_repository():
)
def test_readme_to_html():
eutils.markdown_to_html()
def test_markdown_to_html():
with tempfile.TemporaryDirectory() as tmpdir:
_, tmpfile = tempfile.mkstemp()
Path(tmpfile).write_text("# Hello Markdown")
html = eutils.markdown_to_html(tmpfile)
assert html == '<h1>Hello Markdown</h1>'
def test_update_codemeta():
......
# this is adapted from https://github.com/astropy/astropy/blob/master/astropy/version.py
# see https://github.com/astropy/astropy/pull/10774 for a discussion on why this needed.
import warnings
try:
try:
from ._dev_version import version
except ImportError:
except ImportError as e:
warnings.warn(e.msg)
from ._version import __version__ as version
except Exception as e:
import warnings
warnings.warn(
"Could not determine eossr version; this indicates a broken installation."
" Install eossr from PyPI, a local git repository or using "
" pip install git+https://gitlab.in2p3.fr/escape2020/wp3/eossr@VERSION "
" Installing github's autogenerated source release tarballs "
" Installing gitlab's autogenerated source release tarballs "
" does not include version information and should be avoided."
f"Exception Error: {e}"
)
del warnings
version = "0.0.0"
__version__ = version
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