From 2679d84f3867f8f9a0054ab280978f89dcd8fc6a Mon Sep 17 00:00:00 2001 From: James Garner Date: Thu, 10 Oct 2024 10:55:18 +1300 Subject: [PATCH] ci: run setup-python before actions-operator to fix tox install Github's rollout of 24.04 for ubuntu-latest has now reached python-libjuju, so `pip install tox` no longer works -- 24.04 prevents installing packages using pip. This causes an error with in 'Setup operator environment' using charmed-kubernetes/actions-operator@main. The fix is to run our 'Setup Python' step using actions/setup-python before actions-operator instead of after. Since this takes care of installing tox, we can remove pip install tox for the jobs using these steps. Also bump setup-python to v5 for integration-quarantine, matching the recent PR bumping the version for other jobs. --- .github/workflows/test.yaml | 20 ++++++++------------ tox.ini | 1 + 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index cf0871c20..b966d5c43 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -79,6 +79,10 @@ jobs: steps: - name: Check out code uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} - name: Setup operator environment uses: charmed-kubernetes/actions-operator@main with: @@ -112,12 +116,6 @@ jobs: # # set model defaults # juju model-defaults apt-http-proxy=$PROXY apt-https-proxy=$PROXY juju-http-proxy=$PROXY juju-https-proxy=$PROXY snap-http-proxy=$PROXY snap-https-proxy=$PROXY # juju model-defaults - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - - name: Install dependencies - run: pip install tox - name: Run integration # Force one single concurrent test run: tox -e integration @@ -134,16 +132,14 @@ jobs: steps: - name: Check out code uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} - name: Setup operator environment uses: charmed-kubernetes/actions-operator@main with: provider: lxd juju-channel: 3.4/stable - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - name: Install dependencies - run: pip install tox - name: Run integration run: tox -e integration-quarantine diff --git a/tox.ini b/tox.ini index 3f76f4924..c9e1079ab 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,7 @@ # Tox (http://tox.testrun.org/) is a tool for running tests # in multiple virtualenvs. This configuration file will run the # test suite on all supported python versions. To use it, "pip install tox" +# (pre ubuntu 24.04 -- otherwise consider using pipx or apt instead of pip) # and then run "tox" from this directory. [tox]