diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 20dc0f3..41ad425 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,9 +10,9 @@ jobs: python: [3.8, 3.9, "3.10"] steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - name: Install Dependencies @@ -28,9 +28,9 @@ jobs: python: [3.5, 3.6, 3.7] steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - name: Install Dependencies @@ -41,19 +41,28 @@ jobs: functional-test: name: Functional test with LXD runs-on: ubuntu-latest + strategy: + matrix: + juju: ["3", "2.9"] timeout-minutes: 360 steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: 3.8 + - name: Constrain Tox Environment for juju 2.9 + if: ${{ matrix.juju == '2.9' }} + run: | + echo "TEST_CONSTRAINTS_FILE=constraints-juju29.txt" >> $GITHUB_ENV - name: Install Dependencies run: | pip install tox - name: Setup operator environment uses: charmed-kubernetes/actions-operator@main + with: + juju-channel: ${{ matrix.juju }}/stable - name: Run test run: tox -e func - name: Show Status @@ -65,4 +74,14 @@ jobs: if: ${{ always() }} run: | model=$(juju models --format yaml|grep "^- name:.*zaza"|cut -f2 -d/); - juju debug-log -m "$model" --replay --no-tail --level ERROR + mkdir tmp + juju debug-log -m "$model" --replay --no-tail --level ERROR | tee tmp/juju-debug-log.txt + juju status 2>&1 | tee tmp/juju-status.txt + juju-crashdump -s -m controller -a debug-layer -a config -o tmp/ + juju-crashdump -s -m $model -a debug-layer -a config -o tmp/ + - name: Upload debug artifacts + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: test-run-artifacts-juju-${{ matrix.juju }} + path: tmp diff --git a/.gitignore b/.gitignore index 56e95aa..95a5086 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .ropeproject .settings .tox +*.charm \ No newline at end of file diff --git a/constraints-juju29.txt b/constraints-juju29.txt new file mode 100644 index 0000000..8555898 --- /dev/null +++ b/constraints-juju29.txt @@ -0,0 +1 @@ +juju < 3.0 \ No newline at end of file diff --git a/constraints-juju3.txt b/constraints-juju3.txt new file mode 100644 index 0000000..ddd7961 --- /dev/null +++ b/constraints-juju3.txt @@ -0,0 +1 @@ +juju>3.0.0,<4.0.0 \ No newline at end of file diff --git a/tests/bundles/minimal.yaml b/tests/bundles/minimal.yaml index 4d6dd2b..4c9d941 100644 --- a/tests/bundles/minimal.yaml +++ b/tests/bundles/minimal.yaml @@ -15,11 +15,11 @@ applications: #num_units: 1 minimal-focal: series: focal - charm: /tmp/charm-builds/minimal + charm: ../../minimal.charm num_units: 1 minimal-binary-wheels-focal: series: focal - charm: /tmp/charm-builds/minimal-binary-wheels + charm: ../../minimal-binary-wheels.charm num_units: 1 #minimal-no-venv-trusty: #series: trusty @@ -35,5 +35,5 @@ applications: #num_units: 1 minimal-no-venv-focal: series: focal - charm: /tmp/charm-builds/minimal-no-venv + charm: ../../minimal-no-venv.charm num_units: 1 diff --git a/tox.ini b/tox.ini index b4057ae..fabb2f4 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,9 @@ commands = flake8 reactive lib tests unit_tests [testenv:func] basepython = python3 -deps = -r{toxinidir}/test-requirements.txt +deps = + -c {env:TEST_CONSTRAINTS_FILE:constraints-juju3.txt} + -r{toxinidir}/test-requirements.txt allowlist_externals = /bin/bash /bin/ln @@ -34,9 +36,9 @@ commands = /bin/mkdir -p /tmp/charm-builds/_tmp/layers /bin/bash -c '/bin/ln -sf $(readlink --canonicalize {toxinidir}) /tmp/charm-builds/_tmp/layers/layer-basic' /bin/bash -c '/bin/ln -sf $(readlink --canonicalize {toxinidir}/tests/charm-minimal) /tmp/charm-builds/_tmp/layers/charm-minimal' - charm-build --log-level DEBUG tests/charm-minimal - charm-build --log-level DEBUG --binary-wheels -n minimal-binary-wheels tests/charm-minimal - charm-build --log-level DEBUG tests/charm-minimal-no-venv + charm-build -F --log-level DEBUG tests/charm-minimal + charm-build -F --log-level DEBUG --binary-wheels -n minimal-binary-wheels tests/charm-minimal + charm-build -F --log-level DEBUG tests/charm-minimal-no-venv functest-run-suite --keep-model diff --git a/wheelhouse.txt b/wheelhouse.txt index 20a694f..ed3f9cf 100644 --- a/wheelhouse.txt +++ b/wheelhouse.txt @@ -32,10 +32,13 @@ setuptools-scm<=1.17.0;python_version < '3.8' setuptools-scm<7;python_version >= '3.8' flit_core<4.0.0;python_version >= '3.8' flit_scm<=1.7.0;python_version >= '3.8' -anyio<3.7.0;python_version >= '3.8' charmhelpers>=0.4.0,<2.0.0 charms.reactive>=0.1.0,<2.0.0 wheel<0.34;python_version < '3.8' wheel<1.0;python_version >= '3.8' # pin netaddr to avoid pulling importlib-resources netaddr<=0.7.19 + +# https://github.com/python-trio/sniffio/pull/49 +anyio<3.7.0;python_version >= '3.8' +sniffio<1.3.1 # 1.3.1 requires setuptools>=64 \ No newline at end of file