diff --git a/.github/actions/test-python/action.yml b/.github/actions/test-python/action.yml new file mode 100644 index 00000000..f6ad806e --- /dev/null +++ b/.github/actions/test-python/action.yml @@ -0,0 +1,27 @@ +name: Python Unit Test +description: Python Unit Test report + +inputs: + PYTHON_VERSION: + required: false + default: "3.10" + description: "Default Python version" + +runs: + using: "composite" + steps: + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.PYTHON_VERSION }} + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi + + # - name: Test with pytest + # run: | + # pytest diff --git a/.github/workflows/ci-check.yml b/.github/workflows/ci-check.yml index eb15e93d..14578dba 100644 --- a/.github/workflows/ci-check.yml +++ b/.github/workflows/ci-check.yml @@ -25,6 +25,10 @@ on: required: false type: string description: Default Ruby version + PYTHON_VERSION: + required: false + type: string + description: Default Python version TEST_DEPENDENCIES: required: false type: boolean @@ -209,6 +213,14 @@ jobs: RUBOCOP: ${{ inputs.RUBOCOP }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Test Python + if: ${{ inputs.LANGUAGE == 'Python' }} + uses: ./actions/.github/actions/test-python + with: + PYTHON_VERSION: ${{ inputs.PYTHON_VERSION }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Test configs if: inputs.LANGUAGE == 'configs' || inputs.LANGUAGE == 'configs' @@ -224,4 +236,3 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4ff3e30..65d282e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,10 @@ on: required: false type: string default: "3.0.6" + PYTHON_VERSION: + required: false + type: string + default: "3.10" PUSH: required: false type: boolean @@ -225,6 +229,7 @@ jobs: NODE_VERSION: ${{ inputs.NODE_VERSION }} RUBY_VERSION: ${{ inputs.RUBY_VERSION }} DOTNET_VERSION: ${{ inputs.DOTNET_VERSION }} + PYTHON_VERSION: ${{ inputs.PYTHON_VERSION }} TEST_DEPENDENCIES: ${{ inputs.TEST_DEPENDENCIES }} TEST_DEPENDENCIES_PRIVATE: ${{ inputs.TEST_DEPENDENCIES_PRIVATE }} DEPENDENCIES_FILE: ${{ inputs.DEPENDENCIES_FILE }}