From 07cae6e8c7785e74622e14114a98b6289465d7ca Mon Sep 17 00:00:00 2001 From: Adrian Vladu <avladu@cloudbasesolutions.com> Date: Fri, 10 Nov 2023 14:53:51 +0200 Subject: [PATCH] github_actions: add windows and functional testing - add Linux unit testing for Python 3.8 and 3.11 (x64) - add Windows unit testing for Python 3.8 and 3.11 (x64 and x86) - add Windows functional testing for Python 3.11 (x64 and x86) Change-Id: If4ca5a10f62e320c598f0bac7e1ec2ec52862c21 --- .github/workflows/cloudbase_init_tests.yml | 94 ++++++++++++++++++++++ .github/workflows/unit_tests.yml | 28 ------- .stestr.conf | 2 +- 3 files changed, 95 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/cloudbase_init_tests.yml delete mode 100644 .github/workflows/unit_tests.yml diff --git a/.github/workflows/cloudbase_init_tests.yml b/.github/workflows/cloudbase_init_tests.yml new file mode 100644 index 00000000..7d59dbd4 --- /dev/null +++ b/.github/workflows/cloudbase_init_tests.yml @@ -0,0 +1,94 @@ +name: Cloudbase-Init tests + +env: + UPPER_CONSTRAINTS: "https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt" + TEST_RESOURCES: "https://github.com/cloudbase/cloudbase-init-test-resources" + +on: [push, pull_request] + +jobs: + linux-unit-tests: + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + python-version: [ "3.11"] + architecture: ["x64"] + + steps: + - name: Checkout cloudbase-init repository + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + - name: Install python3 tox + shell: bash + run: | + python3 -m pip install tox setuptools --upgrade + - name: Run Cloudbase-Init unit tests with tox + shell: bash + run: | + tox run-parallel -e py3,pep8,cover,docs + windows-unit-tests: + runs-on: windows-latest + strategy: + matrix: + python-version: [ "3.8", "3.11"] + architecture: ["x64", "x86"] + + steps: + - name: Checkout cloudbase-init repository + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + - name: Install python3 tox + shell: cmd + run: | + python3 -m pip install tox setuptools --upgrade + - name: Run Cloudbase-Init unit tests with tox + shell: cmd + run: | + tox run-parallel -e py3,pep8 + windows-functional-tests: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + python-version: [ "3.11"] + architecture: ["x64", "x86"] + cloud: ["empty"] + + steps: + - name: Checkout cloudbase-init repository + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + - name: Download external dependencies + shell: cmd + run: | + git clone %TEST_RESOURCES% test-resources + python -W ignore -m pip install --upgrade pip + - name: Install Cloudbase-Init + shell: cmd + run: | + python -W ignore -m pip install -c %UPPER_CONSTRAINTS% -U --force-reinstall -r requirements.txt + python -W ignore -m pip install . + - name: Run Cloudbase-Init functional tests + shell: powershell + run: | + try { + & cmd /c "cloudbase-init.exe --noreset_service_password --config-file ./test-resources/${{ matrix.cloud }}/cloudbase-init.conf 2>&1" | Tee-Object -FilePath cloudbase-init.log + } catch {} + $errors = $(cat ./cloudbase-init.log | Where-Object {$_ -like "*error*"}) + $pluginExecution = $(cat ./cloudbase-init.log | Where-Object {$_ -like "*Plugins execution done*"}) + if ($errors -or !$pluginExecution) { + exit 1 + } diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml deleted file mode 100644 index 37259171..00000000 --- a/.github/workflows/unit_tests.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Cloudbase-Init unit tests - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-22.04 - strategy: - matrix: - python-version: ["3.8","3.9","3.10", "3.11"] - architecture: ["x64"] - - steps: - - name: Checkout cloudbase-init repository - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - architecture: ${{ matrix.architecture }} - - name: Install python3 tox - shell: bash - run: | - python3 -m pip install tox - - name: Run Cloudbase-Init unit tests with tox - shell: bash - run: | - tox run-parallel -e py3,pep8,cover,docs -v diff --git a/.stestr.conf b/.stestr.conf index 343936fd..19e8bf19 100644 --- a/.stestr.conf +++ b/.stestr.conf @@ -1,3 +1,3 @@ [DEFAULT] -test_path=${OS_TEST_PATH:-./cloudbaseinit/tests} +test_path=./cloudbaseinit/tests top_dir=./