Skip to content

Commit

Permalink
ODK-based GitHub Action
Browse files Browse the repository at this point in the history
- Update: GH action workflow: (i) now uses ODK container, (ii) Had to change 'echo -en' to plain 'echo' due to some new incompatibility with new ODK environment, (iii) removed some comments; streamlined.
- Update: Minor updates in a few files; code comments, codestyle, verbosity
  • Loading branch information
joeflack4 committed Jun 21, 2023
1 parent 969d091 commit 8ce2f2e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 23 deletions.
27 changes: 10 additions & 17 deletions .github/workflows/buid_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,41 @@ name: Build and release
on:
schedule:
- cron: "0 0 * * 0" # weekly on Sunday at midnight
# - cron: '0 0 * * *' # every day at midnight
# - cron: "0 0 1 * *" # monthly
workflow_dispatch:

jobs:
build_and_release:
runs-on: ubuntu-latest
container: obolibrary/odkfull:v1.4.1
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install
run: |
python -m pip install --upgrade pip
make install
- name: Create .env file
run: |
echo -en "API_KEY=${{ secrets.API_KEY }}" > .env
echo "API_KEY=${{ secrets.API_KEY }}" > .env
- name: Get current time
uses: josStorer/[email protected]
id: current-time
with:
# format: YYYYMMDD-HH
# utcOffset: "+08:00"
format: YYYY-MM-DD
- name: build
run: make automated-release-artefacts -B
# TODO: change to make all when fixed: https://github.com/monarch-initiative/omim/issues/92
run: |
make automated-release-artefacts
# make all


- name: Release
run: echo Uploading files as new release.
# This one wouldn't work unless it was a tag and on-push.
# uses: softprops/action-gh-release@v1
# - name: Release
- uses: "marvinpinto/action-automatic-releases@latest"
with:
# Apparently, GITHUB_TOKEN is auto-created: https://dev.to/github/the-githubtoken-in-github-actions-how-it-works-change-permissions-customizations-3cgp
# ...even though I don't see it here: https://github.com/monarch-initiative/omim/settings/secrets/actions
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ steps.current-time.outputs.formattedTime }}"
# title: "My Title"
title: "${{ steps.current-time.outputs.formattedTime }}"
prerelease: false
# TODO: include omim.sssom.tsv when fixed: https://github.com/monarch-initiative/omim/issues/92
files: |
omim.ttl
# omim.sssom.tsv
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all help install test scrape get-pmids automated-release cleanup
.PHONY: all help install test scrape get-pmids automated-release-artefacts cleanup


# MAIN COMMANDS / GOALS ------------------------------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion omim2obo/config.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
"""Configuration"""
from pathlib import Path
import yaml
from dotenv import dotenv_values

ROOT_DIR = Path(__file__).resolve().parent.parent
DATA_DIR = ROOT_DIR / 'data'
ENV_PATH = ROOT_DIR / '.env'

with open(DATA_DIR / 'dipper/GLOBAL_TERMS.yaml') as file:
GLOBAL_TERMS = yaml.safe_load(file)

with open(DATA_DIR / 'dipper/curie_map.yaml') as file:
CURIE_MAP = yaml.safe_load(file)

config = dotenv_values(ROOT_DIR / '.env')
CONFIG = dotenv_values(ENV_PATH)
5 changes: 3 additions & 2 deletions omim2obo/parsers/omim_txt_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import pandas as pd
# from rdflib import URIRef

from omim2obo.config import config, DATA_DIR
from omim2obo.config import CONFIG, DATA_DIR
from omim2obo.namespaces import RO
from omim2obo.omim_type import OmimType

Expand Down Expand Up @@ -69,7 +69,8 @@ def get_mim_file(file_name: str, download=False, return_df=False) -> Union[List[
mim_file_tsv_path: str = str(mim_file_path).replace('.txt', '.tsv')

if download:
url = f'https://data.omim.org/downloads/{config["API_KEY"]}/{file_name}'
print(f'Downloading {file_name} from OMIM...')
url = f'https://data.omim.org/downloads/{CONFIG["API_KEY"]}/{file_name}'
# todo: This doesn't work for genemap2.txt. But does the previous URL work? If so, why not just use that?
if file_name == 'mim2gene.txt':
url = f'https://omim.org/static/omim/data/{file_name}'
Expand Down
2 changes: 1 addition & 1 deletion tests/omim2obo/parsers/test_omim_entry_parser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from omim2obo.main import CURIE_MAP
from omim2obo.parsers.omim_entry_parser import *
from omim2obo.config import ROOT_DIR, config
from omim2obo.config import ROOT_DIR, CONFIG
from omim2obo.namespaces import *
import json

Expand Down
2 changes: 1 addition & 1 deletion tests/omim2obo/parsers/test_omim_txt_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from omim2obo.parsers.omim_txt_parser import *
from omim2obo.config import ROOT_DIR, config
from omim2obo.config import ROOT_DIR, CONFIG


def test_parse_omim_id_1():
Expand Down

0 comments on commit 8ce2f2e

Please sign in to comment.