|
| 1 | +name: Cloudbase-Init tests |
| 2 | + |
| 3 | +env: |
| 4 | + UPPER_CONSTRAINTS: "https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt" |
| 5 | + TEST_RESOURCES: "https://github.com/cloudbase/cloudbase-init-test-resources" |
| 6 | + |
| 7 | +on: [push, pull_request] |
| 8 | + |
| 9 | +jobs: |
| 10 | + linux-unit-tests: |
| 11 | + runs-on: ubuntu-22.04 |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + python-version: [ "3.11"] |
| 16 | + architecture: ["x64"] |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout cloudbase-init repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + - name: Set up Python ${{ matrix.python-version }} |
| 22 | + uses: actions/setup-python@v4 |
| 23 | + with: |
| 24 | + python-version: ${{ matrix.python-version }} |
| 25 | + architecture: ${{ matrix.architecture }} |
| 26 | + - name: Install python3 tox |
| 27 | + shell: bash |
| 28 | + run: | |
| 29 | + python3 -m pip install tox setuptools --upgrade |
| 30 | + - name: Run Cloudbase-Init unit tests with tox |
| 31 | + shell: bash |
| 32 | + run: | |
| 33 | + tox run-parallel -e py3,pep8,cover,docs |
| 34 | + windows-unit-tests: |
| 35 | + runs-on: windows-latest |
| 36 | + strategy: |
| 37 | + matrix: |
| 38 | + python-version: [ "3.8", "3.11"] |
| 39 | + architecture: ["x64", "x86"] |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout cloudbase-init repository |
| 43 | + uses: actions/checkout@v4 |
| 44 | + - name: Set up Python ${{ matrix.python-version }} |
| 45 | + uses: actions/setup-python@v4 |
| 46 | + with: |
| 47 | + python-version: ${{ matrix.python-version }} |
| 48 | + architecture: ${{ matrix.architecture }} |
| 49 | + - name: Install python3 tox |
| 50 | + shell: cmd |
| 51 | + run: | |
| 52 | + python3 -m pip install tox setuptools --upgrade |
| 53 | + - name: Run Cloudbase-Init unit tests with tox |
| 54 | + shell: cmd |
| 55 | + run: | |
| 56 | + tox run-parallel -e py3,pep8 |
| 57 | + windows-functional-tests: |
| 58 | + runs-on: windows-latest |
| 59 | + strategy: |
| 60 | + fail-fast: false |
| 61 | + matrix: |
| 62 | + python-version: [ "3.11"] |
| 63 | + architecture: ["x64", "x86"] |
| 64 | + cloud: ["empty"] |
| 65 | + |
| 66 | + steps: |
| 67 | + - name: Checkout cloudbase-init repository |
| 68 | + uses: actions/checkout@v4 |
| 69 | + - name: Set up Python ${{ matrix.python-version }} |
| 70 | + uses: actions/setup-python@v4 |
| 71 | + with: |
| 72 | + python-version: ${{ matrix.python-version }} |
| 73 | + architecture: ${{ matrix.architecture }} |
| 74 | + - name: Download external dependencies |
| 75 | + shell: cmd |
| 76 | + run: | |
| 77 | + git clone %TEST_RESOURCES% test-resources |
| 78 | + python -W ignore -m pip install --upgrade pip |
| 79 | + - name: Install Cloudbase-Init |
| 80 | + shell: cmd |
| 81 | + run: | |
| 82 | + python -W ignore -m pip install -c %UPPER_CONSTRAINTS% -U --force-reinstall -r requirements.txt |
| 83 | + python -W ignore -m pip install . |
| 84 | + - name: Run Cloudbase-Init functional tests |
| 85 | + shell: powershell |
| 86 | + run: | |
| 87 | + try { |
| 88 | + & 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 |
| 89 | + } catch {} |
| 90 | + $errors = $(cat ./cloudbase-init.log | Where-Object {$_ -like "*error*"}) |
| 91 | + $pluginExecution = $(cat ./cloudbase-init.log | Where-Object {$_ -like "*Plugins execution done*"}) |
| 92 | + if ($errors -or !$pluginExecution) { |
| 93 | + exit 1 |
| 94 | + } |
0 commit comments