generated from canonical/microk8s-addons-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: merge workflows and better python setup
- Loading branch information
Showing
5 changed files
with
60 additions
and
58 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Continuous Integration | ||
|
||
on: push | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade black | ||
- name: Check Python formatting | ||
run: | | ||
set -eux | ||
black --check tests/ | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: | | ||
sudo python -m pip install --upgrade pip | ||
sudo pip install --upgrade pytest sh ruamel.yaml | ||
- name: Running addons tests | ||
run: | | ||
set -x | ||
sudo snap install microk8s --classic --channel=latest/edge | ||
sudo microk8s status --wait-ready --timeout 600 | ||
sudo microk8s addons repo add testing . | ||
sudo pytest -s ./tests/test-addons.py | ||
sudo snap remove microk8s --purge |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
import sh | ||
import yaml | ||
|
||
from ruamel.yaml import YAML | ||
|
||
from utils import microk8s_enable, wait_for_pod_state, microk8s_disable | ||
|
||
|
||
yaml = YAML(typ="safe") | ||
|
||
|
||
class TestAddons(object): | ||
def test_python_demo_nginx(self): | ||
microk8s_enable("python-hello-k8s") | ||
wait_for_pod_state("", "default", "running", label="app=python-demo-nginx") | ||
status = yaml.safe_load(sh.microk8s.status(format="yaml").stdout) | ||
status = yaml.load(sh.microk8s.status(format="yaml")) | ||
expected = {"python-hello-k8s": "enabled"} | ||
microk8s_disable("python-hello-k8s") |
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