Skip to content

[JUJU-4779] Ensure valid charm origin for local charm switches #599

[JUJU-4779] Ensure valid charm origin for local charm switches

[JUJU-4779] Ensure valid charm origin for local charm switches #599

Workflow file for this run

name: Testing
on: [push, pull_request]
jobs:
lint:
name: Linter
runs-on: ubuntu-latest
strategy:
matrix:
python:
- "3.9"
- "3.10"
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run linter
run: |
tox -e lint
./scripts/copyright.sh
unit-tests:
needs: lint
name: Unit tests
runs-on: ubuntu-latest
strategy:
matrix:
python:
- "3.9"
- "3.10"
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run unit tests
run: tox -e py3
integration:
name: Integration
needs: [lint, unit-tests]
timeout-minutes: 150
runs-on: ubuntu-latest
strategy:
matrix:
python:
# We will reduce the workload to 3.10 to
# save some resources for now.
# - "3.9"
- "3.10"
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: lxd
juju-channel: 3.2/stable
# 2023-01-11 Commented until we discover a
# clear approach for this.
# - name: Set proxy in controller
# run: |
# set -euxo pipefail
# # build a squid config file
# CONTROLLER_IP=$(juju list-controllers --format yaml | yq '.controllers[.current-controller].recent-server' | awk -F '[:]' '{print $1}');
# echo "Controller IP is: $CONTROLLER_IP"
# PROXY=$CONTROLLER_IP:3128
# echo "Proxy address is: $PROXY"
# echo "acl all src all" > squid.conf
# echo "http_access allow all" >> squid.conf
# echo "http_port $PROXY" >> squid.conf
# cat squid.conf
# # copy to the controller and reconfigure it
# juju status -m controller
# juju switch controller
# juju ssh 0 "sudo apt-get install squid -y"
# juju scp squid.conf 0:/tmp/squid.conf
# juju ssh 0 "sudo mv /tmp/squid.conf /etc/squid/squid.conf"
# juju ssh 0 "sudo squid -k reconfigure"
# # Test curl after waiting
# sleep 10
# echo "Test proxy access"
# curl -s -o /dev/null -w "%{http_code}" --proxy http://$PROXY https://charmhub.io
# # 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@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run integration
# Force one single concurrent test
run: tox -e integration