diff --git a/.docker/Dockerfile.ci b/.docker/Dockerfile.ci new file mode 100644 index 00000000..010616a1 --- /dev/null +++ b/.docker/Dockerfile.ci @@ -0,0 +1,25 @@ +FROM golang:1.19 + +WORKDIR /tmp + +# Install apt packages +RUN apt-get update && apt-get install --no-install-recommends -y \ + pip \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + && rm -rf /var/lib/apt/lists/* + +# Dash → Bash +RUN echo "dash dash/sh boolean false" | debconf-set-selections +RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash + +RUN useradd -u 1234 -d /home/ci -m ci +USER ci + +ENV PATH="$PATH:/home/ci/.local/bin" + +COPY .pre-commit-config.yaml . + +RUN pip install "pre-commit==3.1.1" \ + && git init . \ + && pre-commit install-hooks \ + && rm -rf /tmp/* diff --git a/.woodpecker/full-pre-commit.yml b/.woodpecker/full-pre-commit.yml new file mode 100644 index 00000000..4aa62c1c --- /dev/null +++ b/.woodpecker/full-pre-commit.yml @@ -0,0 +1,11 @@ +pipeline: + # Kludge for non-root containers under WoodPecker + fix-ownership: + image: alpine:latest + commands: chown -R 1234:1234 . + + full-pre-commit: + image: git.frostfs.info/truecloudlab/frostfs-ci:v0.36 + commands: + - export HOME="$(getent passwd $(id -u) | cut '-d:' -f6)" + - pre-commit run -a diff --git a/.woodpecker/pre-commit.yml b/.woodpecker/pre-commit.yml new file mode 100644 index 00000000..debe0cba --- /dev/null +++ b/.woodpecker/pre-commit.yml @@ -0,0 +1,17 @@ +pipeline: + # Kludge for non-root containers under WoodPecker + fix-ownership: + image: alpine:latest + commands: chown -R 1234:1234 . + + pre-commit: + image: git.frostfs.info/truecloudlab/frostfs-ci:v0.36 + commands: + - export HOME="$(getent passwd $(id -u) | cut '-d:' -f6)" + - pre-commit run + + unit: + image: git.frostfs.info/truecloudlab/frostfs-ci:v0.36 + commands: + - export HOME="$(getent passwd $(id -u) | cut '-d:' -f6)" + - make test