-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (121 loc) · 3.38 KB
/
test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Test
on:
push:
branches:
- main
pull_request:
env:
# fix NoKeyringError in CI
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring
jobs:
unit:
name: Unit test
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- name: Install poetry
run: pipx install poetry
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install dependencies
run: poetry install --all-extras
- name: Pytest
run: poetry run pytest
vault:
name: Integretion test (Vault)
runs-on: ubuntu-latest
env:
VAULT_ADDR: http://localhost:8200
VAULT_TOKEN: "sample-token"
services:
vault:
image: public.ecr.aws/hashicorp/vault:latest
env:
VAULT_LOCAL_CONFIG: '{"disable_mlock": true, "backend": {"file": {"path": "/vault/file"}}}'
VAULT_DEV_ROOT_TOKEN_ID: ${{ env.VAULT_TOKEN }}
ports:
- 8200:8200
steps:
- name: Get Vault CLI
run: |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install vault
- name: Install poetry
run: pipx install poetry
- name: Setup secrets
run: |
vault secrets enable -path kv1 -version=1 kv
vault secrets enable -path kv2 -version=2 kv
vault kv put kv1/test - << EoS
{
"foo": "hello"
}
EoS
vault kv put kv2/test - << EoS
{
"foo": "hello, world",
"test": {
"name.with-dot": "sample-value"
}
}
EoS
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: poetry
- name: Install dependencies
run: poetry install
- name: Run pytest
run: poetry run pytest tests/providers/vault
minikube:
name: Integretion test (Minikube)
runs-on: ubuntu-latest
steps:
- name: Set up Minikube
uses: medyagh/setup-minikube@latest
- name: Setup secrets
run: |
kubectl create -f - << EoS
apiVersion: v1
kind: Secret
metadata:
name: demo-secret
data:
username: $(echo -n "admin" | base64)
password: $(echo -n "P@ssw0rd" | base64)
EoS
kubectl create -f - << EoS
apiVersion: v1
kind: ConfigMap
metadata:
name: demo-config
data:
host: "localhost"
port: "8080"
EoS
- name: Install poetry
run: pipx install poetry
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: poetry
- name: Install dependencies
run: poetry install
- name: Run pytest
env:
K8S_CLUSTER: minikube
run: poetry run pytest tests/providers/kubernetes