diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..0def4b64 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: Backend test CI + +on: + - pull_request + +jobs: + flake8: + runs-on: self-hosted + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install dependencies + working-directory: ./backend + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Running Django tests + working-directory: ./ + run: | + sh run backend/runtests.sh \ No newline at end of file diff --git a/Makefile b/Makefile index 01c1abef..2d57da69 100644 --- a/Makefile +++ b/Makefile @@ -6,4 +6,7 @@ stop: lint: docker exec pigeonhole-backend flake8 . - docker exec pigeonhole-frontend npm run lint \ No newline at end of file + docker exec pigeonhole-frontend npm run lint + +backendtest: + docker exec -it pigeonhole-backend sh /usr/src/app/backend/runtests.sh \ No newline at end of file diff --git a/backend/runtests.sh b/backend/runtests.sh new file mode 100644 index 00000000..65d41fa8 --- /dev/null +++ b/backend/runtests.sh @@ -0,0 +1 @@ +coverage run manage.py test backend/pigeonhole/tests/test_views \ No newline at end of file