From 69fb8c236f69afcd9a0165b809ad35147828ed41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donncha=20=C3=93=20Cearbhaill?= Date: Mon, 30 Sep 2024 12:39:21 +0200 Subject: [PATCH] Simplify the CI tests using the Makefile --- .github/workflows/black.yml | 16 ---------------- .github/workflows/mypy.yml | 27 +++++++++++++++++++++++++++ .github/workflows/ruff.yml | 18 +++++++++++------- .github/workflows/tests.yml | 29 +++++++++++++++++++++++++++++ dev/mvt-android | 14 -------------- dev/mvt-ios | 14 -------------- scripts/lint.sh | 14 -------------- 7 files changed, 67 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/black.yml create mode 100644 .github/workflows/mypy.yml create mode 100644 .github/workflows/tests.yml delete mode 100755 dev/mvt-android delete mode 100755 dev/mvt-ios delete mode 100755 scripts/lint.sh diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index 5b3c345..0000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Black - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - black: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: psf/black@stable - with: - options: "--check" diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 0000000..22ea66c --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,27 @@ +name: Mypy +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + mypy_py3: + name: Mypy check + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + cache: 'pip' + - name: Checkout + uses: actions/checkout@master + - name: Install Dependencies + run: | + pip install mypy + - name: mypy + run: | + make mypy diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 72c8fc4..7c8be9e 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -1,19 +1,23 @@ name: Ruff -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] +on: [push] + jobs: ruff_py3: name: Ruff syntax check runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + cache: 'pip' - name: Checkout uses: actions/checkout@master - name: Install Dependencies run: | - pip install --user ruff + pip install ruff - name: ruff run: | - ruff check --output-format github . + make ruff diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..920f896 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,29 @@ +name: Tests +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + name: Run Python Tests + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.8', '3.9', '3.10'] # , '3.11'] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install Python dependencies + run: | + make install + make test-requirements + - name: Test with pytest + run: | + make test-ci diff --git a/dev/mvt-android b/dev/mvt-android deleted file mode 100755 index 39ec7a7..0000000 --- a/dev/mvt-android +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 -# Mobile Verification Toolkit (MVT) -# Copyright (c) 2021-2022 Claudio Guarnieri. -# Use of this software is governed by the MVT License 1.1 that can be found at -# https://license.mvt.re/1.1/ - -import os -import sys - -sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - -from mvt import android - -android.cli() diff --git a/dev/mvt-ios b/dev/mvt-ios deleted file mode 100755 index 8a467d8..0000000 --- a/dev/mvt-ios +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 -# Mobile Verification Toolkit (MVT) -# Copyright (c) 2021-2022 Claudio Guarnieri. -# Use of this software is governed by the MVT License 1.1 that can be found at -# https://license.mvt.re/1.1/ - -import os -import sys - -sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - -from mvt import ios - -ios.cli() diff --git a/scripts/lint.sh b/scripts/lint.sh deleted file mode 100755 index 7e76739..0000000 --- a/scripts/lint.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -e - -export SOURCE="mvt tests" - -export PREFIX="" -if [ -d 'venv' ] ; then - export PREFIX="venv/bin/" -fi - -set -x - -${PREFIX}autoflake --in-place --recursive --exclude venv ${SOURCE} -${PREFIX}isort ${SOURCE} -${PREFIX}black --exclude venv ${SOURCE}