From 9aee46d82fd8ddd4c150be0a809cd2438f2a6c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Juli=C3=A1n=20Espina?= Date: Wed, 9 Oct 2024 13:52:00 -0600 Subject: [PATCH] fix: use pipx and virtual environments for CI actions --- .github/workflows/ci.yaml | 18 ++++++++++-------- .github/workflows/nightly-TICS.yaml | 16 ++++++++++++---- .github/workflows/release.yaml | 6 +++--- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7c75756..5109c08 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,7 +23,7 @@ on: jobs: inclusive-naming-check: name: Inclusive naming check - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -34,34 +34,34 @@ jobs: lint: name: Lint - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 - name: Install dependencies - run: python3 -m pip install tox + run: pipx install tox - name: Run linters run: tox run -e lint unit-test: name: Unit tests - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 - name: Install dependencies - run: python3 -m pip install tox + run: pipx install tox - name: Run tests run: tox run -e unit type-check: name: Static type checking - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 - name: Install dependencies - run: python3 -m pip install tox + run: pipx install tox - name: Run tests run: tox run -e type @@ -72,7 +72,7 @@ jobs: bases: - ubuntu@22.04 name: Integration tests (LXD) | ${{ matrix.bases }} - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 needs: - inclusive-naming-check - lint @@ -81,6 +81,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Install dependencies + run: pipx install tox - name: Setup operator environment uses: charmed-kubernetes/actions-operator@main with: diff --git a/.github/workflows/nightly-TICS.yaml b/.github/workflows/nightly-TICS.yaml index 1ae82ee..b675a76 100644 --- a/.github/workflows/nightly-TICS.yaml +++ b/.github/workflows/nightly-TICS.yaml @@ -10,15 +10,23 @@ permissions: jobs: TICS: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 - - name: Install dependencies + - name: Install requirements run: | - python3 -m pip install tox pylint flake8 - python3 -m pip install --requirement test-requirements.txt + sudo apt update -y + sudo apt install python3-venv -y + + - name: Create and activate virtual environment + run: | + python3 -m venv .venv + . .venv/bin/activate + pip install tox pylint flake8 pytest pyyaml + pip install --requirement test-requirements.txt + echo PATH=$PATH >> $GITHUB_ENV - name: Run coverage tests run: | diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5043bb1..66c5667 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -27,7 +27,7 @@ jobs: name: Release to CharmHub needs: - ci-tests - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 strategy: fail-fast: true matrix: @@ -38,8 +38,8 @@ jobs: - name: Select charmhub channel uses: canonical/charming-actions/channel@2.5.0-rc id: channel - - name: Install dependencies - run: python3 -m pip install tox + - name: Install tox + run: pipx install tox - name: Stage charm run: tox run -e stage -- ${{ matrix.charm }} --clean - name: Upload charm to charmhub