Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid emulation for ov development environment #5256

Merged
merged 8 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vale/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vale_*_*
styles/*
!styles/config/
!styles/Openverse/
14 changes: 14 additions & 0 deletions .vale/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

BIN_NAME="$1"
VERSION="3.7.1"
OS=$([ "$(uname)" = "Darwin" ] && echo "macOS" || echo "Linux")
ARCH=$([ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ] && echo "arm64" || echo "64-bit")

URL="https://github.com/errata-ai/vale/releases/download/v${VERSION}/vale_${VERSION}_${OS}_${ARCH}.tar.gz"

echo "Downloading ${URL}"
curl --output vale.tar.gz --location "${URL}"
tar -xvzf "vale.tar.gz" vale
mv vale "${BIN_NAME}"
rm "vale.tar.gz"
15 changes: 11 additions & 4 deletions .vale/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ _files separator="\n":
fi
echo "$files"

VALE_BIN_NAME := "vale_" + os() + "_" + arch()
VALE_STYLES_PATH := "/opt/.local/share/vale/styles"

@_link_openverse_styles:
Expand All @@ -34,9 +35,15 @@ VALE_STYLES_PATH := "/opt/.local/share/vale/styles"

# Run Vale configured for Openverse.
@run: _link_openverse_styles
# Ensure vale is available
pdm install
#!/usr/bin/env bash
# Download vale if not not found by which
if [ ! -f ./{{ VALE_BIN_NAME }} ]; then
echo "Downloading Vale"
./download.sh {{ VALE_BIN_NAME }}
fi

export VALE_STYLES_PATH={{ VALE_STYLES_PATH }}
# Sync to make sure styles are up to date (this is fast if they are already synced)
VALE_STYLES_PATH={{ VALE_STYLES_PATH }} pdm run vale sync
./{{ VALE_BIN_NAME }} sync
# Run vale :)
VALE_STYLES_PATH={{ VALE_STYLES_PATH }} pdm run vale {{ "`just _files`" }}
./{{ VALE_BIN_NAME }} {{ "`just _files`" }}
22 changes: 0 additions & 22 deletions .vale/pdm.lock

This file was deleted.

16 changes: 0 additions & 16 deletions .vale/pyproject.toml

This file was deleted.

25 changes: 16 additions & 9 deletions docker/dev_env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,22 @@ ENV PATH="${PNPM_BIN}:${N_PREFIX}/bin:${PDM_PYTHONS}:${HOME}/.local/bin:${PATH}"

# Dependency explanations:
# - git: required by some python package; contributors should use git on their host
# - perl: used in linting
# - gcc, g++: required by some pre-commit hooks for node-gyp
# - g++: required by some pre-commit hooks for node-gyp
# - just: command runner
# - jq: JSON processor
# - which: locate a program file in `PATH`
# - tree: list files in a tree
# - xdg-utils: added because Storybook wants to open in a browser
# - nodejs, npm: language runtime (does not include Corepack)
# - python*: required by some Python libraries for compilation during installation
# - libffi*: required for the Python package cffi
# - pipx: Python CLI app installer
# - nodejs: language runtime (includes npm but not Corepack)
# - libffi*: required for the Python package cffi
# - docker*: used to interact with host Docker socket
# - unzip: used to extract zip files of visual regression patches from CI artifacts
# - postgresql*: required to connect to PostgreSQL databases
# - k6: used for load testing
#
# System-specific dependencies:
# - k6: used for load testing (only installed on x86 architectures)
#
# pipx dependencies:
# - httpie: CLI HTTP client
Expand All @@ -51,10 +54,10 @@ ENV PATH="${PNPM_BIN}:${N_PREFIX}/bin:${PDM_PYTHONS}:${HOME}/.local/bin:${PATH}"
# Node dependencies:
# - n: Node.js distribution manager
# - corepack: Node.js package-manager-manager
RUN mkdir /pipx \
RUN mkdir -p $HOME/.local/bin \
&& mkdir /pipx \
&& dnf5 -y install dnf-plugins-core \
&& dnf5 -y config-manager addrepo --from-repofile=https://download.docker.com/linux/fedora/docker-ce.repo \
&& dnf5 -y install https://dl.k6.io/rpm/repo.rpm \
&& dnf5 -y install \
git \
g++ \
Expand All @@ -64,12 +67,16 @@ RUN mkdir /pipx \
tree \
xdg-utils \
nodejs npm \
python3.12 python3.12-devel pipx \
python3.12 python3.12-devel \
pipx \
libffi-devel \
docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin \
unzip \
postgresql postgresql-devel \
k6 \
&& if [ "$(uname -m)" = "x86_64" ]; then \
dnf5 -y install https://dl.k6.io/rpm/repo.rpm \
&& dnf5 -y install k6; \
fi \
&& dnf5 clean all \
&& pipx install --global \
httpie \
Expand Down
Empty file modified docker/dev_env/hooks/pre-commit
100644 → 100755
Empty file.
Empty file modified docker/dev_env/hooks/pre-push
100644 → 100755
Empty file.
3 changes: 0 additions & 3 deletions docker/dev_env/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ shared_args=(
run_args=(
-d
--name "$container_name"
# Since we have build an amd64 image, we must specify the platform to
# suppress warnings about platform mismatch.
--platform linux/amd64
# Use host network so things like Sphinx and the frontend that run directly in `ov`
# will have ports available on the host (and this way we don't have to manually map each one)
--network host
Expand Down
2 changes: 1 addition & 1 deletion ov
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ init)

build)
# k6 does not install on aarch64, so we must specify the platform on macOS.
docker build "${@:2}" --platform linux/amd64 -t openverse-dev_env:latest "$dev_env"
docker build "${@:2}" --tag openverse-dev_env:latest "$dev_env"
;;

setup-env)
Expand Down
Loading