From f9d16497c9c09c2defa05ad9a887b190815e0232 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Thu, 26 Sep 2024 12:43:24 -0700 Subject: [PATCH 1/8] Add support for python builds --- .github/actions/test-python/action.yml | 25 +++++++++++++++++++++++++ .github/workflows/ci-check.yml | 13 +++++++++++++ .github/workflows/ci.yml | 5 +++++ 3 files changed, 43 insertions(+) create mode 100644 .github/actions/test-python/action.yml diff --git a/.github/actions/test-python/action.yml b/.github/actions/test-python/action.yml new file mode 100644 index 00000000..ddebbe78 --- /dev/null +++ b/.github/actions/test-python/action.yml @@ -0,0 +1,25 @@ +name: Python Unit Test +description: Python Unit Test report + + +inputs: + PYTHON_VERSION: + required: false + default: "3.10" + description: "Default Python version" + ENV_PATH: + description: 'The .env file for CI.' + required: false + ADDITIONAL_SETUP: + type: string + default: '[]' + description: 'JSON array of additional setup commands' + +runs: + using: "composite" + steps: + - name: Setup Ruby and install gems + uses: actions/setup-python@v5 + with: + bundler-cache: true + python-version: ${{ inputs.PYTHON_VERSION }} diff --git a/.github/workflows/ci-check.yml b/.github/workflows/ci-check.yml index eb15e93d..df2015c0 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 Ruby version TEST_DEPENDENCIES: required: false type: boolean @@ -209,6 +213,15 @@ 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_PATH: ${{ inputs.ENV_PATH }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Test configs if: inputs.LANGUAGE == 'configs' || inputs.LANGUAGE == 'configs' 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 }} From b22abaf337af03a399f98ed95be16ff5733aaf1e Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Thu, 26 Sep 2024 12:44:33 -0700 Subject: [PATCH 2/8] Update .github/actions/test-python/action.yml --- .github/actions/test-python/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/test-python/action.yml b/.github/actions/test-python/action.yml index ddebbe78..ee7f2521 100644 --- a/.github/actions/test-python/action.yml +++ b/.github/actions/test-python/action.yml @@ -18,7 +18,7 @@ inputs: runs: using: "composite" steps: - - name: Setup Ruby and install gems + - name: Setup Python uses: actions/setup-python@v5 with: bundler-cache: true From 2269a8201d201e0c31ddbbc9a2791889d8d0b147 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Thu, 26 Sep 2024 12:45:05 -0700 Subject: [PATCH 3/8] Add support for python builds --- .github/actions/test-python/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/test-python/action.yml b/.github/actions/test-python/action.yml index ee7f2521..b1b19811 100644 --- a/.github/actions/test-python/action.yml +++ b/.github/actions/test-python/action.yml @@ -21,5 +21,6 @@ runs: - name: Setup Python uses: actions/setup-python@v5 with: - bundler-cache: true python-version: ${{ inputs.PYTHON_VERSION }} + cache: 'pip' # caching pip dependencies + - run: pip install -r requirements.txt From cd5d369051419cd8e621bf90297a1d5c6f1221f2 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Thu, 26 Sep 2024 12:45:28 -0700 Subject: [PATCH 4/8] Add support for python builds --- .github/actions/test-python/action.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/actions/test-python/action.yml b/.github/actions/test-python/action.yml index b1b19811..8d76275b 100644 --- a/.github/actions/test-python/action.yml +++ b/.github/actions/test-python/action.yml @@ -1,19 +1,11 @@ name: Python Unit Test description: Python Unit Test report - inputs: PYTHON_VERSION: required: false default: "3.10" description: "Default Python version" - ENV_PATH: - description: 'The .env file for CI.' - required: false - ADDITIONAL_SETUP: - type: string - default: '[]' - description: 'JSON array of additional setup commands' runs: using: "composite" From 8f48144caba72732a3dc4819403b4f961477b49b Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Thu, 26 Sep 2024 12:45:48 -0700 Subject: [PATCH 5/8] Add support for python builds --- .github/workflows/ci-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-check.yml b/.github/workflows/ci-check.yml index df2015c0..41deeb88 100644 --- a/.github/workflows/ci-check.yml +++ b/.github/workflows/ci-check.yml @@ -28,7 +28,7 @@ on: PYTHON_VERSION: required: false type: string - description: Default Ruby version + description: Default Python version TEST_DEPENDENCIES: required: false type: boolean From 52b3793173d219a978e00958881d54417f8ad9f8 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Thu, 26 Sep 2024 12:46:00 -0700 Subject: [PATCH 6/8] Add support for python builds --- .github/actions/test-python/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/test-python/action.yml b/.github/actions/test-python/action.yml index 8d76275b..9d1a0df0 100644 --- a/.github/actions/test-python/action.yml +++ b/.github/actions/test-python/action.yml @@ -14,5 +14,5 @@ runs: uses: actions/setup-python@v5 with: python-version: ${{ inputs.PYTHON_VERSION }} - cache: 'pip' # caching pip dependencies + cache: 'pip' - run: pip install -r requirements.txt From a3e3405b1ac817ed109703addf90d8cfcc849c82 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Thu, 26 Sep 2024 12:46:27 -0700 Subject: [PATCH 7/8] Add support for python builds --- .github/workflows/ci-check.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci-check.yml b/.github/workflows/ci-check.yml index 41deeb88..14578dba 100644 --- a/.github/workflows/ci-check.yml +++ b/.github/workflows/ci-check.yml @@ -219,7 +219,6 @@ jobs: uses: ./actions/.github/actions/test-python with: PYTHON_VERSION: ${{ inputs.PYTHON_VERSION }} - ENV_PATH: ${{ inputs.ENV_PATH }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -237,4 +236,3 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} - From 7de5198392bf1acdea43e168e18b5811da423f4f Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Thu, 26 Sep 2024 20:11:36 -0700 Subject: [PATCH 8/8] install requirements --- .github/actions/test-python/action.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/actions/test-python/action.yml b/.github/actions/test-python/action.yml index 9d1a0df0..f6ad806e 100644 --- a/.github/actions/test-python/action.yml +++ b/.github/actions/test-python/action.yml @@ -15,4 +15,13 @@ runs: with: python-version: ${{ inputs.PYTHON_VERSION }} cache: 'pip' - - run: pip install -r requirements.txt + + - 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