From 3d192ce5a35570422004e171ed036b9e1aec379e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A4ghib=20Hasan?= Date: Sat, 4 May 2024 23:36:00 +0300 Subject: [PATCH] update github workflow to run python unit test --- .github/workflows/main.yml | 27 +++++++++++++++++++++++++++ requirements.txt | 0 2 files changed, 27 insertions(+) create mode 100644 requirements.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 89884ed..0fd7a80 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,8 +13,35 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Check for ts files + id: file-type + run: | + is_typescript=$(find . -name '*.ts' -print -quit) + + if [ -n "$is_typescript"]; then + echo "Is Typescript" + echo "::set-output name=is_typescript::true" + else + echo "Is not Typescript" + echo "::set-output name=is_typescript::false" + end + + - name: Install dependencies + if: steps.file-type.outputs.is_typescript == 'true' run: npm install - name: Run Jest tests + if: steps.file-type.outputs.is_typescript == 'true' run: npm test -- --coverage --ci + + - name: Set up Python + if: steps.file-type.outputs.is_typescript == 'false' + uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' + + - name: Run Python tests + if: steps.file-type.outputs.is_typescript == 'false' + run: python -m unittest discover -p '*_test.py' diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29