From 8cca03a3f6388fee8456616b12c93e72f0e40565 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 23 Jan 2022 15:34:24 -0800 Subject: [PATCH 1/2] gitlab-ci: add lint job (stage: .pre) - directories to be linted can be configured in .gitlab-ci.yml's `REQUIRES_LINT` variable - removed linting from the test job Signed-off-by: Kevin Morris --- .gitlab-ci.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d682a9f5..c5554e92 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,20 @@ variables: CURRENT_DIR: "$(pwd)" LOG_CONFIG: logging.test.conf +lint: + variables: + # Space-separated list of directories that should be linted. + REQUIRES_LINT: "aurweb test migrations" + stage: .pre + before_script: + - pacman -Sy --noconfirm --noprogressbar --cachedir .pkg-cache + archlinux-keyring + - pacman -Syu --noconfirm --noprogressbar --cachedir .pkg-cache + python python-isort flake8 + script: + - bash -c 'flake8 --count $(echo "$REQUIRES_LINT" | xargs); exit $?' + - bash -c 'isort --check-only $(echo "$REQUIRES_LINT" | xargs); exit $?' + test: stage: test tags: @@ -36,12 +50,6 @@ test: # Run pytest. - pytest - make -C test coverage # Produce coverage reports. - - flake8 --count aurweb # Assert no flake8 violations in aurweb. - - flake8 --count test # Assert no flake8 violations in test. - - flake8 --count migrations # Assert no flake8 violations in migrations. - - isort --check-only aurweb # Assert no isort violations in aurweb. - - isort --check-only test # Assert no flake8 violations in test. - - isort --check-only migrations # Assert no flake8 violations in migrations. coverage: '/TOTAL.*\s+(\d+\%)/' artifacts: reports: From 2f294480a9db0b180c5205d22f0e264697b3e289 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 23 Jan 2022 15:44:58 -0800 Subject: [PATCH 2/2] docker: simplify keyring update - this wasn't using .pkg-cache before; we should, in case we already have the updated package downloaded. Signed-off-by: Kevin Morris --- docker/scripts/install-deps.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docker/scripts/install-deps.sh b/docker/scripts/install-deps.sh index ced18c81..72b291c6 100755 --- a/docker/scripts/install-deps.sh +++ b/docker/scripts/install-deps.sh @@ -5,11 +5,7 @@ set -eou pipefail # Update and rollout archlinux-keyring keys. -pacman-key --init -pacman-key --updatedb -pacman-key --populate - -pacman -Sy --noconfirm --noprogressbar archlinux-keyring +pacman -Sy --noconfirm --noprogressbar --cachedir .pkg-cache archlinux-keyring # Install other OS dependencies. pacman -Syu --noconfirm --noprogressbar \