From 74df7a7d4687e112ea149d0c7613ce27524722f2 Mon Sep 17 00:00:00 2001 From: Adrian Coveney Date: Fri, 10 May 2024 13:32:50 +0100 Subject: [PATCH 1/2] Improvements to GH Action unit tests - Specify Python versions we're interested in. - Add Python version to run name. - Add caching. - Simplify codecov-action version to major tag. - Space out sections. - Add comments. --- .github/workflows/unit-test.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 2c9cdc98..63c500e5 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -4,31 +4,40 @@ on: [push, pull_request] jobs: unit-test: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 # 20.04 to allow for Py 3.6 strategy: fail-fast: false matrix: - python-version: ['3.x'] + # Python versions on Rocky 8, Ubuntu 20.04, Rocky 9 + python-version: ['3.6', '3.8', '3.9'] name: Python ${{ matrix.python-version }} test steps: - uses: actions/checkout@v4 - - name: Set up Python + + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + cache: 'pip' + - name: Set up dependencies for python-ldap run: sudo apt-get install libsasl2-dev libldap2-dev libssl-dev + - name: Base requirements for SSM run: pip install -r requirements.txt + - name: Additional requirements for the unit and coverage tests run: pip install -r requirements-test.txt + - name: Pre-test set up run: | export TMPDIR=$PWD/tmp mkdir $TMPDIR export PYTHONPATH=$PYTHONPATH:`pwd -P` cd test + - name: Run unit tests run: coverage run --branch --source=ssm,bin -m unittest discover --buffer + - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4.3.1 + uses: codecov/codecov-action@v4 From de304cd8def3607364626a8d0c31a9d27113f200 Mon Sep 17 00:00:00 2001 From: Adrian Coveney Date: Fri, 10 May 2024 13:34:44 +0100 Subject: [PATCH 2/2] Remove redundant Python 3 test from Travis Redundant as we have working Python 3 tests in GitHub Actions. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 70e2d56c..40af6510 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ os: linux language: python python: - "2.7" - - "3.8" # Cache the dependencies installed by pip cache: pip