Fix Lint errors and Warnings (#119) #490
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Suite | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: [3.8] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install dependencies | |
run: python3 -m pip install tox | |
- name: Run linters | |
run: tox -vve lint | |
- name: Static analysis | |
run: tox -vve static-bundle | |
integration-test-microk8s: | |
name: Integration tests (microk8s) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get prefsrc | |
run: | | |
echo "IPADDR=$(ip -4 -j route get 2.2.2.2 | jq -r '.[] | .prefsrc')" >> $GITHUB_ENV | |
- name: Setup operator environment | |
uses: charmed-kubernetes/actions-operator@main | |
with: | |
juju-channel: 3.1/stable | |
provider: microk8s | |
channel: 1.25-strict/stable | |
microk8s-addons: "hostpath-storage dns metallb:${{ env.IPADDR }}-${{ env.IPADDR }}" | |
- name: Update python-libjuju dependency to match juju version | |
# Assuming the dep is given on a separate tox.ini line | |
run: sed -E -i 's/^\s*juju\s*~=.+/ juju~=3.1.0/g' tox.ini | |
- name: Render bundle | |
run: tox -e render-edge | |
- name: Run tests (edge channel) | |
run: tox -e integration | |
- name: Dump logs | |
if: failure() | |
uses: canonical/charming-actions/dump-logs@main | |
end-to-end-tests: | |
# Must use Juju 3 to bootstrap both uk8s and lxd:https://bugs.launchpad.net/juju/+bug/2003582 | |
name: End-to-end tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 120 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get prefsrc | |
run: | | |
echo "IPADDR=$(ip -4 -j route get 2.2.2.2 | jq -r '.[] | .prefsrc')" >> $GITHUB_ENV | |
- name: Setup lxd controller | |
uses: charmed-kubernetes/actions-operator@main | |
with: | |
juju-channel: 3.1/stable | |
provider: lxd | |
- name: Save lxd controller name | |
id: lxd-controller | |
# The `CONTROLLER_NAME` envvar is set by the actions-operator action | |
run: echo "name=$CONTROLLER_NAME" >> $GITHUB_OUTPUT | |
- name: Setup k8s controller | |
uses: charmed-kubernetes/actions-operator@main | |
with: | |
juju-channel: 3.1/stable | |
provider: microk8s | |
channel: 1.25-strict/stable | |
microk8s-addons: "hostpath-storage dns metallb:${{ env.IPADDR }}-${{ env.IPADDR }}" | |
- name: Save k8s controller name | |
id: k8s-controller | |
# The `CONTROLLER_NAME` envvar is set by the actions-operator action | |
run: echo "name=$CONTROLLER_NAME" >> $GITHUB_OUTPUT | |
- name: Fix microk8s permissions | |
run: | | |
chmod -R ugo+rwX ~/.kube | |
- name: Update python-libjuju dependency to match juju | |
run: sed -E -i 's/^\s*juju\s*~=.+/ juju~=3.1.0/g' tox.ini | |
- name: Render bundle | |
run: tox -e render-edge | |
- name: Run end-to-end tests | |
run: tox run -vve e2e | |
env: | |
K8S_CONTROLLER: ${{ steps.k8s-controller.outputs.name }} | |
LXD_CONTROLLER: ${{ steps.lxd-controller.outputs.name }} | |
- name: Dump logs | |
if: failure() | |
uses: canonical/charming-actions/dump-logs@main |