docker-based linters

This commit is contained in:
Devaev Maxim 2020-05-12 09:26:24 +03:00
parent 972c288df3
commit f1cdfd4223
6 changed files with 68 additions and 34 deletions

View File

@ -1,27 +0,0 @@
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: deps
run: |
sudo dpkg -R python3
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install -y --no-install-recommends python3.8 python3.8-distutils build-essential libevent-dev libjpeg-turbo8-dev uuid-dev libbsd-dev
sudo python3.8 get-pip.py
sudo python3.8 -m pip install tox
- name: make
run: make
- name: make tox
run: make tox

20
.github/workflows/dockerimage.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Building linters image ...
run: make linters
- name: Running linters ...
run: make tox

4
.gitignore vendored
View File

@ -1,5 +1,5 @@
/.tox/
/.mypy_cache/
/linters/.tox/
/linters/.mypy_cache/
/pkg/arch/pkg/
/pkg/arch/src/
/pkg/arch/v*.tar.gz

View File

@ -13,6 +13,8 @@ RPI_VC_LIBS ?= /opt/vc/lib
BUILD ?= build
LINTERS_IMAGE ?= $(PROG)-linters
# =====
_LIBS = -lm -ljpeg -pthread -levent -levent_pthreads -luuid
@ -99,8 +101,22 @@ release:
make clean
tox:
tox -q -c tox.ini $(if $(E),-e $(E),-p auto)
tox: linters
time docker run --rm \
--volume `pwd`:/src:ro \
--volume `pwd`/linters:/src/linters:rw \
-t $(LINTERS_IMAGE) bash -c " \
cd /src \
&& tox -q -c linters/tox.ini $(if $(E),-e $(E),-p auto) \
"
linters:
docker build \
$(if $(call optbool,$(NC)),--no-cache,) \
--rm \
--tag $(LINTERS_IMAGE) \
-f linters/Dockerfile linters
bump:
@ -112,8 +128,12 @@ push:
git push --tags
clean-all: clean
rm -rf .mypy-cache .tox
clean-all: linters clean
- docker run --rm \
--volume `pwd`:/src \
-it $(LINTERS_IMAGE) bash -c "cd src && rm -rf linters/{.tox,.mypy_cache}"
clean:
rm -rf pkg/arch/pkg pkg/arch/src pkg/arch/v*.tar.gz pkg/arch/ustreamer-*.pkg.tar.{xz,zst}
rm -rf $(PROG) $(BUILD) vgcore.* *.sock
.PHONY: linters

21
linters/Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM archlinux/base
RUN echo "Server = http://mirror.yandex.ru/archlinux/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist
RUN pacman -Syu --noconfirm \
&& pacman -S --needed --noconfirm \
base \
base-devel \
vim \
git \
libjpeg \
libevent \
libutil-linux \
libbsd \
python \
python-pip \
python-tox \
cppcheck \
&& (pacman -Sc --noconfirm || true)
CMD /bin/bash

View File

@ -4,7 +4,7 @@ skipsdist = true
[testenv]
basepython = python3.8
sitepackages = true
changedir = /src
[testenv:cppcheck]
whitelist_externals = cppcheck