Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dalito committed Aug 10, 2023
2 parents 3f7534c + 0390115 commit fe83876
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 28 deletions.
44 changes: 34 additions & 10 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
FORCE_COLOR: "1" # Make tool output pretty.
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PIP_PROGRESS_BAR: "off"
LOGLEVEL: "DEBUG"
RUN_URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID

jobs:
Expand Down Expand Up @@ -58,23 +59,46 @@ jobs:
python -m pip install --upgrade pip setuptools wheel
# install tagged version
python -m pip install git+https://github.com/nfdi4cat/voc4cat-tool.git@v0.5.1
# examples for other install options
python -m pip install git+https://github.com/nfdi4cat/voc4cat-tool.git@v0.6.2
# python -m pip install git+https://github.com/nfdi4cat/voc4cat-tool.git@main
# from private repo: python -m pip install git+https://anon:${{ SECRETS.READ_PAT_VOC4CAT }}@github.com/dalito/voc4cat-tool.git@main
- name: Dynamically set RUN_DATE environment variable
run: echo "RUN_DATE=$(date +'%Y-%m-%dT%H%M')" >> $GITHUB_ENV
# Example for installing from private repo:
# python -m pip install git+https://anon:${{ SECRETS.READ_PAT_VOC4CAT }}@github.com/dalito/voc4cat-tool.git@main
- name: Set dynamic environment variables.
run: |
echo "RUN_DATE=$(date +'%Y-%m-%dT%H%M')" >> $GITHUB_ENV
- name: Run voc4cat
- name: Run voc4cat (pre-convert checks)
run: |
voc4cat --version
voc4cat -v --ci-check --config _main_branch/idranges.toml --check --forward --logfile voc4cat.log --docs pylode --output-directory outbox inbox-excel-vocabs/
# check inbox file names
voc4cat check --config _main_branch/idranges.toml --logfile outbox/voc4cat.log --ci-pre inbox-excel-vocabs/ _main_branch/vocabularies
# check xlsx file(s). If the check fails, write annotated file to outbox.
voc4cat check --config _main_branch/idranges.toml --logfile outbox/voc4cat.log --outdir outbox inbox-excel-vocabs/
- name: Run voc4cat (convert)
run: |
# convert file(s) from xlsx in inbox to turtle in outbox
voc4cat convert --config _main_branch/idranges.toml --logfile outbox/voc4cat.log --outdir outbox inbox-excel-vocabs/
- name: Run voc4cat (post-convert checks)
run: |
# check all ttl file(s) in outbox
voc4cat check --config _main_branch/idranges.toml --logfile outbox/voc4cat.log outbox/
# check if vocabulary changes are allowed
voc4cat check --config _main_branch/idranges.toml --logfile outbox/voc4cat.log --ci-post _main_branch/vocabularies outbox/
- name: Run voc4cat (build HTML documentation)
run: |
voc4cat docs --logfile outbox/voc4cat.log --force outbox/
- name: Merge changes into vocabulary (in PR branch)
- name: Split vocabulary and merge into vocabulary dir (in PR branch)
run: |
merge_vocab --logfile voc4cat.log outbox/ vocabularies/
voc4cat transform --split --inplace --logfile outbox/voc4cat.log --outdir outbox_new_voc outbox/
merge_vocab --logfile outbox/voc4cat.log outbox_new_voc/ vocabularies/
# copy xlsx to outbox so that the xlsx file is part of the artifact
cp $(find inbox-excel-vocabs -name "*.xlsx") outbox/
git status
- name: Store artifacts
Expand Down
38 changes: 26 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# This action runs when a release is created and on merges to main.
#
# Workflow steps:
# - build docs
# - create joined vocabulary file in addition to split version
# - create excel-file from turtle
# - publish docs and excel-file to gh-pages
# - build docs
# - publish docs, vocabulary-turtle files and excel-file to gh-pages

name: Build & Publish
on:
Expand All @@ -18,6 +19,7 @@ env:
FORCE_COLOR: "1" # Make tool output pretty.
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PIP_PROGRESS_BAR: "off"
LOGLEVEL: "DEBUG"

jobs:
build:
Expand All @@ -38,16 +40,28 @@ jobs:
run: |
python -VV
python -m pip install --upgrade pip setuptools wheel
python -m pip install git+https://github.com/nfdi4cat/voc4cat-tool.git@v0.5.1
- name: Run voc4cat to build docs & Excel-files matching turtle files
# install tagged version
python -m pip install git+https://github.com/nfdi4cat/voc4cat-tool.git@v0.6.2
# python -m pip install git+https://github.com/nfdi4cat/voc4cat-tool.git@main
- name: Run voc4cat (publish joined & split SKOS/turtle)
run: |
voc4cat --version
voc4cat --docs pylode --output-directory publish vocabularies/
voc4cat --output-directory publish vocabularies/ --template templates/voc4cat_template_043.xlsx
cp -r vocabularies/ publish/
# Build joined turtle
voc4cat transform --logfile publish/voc4cat.log --join publish/
- name: Run voc4cat (build HTML documentation)
run: |
voc4cat docs --force --logfile publish/voc4cat.log publish/
- name: Run voc4cat (build current Excel file)
run: |
voc4cat convert --logfile publish/voc4cat.log --template templates/voc4cat_template_043.xlsx publish/
ls -l publish/ || echo "publish directory does not exist."
- name: Deploy documentation
- name: Deploy documentation & SKOS/turtle & xlsx
# Pin third party action (v3.9.3)
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
Expand All @@ -57,14 +71,14 @@ jobs:
publish_dir: ./publish
force_orphan: true

- name: Store xlsx file(s) as artifacts
# This step is not required and may be removed. The xlsx files are
# stored in gh-pages and can be linked which makes them easier to find.
- name: Store publish dir (=pages) as artifact
# This step is not required and may be removed.
# It may be helpful for trouble shooting.
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: voc4cat-excel-vocab
path: publish/*.xlsx
name: voc4cat-pages-content
path: publish/

# Lit:
# https://github.com/peaceiris/actions-gh-pages
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ cython_debug/
# setuptools_scm generated version file
_version.py

# output dir
# Special directories used in github actions of voc4cat vocabularies
# which must be ignored to not get committed automatically.
outbox/
outbox_new_voc/
publish/

# Special dir for a clone of main branch in gh-actions
_main_branch
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The vocabulary has been created and maintained as part of the [NFDI4Cat](http://www.nfdi4cat.org) initiative and follows our [Voc4Cat Guidelines](https://doi.org/10.5281/zenodo.7669183).

This repository was created from the template [voc4cat-template](https://github.com/nfdi4cat/voc4cat-template).
It uses the [voc4cat-tool](https://github.com/nfdi4cat/voc4cat-tool) and GitHub features like gh-actions, pull requests etc. to reduce the maintenance workload for contributors and editors.
It uses the [voc4cat-tool](https://github.com/nfdi4cat/voc4cat-tool) and GitHub features like pull requests, gh-actions, gh-pages etc. to reduce the maintenance workload for contributors and editors.

## Basic principles

Expand All @@ -26,7 +26,7 @@ To discuss about the **voc4cat**-vocabulary maintained here, create an [issue](h

To contribute new concepts or collections or change existing ones, you may either submit your contributions as Excel/xlsx-file or (as an expert) as new/changed turtle file.

> *To try out the workflow with some example data, you may use [voc4cat-playground](https://github.com/nfdi4cat/voc4cat-playground) which is identical to this repository but will be purged from time to time.*
> *To try out the workflow with some example data, you may use [voc4cat-playground](https://github.com/nfdi4cat/voc4cat-playground) which is almost identical to this repository but is not meant to last.*
Here are the steps for submitting updates in Excel.

Expand All @@ -47,7 +47,7 @@ Here are the steps for submitting updates in Excel.
- or why the proposed change may not fit.
- If you need to fix something update the pull request branch. This will trigger the pipeline to run again.

Finally, when the proposed merge request is accepted, your changes will be integrated in the vocabulary in the folder [vocabularies](https://github.com/nfdi4cat/voc4cat/tree/main/vocabularies).
Finally, when the proposed merge request is accepted, your changes will be integrated in the vocabulary in the folder [vocabularies](https://github.com/nfdi4cat/voc4cat/tree/main/vocabularies). The vocabulary is stored in split form using a folder of turtle files. Each concept, collection and concept scheme is stored in a separate file using the ID-part of the IRI as file name.

See [inbox-excel-vocabs/README.md](inbox-excel-vocabs/README.md) for a minimal example how to test the submission process.

Expand Down
5 changes: 5 additions & 0 deletions templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ The templates here match structure-wise with the templates in [Voc4Cat-tool](htt

### Version 0.4.3

#### Revision 2023-08a

- Changed included example data to be consistent with improved validation.
- Updated help on filling out provenance fields.

#### Revision 2023-07a

- Fixed typos.
Expand Down
Binary file modified templates/voc4cat_template_043.xlsx
Binary file not shown.

0 comments on commit fe83876

Please sign in to comment.