diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d93cd99a0df80a4d1d81ec102262eaab431cb8b3..d591c6614523eaffb8929993fb7f44ee9c3fc718 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,15 +1,34 @@
-image: "python:3.7"
+image: "python:3.6"
+
+# Change pip's cache directory to be inside the project directory since we can
+# only cache local items.
+variables:
+  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
+
+cache:
+  paths:
+    - .cache/pip
+    - venv/
 
 before_script:
   - python --version
-  - pip install pylint
+  - python3 -m venv venv
+  - source venv/bin/activate
+  - pip install black==22.3.0 flake8==4.0.1
 
 stages:
   - lint
 
-linting:
+black:
+  tags:
+    - lint
+  stage: lint
+  script:
+    - black --check --diff .
+
+flake8:
   tags:
     - lint
   stage: lint
   script:
-    - pylint --ignore=tests.py --max-line-length=120 *.py app
+    - flake8 .