Skip to content

Commit 2679d84

Browse files
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.
1 parent 1f5d361 commit 2679d84

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

.github/workflows/test.yaml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ jobs:
7979
steps:
8080
- name: Check out code
8181
uses: actions/checkout@v4
82+
- name: Setup Python
83+
uses: actions/setup-python@v5
84+
with:
85+
python-version: ${{ matrix.python }}
8286
- name: Setup operator environment
8387
uses: charmed-kubernetes/actions-operator@main
8488
with:
@@ -112,12 +116,6 @@ jobs:
112116
# # set model defaults
113117
# 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
114118
# juju model-defaults
115-
- name: Setup Python
116-
uses: actions/setup-python@v5
117-
with:
118-
python-version: ${{ matrix.python }}
119-
- name: Install dependencies
120-
run: pip install tox
121119
- name: Run integration
122120
# Force one single concurrent test
123121
run: tox -e integration
@@ -134,16 +132,14 @@ jobs:
134132
steps:
135133
- name: Check out code
136134
uses: actions/checkout@v3
135+
- name: Setup Python
136+
uses: actions/setup-python@v4
137+
with:
138+
python-version: ${{ matrix.python }}
137139
- name: Setup operator environment
138140
uses: charmed-kubernetes/actions-operator@main
139141
with:
140142
provider: lxd
141143
juju-channel: 3.4/stable
142-
- name: Setup Python
143-
uses: actions/setup-python@v4
144-
with:
145-
python-version: ${{ matrix.python }}
146-
- name: Install dependencies
147-
run: pip install tox
148144
- name: Run integration
149145
run: tox -e integration-quarantine

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Tox (http://tox.testrun.org/) is a tool for running tests
22
# in multiple virtualenvs. This configuration file will run the
33
# test suite on all supported python versions. To use it, "pip install tox"
4+
# (pre ubuntu 24.04 -- otherwise consider using pipx or apt instead of pip)
45
# and then run "tox" from this directory.
56

67
[tox]

0 commit comments

Comments
 (0)