From a46024f12c5b8552dfb5089183125e352eeb912e Mon Sep 17 00:00:00 2001 From: Oanh Nguyen Date: Mon, 29 Aug 2022 18:29:11 +0700 Subject: [PATCH] Fix devcontainer and scripts --- .devcontainer/Dockerfile | 3 +++ .github/workflows/test.yml | 3 +++ scripts/install-deps.sh | 6 ++++-- scripts/lint.sh | 2 ++ scripts/test.sh | 4 ++++ 5 files changed, 16 insertions(+), 2 deletions(-) mode change 100644 => 100755 scripts/install-deps.sh mode change 100644 => 100755 scripts/lint.sh mode change 100644 => 100755 scripts/test.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index fd60955..1844d57 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -31,6 +31,9 @@ RUN mkdir -p ${WORKSPACE} \ USER ${USERNAME} WORKDIR ${WORKSPACE} +# RUN export PATH=/home/vscode/.local/bin:$$PATH +# RUN pip install black flake8 pytest + # [Optional] If your pip requirements rarely change, uncomment this section to add them to the image. # COPY requirements.txt /tmp/pip-tmp/ # RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 479a215..089d1ca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,4 +31,7 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | + # install local module + pip install . + # test with Pytest pytest \ No newline at end of file diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh old mode 100644 new mode 100755 index b6c579f..7a5743f --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -1,6 +1,8 @@ #!/bin/bash -python -m pip install --upgrade pip -pip install black build flake8 pytest +set -eux + +pip install black flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi diff --git a/scripts/lint.sh b/scripts/lint.sh old mode 100644 new mode 100755 index e559d2f..db835ed --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -eux + # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics diff --git a/scripts/test.sh b/scripts/test.sh old mode 100644 new mode 100755 index 1735967..17a4493 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,3 +1,7 @@ #!/bin/bash +set -eux + +pip install -e . + pytest