refactor: teleport provider (#138) #23
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" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
~/.cache/pypoetry | |
key: ${{ runner.os }}-python-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }} | |
- name: Install dependencies | |
run: | | |
pip install poetry | |
poetry install --all-extras | |
- name: Pytest | |
run: poetry run pytest | |
integration: | |
name: Integretion test | |
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: 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/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
~/.cache/pypoetry | |
key: ${{ runner.os }}-python-3.11-poetry-${{ hashFiles('poetry.lock') }} | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
pip install poetry | |
poetry install --all-extras | |
- name: Run pytest | |
run: poetry run pytest |