From af95e0f562761c1d010f52ea570164759f5bdbea Mon Sep 17 00:00:00 2001 From: francis Date: Mon, 4 Mar 2024 10:12:50 +0100 Subject: [PATCH 1/4] build: add default linting checks --- .github/workflows/backend-tests.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/backend-tests.yaml b/.github/workflows/backend-tests.yaml index cd8149f7..9144dd55 100644 --- a/.github/workflows/backend-tests.yaml +++ b/.github/workflows/backend-tests.yaml @@ -9,7 +9,7 @@ on: jobs: test: - runs-on: self-hosted + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python 3.11 @@ -19,6 +19,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + pip install flake8 pip install -r ./backend/requirements.txt - name: Execute tests run: python ./backend/manage.py test + - name: Execute linting checks + run: flake8 ./backend From 2315ef96519d988624fe9cbc47d14ffb5dfd0628 Mon Sep 17 00:00:00 2001 From: francis Date: Mon, 4 Mar 2024 10:16:46 +0100 Subject: [PATCH 2/4] build: seperate testing and linting workflow --- .github/workflows/backend-linting.yaml | 25 +++++++++++++++++++++++++ .github/workflows/backend-tests.yaml | 2 -- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/backend-linting.yaml diff --git a/.github/workflows/backend-linting.yaml b/.github/workflows/backend-linting.yaml new file mode 100644 index 00000000..cbd8e9f5 --- /dev/null +++ b/.github/workflows/backend-linting.yaml @@ -0,0 +1,25 @@ +name: backend-linting + +on: + push: + branches: [main, development] + pull_request: + branches: [main, development] + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 + pip install -r ./backend/requirements.txt + - name: Execute linting checks + run: flake8 ./backend diff --git a/.github/workflows/backend-tests.yaml b/.github/workflows/backend-tests.yaml index 9144dd55..85ba4f2e 100644 --- a/.github/workflows/backend-tests.yaml +++ b/.github/workflows/backend-tests.yaml @@ -23,5 +23,3 @@ jobs: pip install -r ./backend/requirements.txt - name: Execute tests run: python ./backend/manage.py test - - name: Execute linting checks - run: flake8 ./backend From 5656ce396c9fde00d002e63634b3d22e0e707269 Mon Sep 17 00:00:00 2001 From: francis Date: Mon, 4 Mar 2024 10:28:51 +0100 Subject: [PATCH 3/4] build: flake8 config --- .github/workflows/backend-linting.yaml | 2 +- backend/.flake8 | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 backend/.flake8 diff --git a/.github/workflows/backend-linting.yaml b/.github/workflows/backend-linting.yaml index cbd8e9f5..e3a7c8e5 100644 --- a/.github/workflows/backend-linting.yaml +++ b/.github/workflows/backend-linting.yaml @@ -22,4 +22,4 @@ jobs: pip install flake8 pip install -r ./backend/requirements.txt - name: Execute linting checks - run: flake8 ./backend + run: flake8 --config ./backend/.flake8 ./backend diff --git a/backend/.flake8 b/backend/.flake8 new file mode 100644 index 00000000..ee3e436d --- /dev/null +++ b/backend/.flake8 @@ -0,0 +1,15 @@ +[flake8] + +# Ignore unused imports +ignore = F401 + +max-line-length = 119 + +max-complexity = 10 + +exclude = .git, + __pycache__, + .venv, + venv, + migrations + From 6740434204d2c3510ee379e608b4001407d4b56d Mon Sep 17 00:00:00 2001 From: francis Date: Mon, 4 Mar 2024 22:11:39 +0100 Subject: [PATCH 4/4] fix: change github actions server to self-hosted --- .github/workflows/backend-linting.yaml | 2 +- .github/workflows/backend-tests.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backend-linting.yaml b/.github/workflows/backend-linting.yaml index e3a7c8e5..d145985d 100644 --- a/.github/workflows/backend-linting.yaml +++ b/.github/workflows/backend-linting.yaml @@ -9,7 +9,7 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - uses: actions/checkout@v4 - name: Set up Python 3.11 diff --git a/.github/workflows/backend-tests.yaml b/.github/workflows/backend-tests.yaml index 85ba4f2e..48768a80 100644 --- a/.github/workflows/backend-tests.yaml +++ b/.github/workflows/backend-tests.yaml @@ -9,7 +9,7 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - uses: actions/checkout@v4 - name: Set up Python 3.11