Skip to content

Update README.md

Update README.md #207

Workflow file for this run

name: testing
on:
pull_request:
push:
branches:
- main
jobs:
live-sandbox-cli:
runs-on: ubuntu-latest
steps:
- name: get a copy of the repo contents
uses: actions/checkout@v2
- name: install the project's dependencies
run: npm install
- name: generate a distributable tarball
run: npm run all
- name: install the cli from the tarball
run: sudo npm install -g zenodraft-*.tgz
- name: create a new directory to do the testing in
run: mkdir testing && cd testing
- name: test creating a new draft deposition in a new concept on zenodo sandbox
id: get_version_id
env:
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
run: |
VERSION_ID=$(zenodraft deposition create concept --sandbox)
echo "::set-output name=version_id::$VERSION_ID"
- name: test showing the complete details for the draft deposition
id: get_concept_record_id
env:
VERSION_ID: ${{ steps.get_version_id.outputs.version_id }}
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
run: |
zenodraft deposition show details --sandbox $VERSION_ID > deposition.json
CONCEPT_RECORD_ID=$(cat deposition.json | jq '.conceptrecid' --raw-output)
echo "::set-output name=concept_record_id::$CONCEPT_RECORD_ID"
- name: test showing the id of the latest draft in the newly created concept
env:
CONCEPT_RECORD_ID: ${{ steps.get_concept_record_id.outputs.concept_record_id }}
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
run: zenodraft deposition show latest --sandbox $CONCEPT_RECORD_ID
- name: test showing the prereserved doi for the draft deposition
env:
VERSION_ID: ${{ steps.get_version_id.outputs.version_id }}
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
run: zenodraft deposition show prereserved --sandbox $VERSION_ID
- name: test adding a file to the draft deposition
env:
VERSION_ID: ${{ steps.get_version_id.outputs.version_id }}
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
run: |
echo "these are the file contents" > thefile.txt
zenodraft file add --sandbox $VERSION_ID thefile.txt
- name: test removing a file from the draft deposition
env:
VERSION_ID: ${{ steps.get_version_id.outputs.version_id }}
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
run: |
zenodraft file delete --sandbox $VERSION_ID thefile.txt
- name: test updating the deposition metadata with information from a local file
env:
VERSION_ID: ${{ steps.get_version_id.outputs.version_id }}
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
run: |
echo "{\"creators\":[{\"affiliation\":\"Netherlands eScience Center\",\"name\":\"Spaaks, Jurriaan H.\",\"orcid\":\"0000-0002-7064-4069\"}],\"description\":\"Auto-generated draft deposition for CI testing of zenodraft's CLI\",\"keywords\":[\"zenodo\",\"cli\"],\"license\":{\"id\":\"Apache-2.0\"},\"title\":\"Auto-generated deposition for testing purposes\"}" > .zenodo.json
zenodraft metadata update --sandbox $VERSION_ID .zenodo.json
- name: test clearing the deposition metadata
env:
VERSION_ID: ${{ steps.get_version_id.outputs.version_id }}
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
run: zenodraft metadata clear --sandbox $VERSION_ID
- name: test deleting a draft deposition
env:
VERSION_ID: ${{ steps.get_version_id.outputs.version_id }}
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
run: zenodraft deposition delete --sandbox $VERSION_ID
unit:
runs-on: ubuntu-latest
steps:
- name: get a copy of the repo contents
uses: actions/checkout@v2
- name: install the dependencies
run: npm install
- name: run the unit tests using jest and calculate coverage
run: npm run test