From db48cc64f5148c701fb902291efd195e6beb270a Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Sun, 16 Jun 2024 15:55:51 +0200 Subject: [PATCH] split build from lint, try 3.10 as build arg --- .github/workflows/test-only.yml | 23 ++++++++++++++--------- Dockerfile | 5 ++++- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-only.yml b/.github/workflows/test-only.yml index 5483e6f6..e230175a 100644 --- a/.github/workflows/test-only.yml +++ b/.github/workflows/test-only.yml @@ -4,8 +4,21 @@ name: ChangeDetection.io App Test on: [push, pull_request] jobs: + lint-code: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Lint with flake8 + run: | + pip3 install flake8 + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + test-application: runs-on: ubuntu-latest + needs: lint-code steps: - uses: actions/checkout@v4 @@ -15,14 +28,6 @@ jobs: with: python-version: '3.11' - - name: Lint with flake8 - run: | - pip3 install flake8 - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Spin up ancillary testable services run: | @@ -38,7 +43,7 @@ jobs: - name: Build changedetection.io container for testing run: | # Build a changedetection.io container and start testing inside - docker build --build-arg LOGGER_LEVEL=TRACE -t test-changedetectionio . + docker build --build-arg PYTHON_VERSION=3.10 --build-arg LOGGER_LEVEL=TRACE -t test-changedetectionio . # Debug info docker run test-changedetectionio bash -c 'pip list' diff --git a/Dockerfile b/Dockerfile index e592c9bb..02aeeba9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,10 @@ # @NOTE! I would love to move to 3.11 but it breaks the async handler in changedetectionio/content_fetchers/puppeteer.py # If you know how to fix it, please do! and test it for both 3.10 and 3.11 -FROM python:3.10-slim-bookworm as builder + +ARG PYTHON_VERSION=3.10 + +FROM python:${PYTHON_VERSION}-slim-bookworm as builder # See `cryptography` pin comment in requirements.txt ARG CRYPTOGRAPHY_DONT_BUILD_RUST=1