From 02c9994efe553416291613a19168d6ccfb7a009f Mon Sep 17 00:00:00 2001 From: JC Guerrero Date: Sat, 18 Jan 2025 16:06:05 -0600 Subject: [PATCH] refactor(scripts) (#44) --- .github/workflows/always.yml | 47 ++++++++++++++++++++++++--------- .gitignore | 5 ++++ .gitlinks | 4 +++ Dockerfile | 8 +++--- package.json | 7 ++--- pipelines/clean.yaml | 4 +-- pipelines/lint.yaml | 20 +++++++------- pipelines/lock.yaml | 12 ++++----- pipelines/qa.yaml | 12 ++++----- pipelines/style.yaml | 16 +++++------ pipelines/test.yaml | 8 +++--- requirements.frozen.txt | 6 ++++- requirements.poetry.dev.txt | 2 +- requirements.upgrade.txt | 1 + scripts/bash/clean.ba.sh | 9 ------- scripts/install.ba.sh | 6 ++--- scripts/pip/freeze.ba.sh | 10 ------- scripts/pip/install.ba.sh | 27 ------------------- scripts/pip/setup.ba.sh | 17 ------------ scripts/pip/upgrade.ba.sh | 12 ++++----- scripts/pipx/inject.ba.sh | 17 ------------ scripts/pipx/install.ba.sh | 17 ------------ scripts/pipx/setup.ba.sh | 11 -------- scripts/poetry/plugin/add.ba.sh | 17 ------------ scripts/prepare.ba.sh | 26 ++++++++++++++++++ scripts/setup.ba.sh | 7 ++--- 26 files changed, 133 insertions(+), 195 deletions(-) create mode 100644 .gitlinks delete mode 100644 scripts/bash/clean.ba.sh delete mode 100644 scripts/pip/freeze.ba.sh delete mode 100644 scripts/pip/install.ba.sh delete mode 100644 scripts/pip/setup.ba.sh delete mode 100644 scripts/pipx/inject.ba.sh delete mode 100644 scripts/pipx/install.ba.sh delete mode 100644 scripts/pipx/setup.ba.sh delete mode 100644 scripts/poetry/plugin/add.ba.sh create mode 100644 scripts/prepare.ba.sh diff --git a/.github/workflows/always.yml b/.github/workflows/always.yml index b6b0160..133b563 100644 --- a/.github/workflows/always.yml +++ b/.github/workflows/always.yml @@ -22,6 +22,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: percebus/github-actions-common/.github/actions/checkout@main + with: + ssh-private-key: ${{ secrets.SSH_KEY_PRIVATE }} - name: setup python @ ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v5 @@ -29,15 +31,14 @@ jobs: architecture: ${{ env.ARCHITECTURE }} python-version: ${{ env.PYTHON_VERSION }} - # includes poetry install - - name: scripts/setup.ba.sh - run: bash scripts/setup.ba.sh + - name: scripts/prepare.ba.sh + run: bash scripts/prepare.ba.sh - name: poetry install - run: poetry install + run: bash _scripts/poetry/install.ba.sh ci - name: pypyr lock - run: pypyr lock freeze=True + run: pipx run -- pypyr lock freeze=True # TODO commit back upgraded requirements @@ -67,23 +68,29 @@ jobs: runs-on: ubuntu-latest steps: - uses: percebus/github-actions-common/.github/actions/checkout@main + with: + ssh-private-key: ${{ secrets.SSH_KEY_PRIVATE }} - name: setup python @ ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v5 with: architecture: ${{ env.ARCHITECTURE }} python-version: ${{ env.PYTHON_VERSION }} - - name: pip install - run: bash scripts/install.ba.sh - uses: percebus/github-actions-node/.github/actions/node_setup@main - uses: percebus/github-actions-npm/.github/actions/npm_install@main + - name: scripts/prepare.ba.sh + run: bash scripts/prepare.ba.sh + + - name: poetry install + run: bash _scripts/poetry/install.ba.sh ci + - name: pypyr lint - run: pypyr lint stats=True + run: pipx run -- pypyr lint stats=True - name: pypyr test - run: pypyr ci lint=False + run: pipx run -- pypyr ci lint=False - name: Publish test-results.xml Summary if: always() @@ -145,23 +152,29 @@ jobs: # echo "JOB_NAME: ${{ env.JOB_NAME }}" - uses: percebus/github-actions-common/.github/actions/checkout@main + with: + ssh-private-key: ${{ secrets.SSH_KEY_PRIVATE }} - name: setup python @ ${{ matrix.PYTHON_VERSION }} uses: actions/setup-python@v5 with: architecture: ${{ matrix.ARCHITECTURE }} python-version: ${{ matrix.PYTHON_VERSION }} - - name: pip install - run: bash scripts/install.ba.sh - uses: percebus/github-actions-node/.github/actions/node_setup@main - uses: percebus/github-actions-npm/.github/actions/npm_install@main + - name: scripts/prepare.ba.sh + run: bash scripts/prepare.ba.sh + + - name: poetry install + run: bash _scripts/poetry/install.ba.sh ci + # FIXME prettier fails on windows # Because of EOL differences # Thus, we disabled 'npm' - name: pypyr test - run: pypyr ci npm=False + run: pipx run -- pypyr ci npm=False docker_compose: name: docker compose @@ -169,6 +182,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: percebus/github-actions-common/.github/actions/checkout@main + with: + ssh-private-key: ${{ secrets.SSH_KEY_PRIVATE }} + + - name: scripts/prepare.ba.sh + run: bash scripts/prepare.ba.sh 'pre-docker' - name: docker compose up run: docker compose up --abort-on-container-exit @@ -193,6 +211,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: percebus/github-actions-common/.github/actions/checkout@main + with: + ssh-private-key: ${{ secrets.SSH_KEY_PRIVATE }} + + - name: scripts/prepare.ba.sh + run: bash scripts/prepare.ba.sh - name: "docker build: ${{ matrix.DOCKER_TARGET }}" run: | diff --git a/.gitignore b/.gitignore index af02fba..9d6105b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,11 @@ tmp/ test-results.xml +# commons/scripts +repos/ +_scripts/ + + ######################## ### Python.gitignore ### SRC: https://github.com/github/gitignore/blob/main/Python.gitignore ######################## diff --git a/.gitlinks b/.gitlinks new file mode 100644 index 0000000..48cb0da --- /dev/null +++ b/.gitlinks @@ -0,0 +1,4 @@ +# SRC: https://github.com/chronoxor/gil?tab=readme-ov-file#root-gitlinks-file + +# commons/scripts +commons repos/commons https://github.com/percebus/commons.git main \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 45785ae..cf5db0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,16 +4,16 @@ FROM base AS project WORKDIR /usr/app COPY . . RUN ls -la -RUN bash scripts/bash/clean.ba.sh +RUN bash _scripts/bash/clean.ba.sh FROM project AS dev -RUN bash scripts/install.ba.sh +RUN bash _scripts/install.ba.sh FROM dev AS test -RUN pypyr ci npm=False stats=False +RUN pipx run -- pypyr ci npm=False stats=False # TODO use light image. alpine? FROM project AS release -RUN bash scripts/pip/install.ba.sh 'release' +RUN bash _scripts/pip/install.ba.sh 'release' CMD [ "python", "src/problems/" ] diff --git a/package.json b/package.json index b555b2f..c7dbc70 100644 --- a/package.json +++ b/package.json @@ -7,14 +7,15 @@ "pip:upgrade:pip": "python -m pip install --upgrade pip", "prepip:upgrade:requirements": "npm run pip:upgrade:pip", "pip:upgrade:requirements": "python -m pip install --upgrade --requirement requirements.upgrade.txt", - "pipx:setup": "bash scripts/pipx/setup.ba.sh", + "prepipx:install": "npm run pip:upgrade:requirements", + "pipx:install": "bash _scripts/pipx/install.ba.sh", "flake8": "flake8 src --benchmark --statistics", "prettier": "prettier .", "prettier:check": "npm run prettier -- --check", "prettier:write": "npm run prettier -- --write", "pre-commit:install": "pre-commit install", "dockerlint": "dockerlint Dockerfile", - "setup": "npm run pip:upgrade:requirements && npm run pipx:setup && npm run pre-commit:install", + "setup": "npm run pipx:install && npm run pre-commit:install", "lint": "npm run dockerlint && npm run prettier:check", "style": "npm run prettier:write", "poststyle": "npm run lint", @@ -22,7 +23,7 @@ "docker:build:test": "npm run docker:build -- --target test", "predocker:build": "npm run dockerlint", "docker:compose:up": "docker compose up", - "test": "pypyr ci", + "test": "pipx run -- pypyr test", "test:docker": "npm run docker:build:test", "semantic-release": "semantic-release", "tag": "npm run semantic-release" diff --git a/pipelines/clean.yaml b/pipelines/clean.yaml index 18c23cb..3188ba9 100644 --- a/pipelines/clean.yaml +++ b/pipelines/clean.yaml @@ -2,7 +2,7 @@ context_parser: pypyr.parser.keyvaluepairs steps: - name: pypyr.steps.echo in: - echoMe: "= pypyr clean ==================================================" + echoMe: = pypyr clean ================================================== - name: pypyr.steps.call in: @@ -12,4 +12,4 @@ steps: pyclean: - name: pypyr.steps.shell in: - cmd: "pipx run pyclean ." + cmd: pipx run -- pyclean . diff --git a/pipelines/lint.yaml b/pipelines/lint.yaml index d3a36dc..81780c2 100644 --- a/pipelines/lint.yaml +++ b/pipelines/lint.yaml @@ -2,7 +2,7 @@ context_parser: pypyr.parser.keyvaluepairs steps: - name: pypyr.steps.echo in: - echoMe: "= pypyr lint ================================================" + echoMe: = pypyr lint ================================================ - name: pypyr.steps.default comment: set default values for optional cli inputs in: @@ -16,7 +16,7 @@ steps: run: "{stats}" in: set: - PYLINT_CLI_ARGS: "--report y" + PYLINT_CLI_ARGS: --report y - name: pypyr.steps.call run: "{npm}" @@ -36,15 +36,15 @@ steps: dockerlint: - name: pypyr.steps.echo in: - echoMe: "=== dockerlint ==============================================" + echoMe: === dockerlint ============================================== - name: pypyr.steps.shell in: - cmd: "npm run dockerlint" + cmd: npm run dockerlint prettier: - name: pypyr.steps.echo in: - echoMe: "=== npx prettier --check ====================================" + echoMe: === npx prettier --check ==================================== - name: pypyr.steps.shell in: cmd: "npx prettier {path} --check" @@ -52,15 +52,15 @@ prettier: ruff: - name: pypyr.steps.echo in: - echoMe: "=== ruff check ==============================================" + echoMe: === ruff check ============================================== - name: pypyr.steps.shell in: - cmd: ruff check {path} + cmd: "ruff check {path}" pyright: - name: pypyr.steps.echo in: - echoMe: "=== pyright =================================================" + echoMe: === pyright ================================================= - name: pypyr.steps.shell in: cmd: pyright --warnings @@ -68,7 +68,7 @@ pyright: mypy: - name: pypyr.steps.echo in: - echoMe: "=== mypy ===================================================" + echoMe: === mypy =================================================== - name: pypyr.steps.shell in: cmd: mypy src @@ -76,7 +76,7 @@ mypy: pylint: - name: pypyr.steps.echo in: - echoMe: "=== pylint ==================================================" + echoMe: === pylint ================================================== - name: pypyr.steps.shell in: cmd: "pylint {PYLINT_CLI_ARGS} src" diff --git a/pipelines/lock.yaml b/pipelines/lock.yaml index 291d0e0..a644784 100644 --- a/pipelines/lock.yaml +++ b/pipelines/lock.yaml @@ -2,7 +2,7 @@ context_parser: pypyr.parser.keyvaluepairs steps: - name: pypyr.steps.echo in: - echoMe: "= pypyr lock ===============================================" + echoMe: = pypyr lock =============================================== - name: pypyr.steps.default comment: set default values for optional cli inputs in: @@ -19,7 +19,7 @@ steps: poetry_lock: - name: pypyr.steps.echo in: - echoMe: "= poetry lock =============================================" + echoMe: = poetry lock ============================================== - name: pypyr.steps.shell in: cmd: poetry lock @@ -27,18 +27,18 @@ poetry_lock: poetry_export: - name: pypyr.steps.echo in: - echoMe: "= poetry export requirements(cli|dev|main).txt ============" + echoMe: = poetry export requirements(cli|dev|main).txt ============ - name: pypyr.steps.shell foreach: ["cli", "main", "dev"] in: - cmd: poetry export --no-interaction --format requirements.txt --output requirements.poetry.{i}.txt --only {i} + cmd: "poetry export --no-interaction --format requirements.txt --output requirements.poetry.{i}.txt --only {i}" pip_freeze: - name: pypyr.steps.echo run: "{freeze}" in: - echoMe: "= pip freeze ==============================================" + echoMe: = pip freeze ============================================== - name: pypyr.steps.shell run: "{freeze}" in: - cmd: bash scripts/pip/freeze.ba.sh + cmd: bash _scripts/pip/freeze.ba.sh diff --git a/pipelines/qa.yaml b/pipelines/qa.yaml index 0a98b94..6b4d0f2 100644 --- a/pipelines/qa.yaml +++ b/pipelines/qa.yaml @@ -3,7 +3,7 @@ context_parser: pypyr.parser.keyvaluepairs steps: - name: pypyr.steps.echo in: - echoMe: "= pypyr qa ===================================================" + echoMe: = pypyr qa =================================================== - name: pypyr.steps.default comment: set default values for optional cli inputs in: @@ -20,24 +20,24 @@ steps: - name: pypyr.steps.shell run: "{clean}" in: - cmd: "pypyr clean path={path}" + cmd: "pipx run -- pypyr clean path={path}" - name: pypyr.steps.shell run: "{style}" in: - cmd: "pypyr style path={path} npm={npm} lint=False" + cmd: "pipx run -- pypyr style path={path} npm={npm} lint=False" - name: pypyr.steps.shell run: "{lint}" in: - cmd: "pypyr lint path={path} npm={npm} stats={stats}" + cmd: "pipx run -- pypyr lint path={path} npm={npm} stats={stats}" - name: pypyr.steps.shell run: "{test}" in: - cmd: "pypyr test path={path} lint=False stats={stats}" + cmd: "pipx run -- pypyr test path={path} lint=False stats={stats}" - name: pypyr.steps.shell run: "{integration}" in: - cmd: "pypyr test path={path} integration=True stats=False lint=False" + cmd: "pipx run -- pypyr test path={path} integration=True stats=False lint=False" diff --git a/pipelines/style.yaml b/pipelines/style.yaml index 78c78eb..103b25e 100644 --- a/pipelines/style.yaml +++ b/pipelines/style.yaml @@ -2,7 +2,7 @@ context_parser: pypyr.parser.keyvaluepairs steps: - name: pypyr.steps.echo in: - echoMe: "= pypyr style =================================================" + echoMe: = pypyr style ================================================= - name: pypyr.steps.default comment: set default values for optional cli inputs in: @@ -27,12 +27,12 @@ steps: - name: pypyr.steps.shell run: "{lint}" in: - cmd: "pypyr lint path={path} npm={npm} stats={stats}" + cmd: "pipx run -- pypyr lint path={path} npm={npm} stats={stats}" prettier: - name: pypyr.steps.echo in: - echoMe: "=== npx prettier --write ======================================" + echoMe: === npx prettier --write ====================================== - name: pypyr.steps.shell in: cmd: "npx prettier {path} --write" @@ -40,7 +40,7 @@ prettier: poetry_sort: - name: pypyr.steps.echo in: - echoMe: "=== poetry sort ========================================" + echoMe: === poetry sort ======================================== - name: pypyr.steps.shell in: cmd: poetry sort @@ -48,14 +48,14 @@ poetry_sort: ruff: - name: pypyr.steps.echo in: - echoMe: "=== ruff check --fix =========================================" + echoMe: === ruff check --fix ========================================= - name: pypyr.steps.shell in: - cmd: ruff check --fix {path} + cmd: "ruff check --fix {path}" - name: pypyr.steps.echo in: - echoMe: "=== ruff format --fix ========================================" + echoMe: === ruff format --fix ======================================== - name: pypyr.steps.shell in: - cmd: ruff format {path} + cmd: "ruff format {path}" diff --git a/pipelines/test.yaml b/pipelines/test.yaml index 07fa840..f1ef090 100644 --- a/pipelines/test.yaml +++ b/pipelines/test.yaml @@ -2,7 +2,7 @@ context_parser: pypyr.parser.keyvaluepairs steps: - name: pypyr.steps.echo in: - echoMe: "= pypyr test ================================================" + echoMe: = pypyr test ================================================ - name: pypyr.steps.default comment: set default values for optional cli inputs in: @@ -18,7 +18,7 @@ steps: - name: pypyr.steps.shell run: "{lint}" in: - cmd: "pypyr lint path={path} npm={npm} stats={stats}" + cmd: "pipx run -- pypyr lint path={path} npm={npm} stats={stats}" - name: pypyr.steps.call in: @@ -29,13 +29,13 @@ pytest: run: "{stats}" in: set: - PYTEST_CLI_ARGS: "--cov --cov-report=term-missing" + PYTEST_CLI_ARGS: --cov --cov-report=term-missing - name: pypyr.steps.set run: "{integration}" in: set: - markers: "integration" + markers: integration - name: pypyr.steps.echo in: diff --git a/requirements.frozen.txt b/requirements.frozen.txt index f9c4493..eda7709 100644 --- a/requirements.frozen.txt +++ b/requirements.frozen.txt @@ -1,6 +1,8 @@ --e git+ssh://git@github.com/percebus/algorithmic-excercises.git@3f82693d17d27e8f8146ea5b2f650b350f2b971e#egg=algorithmic_excercises +-e git+ssh://git@github.com/percebus/algorithmic-excercises.git@af6ef499ecbf725b052a78089162bbb1f44d347f#egg=algorithmic_excercises annotated-types==0.7.0 +argcomplete==3.5.3 astroid==3.3.8 +click==8.1.8 colorama==0.4.6 coverage==7.6.10 dill==0.3.9 @@ -23,6 +25,7 @@ pandas==2.2.2 pandas-stubs==2.2.3.241009 parse==1.20.2 parse_type==0.6.3 +pipx==1.7.1 platformdirs==4.3.6 pluggy==1.5.0 pycodestyle==2.12.1 @@ -47,3 +50,4 @@ tomlkit==0.13.2 types-pytz==2024.2.0.20241003 typing_extensions==4.12.2 tzdata==2024.1 +userpath==1.9.2 diff --git a/requirements.poetry.dev.txt b/requirements.poetry.dev.txt index ac48312..3fcb701 100644 --- a/requirements.poetry.dev.txt +++ b/requirements.poetry.dev.txt @@ -1,7 +1,7 @@ colorama==0.4.6 ; python_version >= "3.12" and python_full_version < "4.0.0" and sys_platform == "win32" \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 -coverage[toml]==7.6.10 ; python_version >= "3.12" and python_full_version < "4.0.0" \ +coverage==7.6.10 ; python_version >= "3.12" and python_full_version < "4.0.0" \ --hash=sha256:05fca8ba6a87aabdd2d30d0b6c838b50510b56cdcfc604d40760dae7153b73d9 \ --hash=sha256:0aa9692b4fdd83a4647eeb7db46410ea1322b5ed94cd1715ef09d1d5922ba87f \ --hash=sha256:0c807ca74d5a5e64427c8805de15b9ca140bba13572d6d74e262f46f50b13273 \ diff --git a/requirements.upgrade.txt b/requirements.upgrade.txt index e79531c..13f1418 100644 --- a/requirements.upgrade.txt +++ b/requirements.upgrade.txt @@ -1 +1,2 @@ +gil pipx diff --git a/scripts/bash/clean.ba.sh b/scripts/bash/clean.ba.sh deleted file mode 100644 index f3d5457..0000000 --- a/scripts/bash/clean.ba.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set -e -set -v - -find ./scripts -type f -exec sed -i 's/\r$//' {} \; - -set +v -set +e diff --git a/scripts/install.ba.sh b/scripts/install.ba.sh index 2926278..9008ce4 100644 --- a/scripts/install.ba.sh +++ b/scripts/install.ba.sh @@ -8,16 +8,16 @@ echo "target_config:'${target_config}'" scripts_path="$(dirname "$(readlink -f "$0")")" echo "Script directory: ${scripts_path}" -set -v +set -x # Upgrades top-level dependencies, like pipx bash ${scripts_path}/pip/upgrade.ba.sh # pipx installs CLI executables, like poetry -bash ${scripts_path}/pipx/setup.ba.sh +bash ${scripts_path}/pipx/install.ba.sh # pip installs dependencies bash ${scripts_path}/pip/install.ba.sh ${target_config} -set +v +set +x set +e diff --git a/scripts/pip/freeze.ba.sh b/scripts/pip/freeze.ba.sh deleted file mode 100644 index d602a9a..0000000 --- a/scripts/pip/freeze.ba.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -set -e -set -v - -# Backup pip-installed dependencies -python -m pip freeze --verbose > requirements.frozen.txt - -set +v -set +e diff --git a/scripts/pip/install.ba.sh b/scripts/pip/install.ba.sh deleted file mode 100644 index 5fd6aa8..0000000 --- a/scripts/pip/install.ba.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -set -e - -target_config=$1 -echo "target_config:'${target_config}'" - -PIP_CLI_OPTS="" -requirements="requirements.txt" -if [[ "$target_config" == "release" ]]; then - echo "Installing ONLY prd requirements..." - requirements="requirements.release.txt" -else - PIP_CLI_OPTS="-e" - echo "Installing everything..." -fi - -set -x - -# all pip dependencies (generated w/ poetry) -python -m pip install --verbose --requirement ${requirements} - -# The project itself (to use src) -python -m pip install --verbose ${PIP_CLI_OPTS} . - -set +x -set +e diff --git a/scripts/pip/setup.ba.sh b/scripts/pip/setup.ba.sh deleted file mode 100644 index b574f6c..0000000 --- a/scripts/pip/setup.ba.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -target_config=$1 -echo "target_config:'${target_config}'" - -parent_folder="$(dirname "$(readlink -f "$0")")" - -set -x - -bash ${parent_folder}/upgrade.ba.sh -bash ${parent_folder}/install.ba.sh ${target_config} -# bash ${parent_folder}/freeze.ba.sh # TODO? - -set +x -set +e diff --git a/scripts/pip/upgrade.ba.sh b/scripts/pip/upgrade.ba.sh index 312aa4c..2c2be0e 100644 --- a/scripts/pip/upgrade.ba.sh +++ b/scripts/pip/upgrade.ba.sh @@ -1,12 +1,10 @@ +#!/bin/bash set -e -set -v +set -x -# pip upgrades pip -python -m pip install --verbose --upgrade pip +python -m pip install --upgrade pip +python -m pip install --upgrade --requirement requirements.upgrade.txt -# pip upgrades pipx -python -m pip install --verbose --upgrade --requirement requirements.upgrade.txt - -set +v +set +x set +e diff --git a/scripts/pipx/inject.ba.sh b/scripts/pipx/inject.ba.sh deleted file mode 100644 index d283a51..0000000 --- a/scripts/pipx/inject.ba.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -filename="requirements.pipx_inject.txt" -if [[ -z $(grep '[^[:space:]]' $filename) ]]; then - echo "${filename} is empty, skipping..." - exit 0 -fi - -set -v - -# pipx inject --requirement requirements.pipx_inject.txt # FIXME -cat ${filename} | sed 's/.*/"&"/' | xargs -n 1 pipx inject - -set +v -set +e diff --git a/scripts/pipx/install.ba.sh b/scripts/pipx/install.ba.sh deleted file mode 100644 index 142dff0..0000000 --- a/scripts/pipx/install.ba.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -filename="requirements.pipx.txt" -if [[ -z $(grep '[^[:space:]]' $filename) ]]; then - echo "${filename} is empty, skipping..." - exit 0 -fi - -set -v - -cat ${filename} | sed 's/.*/"&"/' | xargs -n 1 pipx install -pipx list - -set +v -set +e diff --git a/scripts/pipx/setup.ba.sh b/scripts/pipx/setup.ba.sh deleted file mode 100644 index d47aa4d..0000000 --- a/scripts/pipx/setup.ba.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -e -set -v - -parent_folder="$(dirname "$(readlink -f "$0")")" -bash ${parent_folder}/install.ba.sh -bash ${parent_folder}/inject.ba.sh - -set +v -set +e diff --git a/scripts/poetry/plugin/add.ba.sh b/scripts/poetry/plugin/add.ba.sh deleted file mode 100644 index de6bce2..0000000 --- a/scripts/poetry/plugin/add.ba.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -filename="requirements.poetry-plugin.txt" -if [[ -z $(grep '[^[:space:]]' $filename) ]]; then - echo "${filename} is empty, skipping..." - exit 0 -fi - -set -v - -cat ${filename} | sed 's/.*/"&"/' | xargs -n 1 poetry self add -poetry self show plugins - -set +v -set +e diff --git a/scripts/prepare.ba.sh b/scripts/prepare.ba.sh new file mode 100644 index 0000000..65b9b35 --- /dev/null +++ b/scripts/prepare.ba.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -e + +environment=${1} +echo "environment: ${environment}" + +scripts_path="$(dirname "$(readlink -f "$0")")" +echo "Script directory: ${scripts_path}" + + +if [ "${environment}" == "pre-docker" ]; then + set -x + rm ${scripts_path}/setup.ba.sh + set +x +fi + +set -x + +# Upgrades top-level dependencies, like pipx +bash ${scripts_path}/pip/upgrade.ba.sh +gil clone +bash ./repos/commons/scripts/prepare.ba.sh + +set +x +set +e diff --git a/scripts/setup.ba.sh b/scripts/setup.ba.sh index e15566b..82a5860 100644 --- a/scripts/setup.ba.sh +++ b/scripts/setup.ba.sh @@ -5,16 +5,17 @@ set -e scripts_path="$(dirname "$(readlink -f "$0")")" echo "Script directory: ${scripts_path}" -set -v +set -x # Upgrades top-level dependencies, like pipx bash ${scripts_path}/pip/upgrade.ba.sh # pipx installs CLI executables, like poetry -bash ${scripts_path}/pipx/setup.ba.sh +bash ${scripts_path}/pipx/install.ba.sh # poetry has its own plugins bash ${scripts_path}/poetry/plugin/add.ba.sh -set +v + +set +x set +e