From 0af38bf2a79965c9512eaf442a931b28495acca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Mon, 4 Oct 2021 18:29:18 +0200 Subject: [PATCH] build: run github actions on pull requests (#27786) --- .github/workflows/ci-static-analysis.yml | 43 +++++++++++++++++++ .../content/learning_sequences/views.py | 4 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci-static-analysis.yml diff --git a/.github/workflows/ci-static-analysis.yml b/.github/workflows/ci-static-analysis.yml new file mode 100644 index 0000000000..31db6c29ac --- /dev/null +++ b/.github/workflows/ci-static-analysis.yml @@ -0,0 +1,43 @@ +name: CI + +on: pull_request + +jobs: + tests: + name: Static analysis + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: ['3.8'] + os: ['ubuntu-20.04'] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install system requirements + run: sudo apt update && sudo apt install -y libxmlsec1-dev + + - name: Install pip + run: python -m pip install -r requirements/pip.txt + + - name: Get pip cache dir + id: pip-cache-dir + run: echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache pip dependencies + id: cache-dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache-dir.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements/edx/development.txt') }} + restore-keys: ${{ runner.os }}-pip- + + - name: Install python dependencies + run: pip install -r requirements/edx/development.txt + + - name: Static code analysis + run: make check-types diff --git a/openedx/core/djangoapps/content/learning_sequences/views.py b/openedx/core/djangoapps/content/learning_sequences/views.py index 26d3ec4955..f3b3faaec6 100644 --- a/openedx/core/djangoapps/content/learning_sequences/views.py +++ b/openedx/core/djangoapps/content/learning_sequences/views.py @@ -16,7 +16,9 @@ from rest_framework.exceptions import NotFound, PermissionDenied from rest_framework.response import Response from rest_framework.views import APIView +from openedx.core import types from openedx.core.lib.api.view_utils import validate_course_key + from .api import get_user_course_outline_details from .api.permissions import can_call_public_api, can_see_content_as_other_users from .data import CourseOutlineData @@ -185,7 +187,7 @@ class CourseOutlineView(APIView): serializer = self.UserCourseOutlineDataSerializer(user_course_outline_details) return Response(serializer.data) - def _determine_user(self, request, course_key: CourseKey) -> User: + def _determine_user(self, request, course_key: CourseKey) -> types.User: """ For which user should we get an outline?