Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/dependencies-3866a005bb
Browse files Browse the repository at this point in the history
  • Loading branch information
tanwigeetika1618 authored Jan 6, 2025
2 parents 1a1fe72 + 5266dfe commit 4d864cf
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 38 deletions.
13 changes: 13 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
export HOSTNAME="${HOSTNAME:-${HOST:-$(hostname)}}"
# 'vsa' is acronym for 'visual studio ansible'
# we use HOME location below to avoid polluting the project directory with,
# temporary data and to allow us to mount the codebase on multiple machines
# for build and testing purposes.
export VIRTUAL_ENV="${HOME}/.local/share/virtualenvs/vsa"

# Command such `yarn webpack-dev` might fail with
# Reached heap limit Allocation failed - JavaScript heap out of memory
# https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes
# default 16 MiB for 64-bit systems and 8 MiB for 32-bit systems
export NODE_OPTIONS="--max-old-space-size=8192"
20 changes: 4 additions & 16 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
#!/bin/bash
# Helps direnv 2.32.1+ auto activate virtualenv but we do not require
# developers to use it.
# https://github.com/direnv/direnv/wiki/Python
export HOSTNAME="${HOSTNAME:-${HOST:-$(hostname)}}"
# 'vsa' is acronym for 'visual studio ansible'
# we use HOME location below to avoid polluting the project directory with,
# temporary data and to allow us to mount the codebase on multiple machines
# for build and testing purposes.
export VIRTUAL_ENV="${HOME}/.local/share/virtualenvs/vsa"
# direnv specifics: activate virtualenv (creates it if needed)
# for normal env vars, use .env file instead, we do not make direnv a hard
# build dependency.

# Command such `yarn webpack-dev` might fail with
# Reached heap limit Allocation failed - JavaScript heap out of memory
# https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes
# default 16 MiB for 64-bit systems and 8 MiB for 32-bit systems
export NODE_OPTIONS="--max-old-space-size=8192"

# Activate virtualenv (creates it if needed)
source .env
layout python3
source_up 2>/dev/null || true
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
env:
SKIP_DOCKER: ${{ matrix.env.SKIP_DOCKER || 0 }}
SKIP_PODMAN: ${{ matrix.env.SKIP_PODMAN || 0 }}
# NODE_OPTIONS must be kept in sync with one inside .envrc file
# NODE_OPTIONS must be kept in sync with one inside .env file
NODE_OPTIONS: --max-old-space-size=8192
TASKFILE_ARGS: --output=group --output-group-begin='::group::{{.TASK}}' --output-group-end='::endgroup::'

Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
asdf exec direnv exec . bash -c 'echo "${VIRTUAL_ENV}/bin"' >> "$GITHUB_PATH"
- name: Ensure .envrc file is automatically loaded (direnv)
- name: Ensure .env file is automatically loaded (direnv)
if: ${{ !contains(matrix.shell, 'wsl') }}
run: |
set -ex
Expand All @@ -204,8 +204,8 @@ jobs:
echo "python3 mismatch"
exit 98
}
# Ensure NODE_OPTIONS config on CI is identical with the one in .envrc
[[ "${NODE_OPTIONS:-}" == "$(asdf exec direnv exec . printenv NODE_OPTIONS)" ]] || { echo "NODE_OPTIONS mismatch between .envrc and ci.yaml"; exit 97; }
# Ensure NODE_OPTIONS config on CI is identical with the one in .env
[[ "${NODE_OPTIONS:-}" == "$(asdf exec direnv exec . printenv NODE_OPTIONS)" ]] || { echo "NODE_OPTIONS mismatch between .env and ci.yaml"; exit 97; }
- name: Enable caching
uses: actions/cache@v4
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
direnv 2.34.0
direnv 2.35.0
nodejs 20.18.0
# asdf install task latest
task 3.37.2
Expand Down
5 changes: 0 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
".gitignore": "pyproject.toml, setup.py, tox.ini, mypy.ini, .pylintrc, .yamllint, .isort.cfg, requirements.in, requirements.txt, constraints.txt, .prettierrc.yaml, .prettierignore, .mocharc.json, .pre-commit-config.yaml, cspell.config.yaml, .config, .gitattributes, .git_archival.txt, .flake8, .darglint, .ansible-lint, .packit.yaml, pytest.ini, codecov.yml, .readthedocs.yml, .prettierrc, .pre-commit-hooks.yaml, .editorconfig, .envrc, Jenkinsfile, commitlint.config.js, package-lock.json, package.nls.json, yarn.lock, tsconfig.json, .eslintrc.json, .mocharc.yml, .ncurc.json, .yarnrc.yml, .vscodeignore, webpack.config.js, webpack.config.js",
"README.md": "CONTRIBUTING.md, LICENSE, CHANGELOG.md, USAGE_DATA.md",
"Containerfile": "Dockerfile"
},
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
"editor.formatOnSave": true,
"[javascript]": {
Expand Down
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
# keep in mind that these do *not* override shell vars: https://github.com/go-task/task/issues/1733
FORCE_COLOR: "true"
PRE_COMMIT_COLOR: always
# basically the same thing from .envrc file:
# basically the same thing from .env file:
vars:
HOSTNAME:
sh: echo ${HOSTNAME:-${HOST:-$(hostname)}}
Expand Down
2 changes: 1 addition & 1 deletion packages/ansible-language-server/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ includes:
dir: ../..
internal: true
env: &env
# basically the same thing from .envrc file:
# basically the same thing from .env file:
# Avoid undesired extra hints from docker when pulling images
DOCKER_CLI_HINTS: "false"
vars:
Expand Down
2 changes: 1 addition & 1 deletion tools/precheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

if "--max-old-space-size" not in os.environ.get("NODE_OPTIONS", "") != "ignore":
print(
"FATAL: NODE_OPTIONS variable was not found, this likely means that .envrc file was not"
"FATAL: NODE_OPTIONS variable was not found, this likely means that .env file was not"
" loaded. Build will likely fail.",
file=sys.stderr,
)
Expand Down
28 changes: 19 additions & 9 deletions tools/test-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,26 @@ if [[ -z "${HOSTNAME:-}" ]]; then
fi

log notice "Install required build tools"
for PLUGIN in yarn nodejs task python direnv; do
if ! asdf plugin-list | grep -q $PLUGIN; then
asdf plugin add $PLUGIN
fi
done
asdf install
if type mise >/dev/null; then
log notice "Found mise..."
mise install
mise ls
mise doctor
elif type asdf >/dev/null; then
log notice "Found asdf..."
for PLUGIN in yarn nodejs task python direnv; do
if ! asdf plugin-list | grep -q $PLUGIN; then
asdf plugin add $PLUGIN
fi
done
asdf install

log notice "Report current build tool versions..."
asdf current
log notice "Report current build tool versions..."
asdf current
else
log fatal "Neither mise nor asdf found."
exit 3
fi

if [[ "${OSTYPE:-}" != darwin* ]]; then
pgrep "dbus-(daemon|broker)" >/dev/null || {
Expand Down Expand Up @@ -479,7 +490,6 @@ env:
tools:
ansible-lint: $(get_version ansible-lint)
ansible: $(get_version ansible)
asdf: $(get_version asdf)
bash: $(get_version bash)
gh: $(get_version gh || echo null)
git: $(get_version git)
Expand Down

0 comments on commit 4d864cf

Please sign in to comment.