From 1d8a5c505a74d06d1941758a32c4ca56934b404e Mon Sep 17 00:00:00 2001 From: Lennart Date: Tue, 5 Mar 2024 13:19:15 +0100 Subject: [PATCH] setup github action for linter and unit tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jochum Börger Co-authored-by: Lennart Tange --- .github/workflows/python-check.yml | 52 ++++++++++++++++++++++++++++++ README.md | 2 +- tests/__init__.py | 1 - 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/python-check.yml diff --git a/.github/workflows/python-check.yml b/.github/workflows/python-check.yml new file mode 100644 index 0000000..9014cf4 --- /dev/null +++ b/.github/workflows/python-check.yml @@ -0,0 +1,52 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python check + +on: + push: + branches: [ "main", "ci/*" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.12.1 + + - name: Install Poetry + uses: abatilo/actions-poetry@v2 + with: + poetry-version: 1.8.2 + - name: View poetry --help + run: poetry --help + + # - name: Install poetry + # run: | + # sudo apt update && sudo apt install pipx && pipx ensurepath && pipx install poetry==1.8.2 + + - name: Cache the virtualenv + uses: actions/cache@v3 + with: + path: ./.venv + key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} + + - name: Install dependencies + run: | + poetry install + + - name: Lint + run: | + poetry run pylint playground tests + + - name: Tests + run: | + poetry run pytest tests diff --git a/README.md b/README.md index 9264379..0211869 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ This playground contains a basic set-up to interact with the data using [Jupyter # How to play ## Prerequisites -- [Python >= 3.11](https://www.python.org/downloads/) +- [Python >= 3.12](https://www.python.org/downloads/) - [Poetry](https://python-poetry.org/docs/#installation) - Access to a DevLake database - A place to run a Jupyter Notebook (e.g. [VS Code](https://code.visualstudio.com/)) diff --git a/tests/__init__.py b/tests/__init__.py index d16c64f..65d64ce 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -12,4 +12,3 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -