enh: test with free-threaded python #287
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 | |
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 | |
unit-nogil: | |
name: Unit test (without GIL) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get free-threaded Python | |
run: | | |
sudo add-apt-repository ppa:deadsnakes | |
sudo apt-get update | |
sudo apt-get install python3.13-nogil | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
poetry env use $(which python3.13t) | |
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 |