Repository: pywbem/pywbemtools (language: python)

Issue:
Modify github actions test to use ubuntu-20.04 for Python 3.5,3.6 tests
For details, see the commit message.
This splits off the ubuntu-20.04 fixes from Karl's PR #1246 
github CI tests fail, Python version 3.6 not found
Issue with ubuntu version.  Python version 3.6 not available with Ubuntu 22.04 and github just moved  to use this version of Ubuntu
.
```
Run actions/setup-python@v2
Version 3.6 was not found in the local cache
Error: Version 3.6 with arch x64 not found
The list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
```

There are several other issues around this problem including:

* https://github.com/actions/setup-python/issues/543 - Recommends dropping back to ubuntu:20.04.
* https://github.com/actions/setup-python/issues/355
* https://github.com/actions/setup-python/issues/480

The yaml file https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json

defines the platforms supported for various vesions of python by the action setup pyton and Ubuntu 22.04 is not defined for any of the python 3.6 entries.

Solution for now is to move back to Ubuntu 20.04 for  tests.  However in the long term, we have to move ahead with ubuntu and threfore must rewrite the test.yaml to define the 20.04 and ubuntu:latest for different python versions.


Discussion / hints:

Fix patch:
diff --git a/docs/changes.rst b/docs/changes.rst
index daae0812..933e3b20 100644
--- a/docs/changes.rst
+++ b/docs/changes.rst
@@ -20,6 +20,10 @@ Released: not yet
 
 **Cleanup:**
 
+* Use Ubuntu 20.04 for os target for some github CI tests because python setup
+  action does not include Python 3.5 and 3.6 for ubuntu 22.04 (i.e ubuntu-latest as
+  of Nov 2022) which causes scheduled test failure.  See issue #1245
+
 **Known issues:**
 
 * See `list of open issues`_.


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 4c4e0515..176e1c16 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -33,20 +33,77 @@ jobs:
       id: select_matrix
       # Select full matrix when scheduled or when releasing, and normal matrix
       # otherwise. The matrix is defined as a JSON string.
+      # This This technique documented in:
+      #    https://stackoverflow.com/questions/65384420/how-to-make-a-github-action-matrix-element-conditional
       # TODO: Find a way to define this with less escapes.
+      # NOTE: ubuntu-20.04 is used for Python 3.5+3.6 because ubuntu-latest no longer supports them. See issue #1245.
       run: |
         if [[ "${{ github.event_name }}" == "schedule" || "${{ github.head_ref }}" =~ ^release_ ]]; then \
           echo "::set-output name=matrix::{ \
             \"os\": [ \"ubuntu-latest\", \"macos-latest\", \"windows-latest\" ], \
             \"python-version\": [ \"2.7\", \"3.5\", \"3.6\", \"3.7\", \"3.8\", \"3.9\", \"3.10\" ], \
             \"package_level\": [ \"minimum\", \"latest\" ], \
+            \"exclude\": [ \
+              { \
+                \"os\": \"ubuntu-latest\", \
+                \"python-version\": \"3.5\", \
+                \"package_level\": \"minimum\" \
+              }, \
+              { \
+                \"os\": \"ubuntu-latest\", \
+                \"python-version\": \"3.5\", \
+                \"package_level\": \"latest\" \
+              }, \
+              { \
+                \"os\": \"ubuntu-latest\", \
+                \"python-version\": \"3.6\", \
+                \"package_level\": \"minimum\" \
+              }, \
+              { \
+                \"os\": \"ubuntu-latest\", \
+                \"python-version\": \"3.6\", \
+                \"package_level\": \"latest\" \
+              } \
+            ], \
+            \"include\": [ \
+              { \
+                \"os\": \"ubuntu-20.04\", \
+                \"python-version\": \"3.5\", \
+                \"package_level\": \"minimum\" \
+              }, \
+              { \
+                \"os\": \"ubuntu-20.04\", \
+                \"python-version\": \"3.5\", \
+                \"package_level\": \"latest\" \
+              }, \
+              { \
+                \"os\": \"ubuntu-20.04\", \
+                \"python-version\": \"3.6\", \
+                \"package_level\": \"minimum\" \
+              }, \
+              { \
+                \"os\": \"ubuntu-20.04\", \
+                \"python-version\": \"3.6\", \
+                \"package_level\": \"latest\" \
+              } \
+            ] \
           }"; \
         else \
           echo "::set-output name=matrix::{ \
             \"os\": [ \"ubuntu-latest\" ], \
-            \"python-version\": [ \"2.7\", \"3.5\", \"3.10\" ], \
+            \"python-version\": [ \"2.7\", \"3.10\" ], \
             \"package_level\": [ \"minimum\", \"latest\" ], \
             \"include\": [ \
+              { \
+                \"os\": \"ubuntu-20.04\", \
+                \"python-version\": \"3.5\", \
+                \"package_level\": \"latest\" \
+              }, \
+              { \
+                \"os\": \"ubuntu-20.04\", \
+                \"python-version\": \"3.5\", \
+                \"package_level\": \"minimum\" \
+              }, \
               { \
                 \"os\": \"macos-latest\", \
                 \"python-version\": \"2.7\", \
@@ -97,11 +154,11 @@ jobs:
     runs-on: ${{ matrix.os }}
     steps:
     - name: Create local cache directory for Docker images
-      if: ${{ matrix.os == 'ubuntu-latest' }}
+      if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-20.04' }}
       run: |
         mkdir -p ${{ env.DOCKER_CACHE_DIR }}
     - name: Set up caching for local Docker image cache directory
-      if: ${{ matrix.os == 'ubuntu-latest' }}
+      if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-20.04' }}
       uses: actions/cache@v1
       with:
         path: ${{ env.DOCKER_CACHE_DIR }}
@@ -109,7 +166,7 @@ jobs:
         restore-keys: |
           docker-cache-
     - name: Get WBEM server image from Docker Hub or local Docker image cache
-      if: ${{ matrix.os == 'ubuntu-latest' }}
+      if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-20.04' }}
       run: |
         if [[ ! -f ${{ env.DOCKER_CACHE_DIR }}/${{ env.TEST_SERVER_IMAGE_TAR }} ]]; then \
           echo "Pulling image from Docker Hub"; \
@@ -186,7 +243,7 @@ jobs:
       run: |
         make test
     - name: Run end2end test with WBEM server Docker image
-      if: ${{ matrix.os == 'ubuntu-latest' }}
+      if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-20.04' }}
       env:
         PACKAGE_LEVEL: ${{ matrix.package_level }}
         # Uses TEST_SERVER_IMAGE variable