Skip to content

Commit

Permalink
Merge pull request #308 from FAIRDataPipeline/hotfix/bug-fixes
Browse files Browse the repository at this point in the history
Hotfix/bug fixes
  • Loading branch information
RyanJField committed Jul 8, 2023
2 parents 9b2893b + 6d3d74d commit 34e3bbd
Show file tree
Hide file tree
Showing 40 changed files with 1,594 additions and 1,331 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ updates:
interval: "daily"
time: "00:00"
reviewers:
- "kzscisoft"
- "ryanjfield"
commit-message:
prefix: "pip"
include: "scope"
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
permissions:
contents: write
jobs:
windows-py39:
windows-py3x:
name: Deploy Latest Windows Release
runs-on: windows-latest
steps:
Expand All @@ -16,7 +16,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.9.7'
python-version: '3.x'
architecture: "x64"

- name: Get Previous tag
Expand All @@ -42,7 +42,7 @@ jobs:
name: windows_faircli
path: dist/fair-cli-${{ steps.previoustag.outputs.tag }}-x64-windows-latest.exe

macos-py39:
macos-py3x:
name: Deploy Latest macOS Release
runs-on: macos-latest
steps:
Expand All @@ -52,7 +52,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.9.7'
python-version: '3.x'
architecture: "x64"

- name: Install Poetry
Expand All @@ -79,7 +79,7 @@ jobs:
path: dist/fair-cli-${{ steps.previoustag.outputs.tag }}-x64-macos-latest


ubuntu-py39:
ubuntu-py3x:
name: Deploy Latest Linux Release
runs-on: ubuntu-latest
steps:
Expand All @@ -89,7 +89,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.9.7'
python-version: '3.x'
architecture: "x64"

- name: Install Poetry
Expand Down Expand Up @@ -120,16 +120,16 @@ jobs:
name: Create Release
runs-on: ubuntu-latest
needs:
- ubuntu-py39
- macos-py39
- windows-py39
- ubuntu-py3x
- macos-py3x
- windows-py3x
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.9.7'
python-version: '3.x'
architecture: "x64"

- name: Install Poetry
Expand Down
40 changes: 30 additions & 10 deletions .github/workflows/fair-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,50 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] #, macos-latest, windows-latest]
# Issues with GitPython and Python >3.9.6, <3.10
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.8", "3.9", "3.10", "3.x"]
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
if: ${{ runner.os != 'Windows' }}
- name: Checkout to C windows
run: |
mkdir C:/FAIR-CLI
git clone https://github.com/FAIRDataPipeline/FAIR-CLI.git C:/FAIR-CLI
cd C:/FAIR-CLI
git checkout $GITHUB_REF_NAME
echo Github Ref: $GITHUB_REF_NAME
if: ${{ runner.os == 'Windows' }}
shell: bash
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: "x64"
- name: Install Required
run: sudo apt install libmemcached-dev
if: matrix.os == 'ubuntu-latest'
- name: Install Required
run: brew install memcached
if: matrix.os == 'macos-latest'
- name: Install Poetry
run: python -m pip install poetry
- name: Install Module
run: python -m poetry install
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cd C:/FAIR-CLI
pwd
fi
python -m poetry install
shell: bash
- name: Install Python API for API Tests
run: python -m poetry run pip install git+https://github.com/FAIRDataPipeline/pyDataPipeline.git@dev
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cd C:/FAIR-CLI
pwd
fi
python -m poetry run pip install git+https://github.com/FAIRDataPipeline/pyDataPipeline.git@main
shell: bash
- name: Run Tests for Each Marker
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cd C:/FAIR-CLI
pwd
fi
for marker in $(poetry run pytest --markers | grep -oE "faircli_[a-zA-Z|_|0-9]+")
do
echo "Running tests for marker '$marker'"
Expand All @@ -41,6 +60,7 @@ jobs:
echo "ERROR: Tests for marker '$marker' failed"
fi
done
shell: bash
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/implementations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ jobs:
${GITHUB_WORKSPACE}/registry-rem/scripts/start_fair_registry -p 8001 -s drams.test-remote-settings
# Copy the remote token
cp ${GITHUB_WORKSPACE}/registry-rem/token $PWD/token
export DJANGO_SETTINGS_MODULE=drams.test-remote-settings
${GITHUB_WORKSPACE}/registry-rem/venv/bin/python ${GITHUB_WORKSPACE}/registry-rem/manage.py createsuperuser --username FAIRDataPipeline --noinput
working-directory: pySimpleModel

- name: Install the registry and init
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ cython_debug/

# Misc
*.yaml
!tests/data/*.yaml
*.yml
token.txt
.fair
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ license: BSD-2-Clause
message: If you use this software, please cite it using these metadata.
repository-code: https://github.com/FAIRDataPipeline/FAIR-CLI/
title: "The FAIR Data Pipeline command line tool"
version: 0.7.3
version: 0.8.0
14 changes: 9 additions & 5 deletions fair/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ def status(verbose, debug) -> None:
except fdp_exc.FAIRCLIException as e:
e.err_print()
if e.level.lower() == "error":
if e.level.lower() == "error":
sys.exit(e.exit_code)
sys.exit(e.exit_code)

@cli.group(invoke_without_command=True)
@click.option("--debug/--no-debug", help="Run in debug mode", default=False)
Expand All @@ -118,8 +117,10 @@ def list(ctx, debug, remote) -> None:
ctx.obj = {}
ctx.obj['DEBUG'] = debug
ctx.obj['REMOTE'] = remote
ctx.invoke(data_products)
ctx.invoke(code_runs)
_current_args = " ".join(sys.argv)
if not ("data-products" in _current_args or "code-runs" in _current_args):
ctx.invoke(data_products)
ctx.invoke(code_runs)

@list.command()
@click.pass_context
Expand Down Expand Up @@ -161,7 +162,7 @@ def create(debug, output: str) -> None:
if output
else os.path.join(os.getcwd(), fdp_com.USER_CONFIG_FILE)
)
click.echo(f"Generating new user configuration file" f" '{output}'")
click.echo(f"Generating new user configuration file '{output}'")
with fdp_session.FAIR(os.getcwd(), debug=debug) as fair_session:
fair_session.make_starter_config(output)

Expand Down Expand Up @@ -527,6 +528,7 @@ def run(
):
"""Initialises a job with the option to specify a bash command"""
# Allow no config to be specified, if that is the case use default local
click.echo("Running run please wait")
config = config[0] if config else fdp_com.local_user_config(os.getcwd())
try:
with fdp_session.FAIR(
Expand Down Expand Up @@ -636,6 +638,7 @@ def modify(ctx, label: str, url: str, debug: bool) -> None:
)
def push(remote: str, debug: bool, dirty: bool):
"""Push data between the local and remote registry"""
click.echo("Running push please wait")
remote = remote[0] if remote else "origin"
try:
with fdp_session.FAIR(
Expand Down Expand Up @@ -679,6 +682,7 @@ def config_email(user_email: str) -> None:
)
def pull(config: str, debug: bool, local: bool):
"""Update local registry from remotes and sources"""
click.echo("Running pull please wait")
config = config[0] if config else fdp_com.local_user_config(os.getcwd())
try:
with fdp_session.FAIR(
Expand Down
9 changes: 8 additions & 1 deletion fair/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,11 @@ def set_file_permissions(path: str):
for dir in [os.path.join(root,d) for d in dirs]:
os.chmod(dir, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
for file in [os.path.join(root, f) for f in files]:
os.chmod(file, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
os.chmod(file, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

def remove_readonly(fn, path, excinfo):
try:
os.chmod(path, stat.S_IWRITE)
fn(path)
except Exception as exc:
print("Skipped:", path, "because:\n", exc)
Loading

0 comments on commit 34e3bbd

Please sign in to comment.