Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: '3.13'
cache: 'pip'
- name: Install system dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
- uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: uv sync
- name: Run Linting
run: |
make lint
run: uv run ruff check .
43 changes: 17 additions & 26 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ jobs:
- uses: actions/checkout@v6
with:
submodules: 'true'
- uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: uv sync
- id: set-matrix
run: echo "matrix=$(python -m terraform_pytest.cli partitions ${{ github.event.inputs.services || 'ls-all' }})" >> $GITHUB_OUTPUT
run: echo "matrix=$(uv run python -m terraform_pytest.cli partitions ${{ github.event.inputs.services || 'ls-all' }})" >> $GITHUB_OUTPUT

outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
Expand Down Expand Up @@ -68,23 +71,14 @@ jobs:
repository: tinybirdco/pytest-tinybird
path: pytest-tinybird

- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: '3.13'
cache: 'pip'
- uses: astral-sh/setup-uv@v7

- name: Install system dependencies
run: |
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
- name: Install dependencies
run: uv sync

- name: Build ${{ matrix.service_partition.service }} Binary
run: |
source .venv/bin/activate
python -m terraform_pytest.cli build -s ${{ matrix.service_partition.service }}
uv run python -m terraform_pytest.cli build -s ${{ matrix.service_partition.service }}
ls -la ./test-bin

- name: Save Go cache
Expand All @@ -99,21 +93,19 @@ jobs:
- name: Setup tinybird plugin
if: ${{ (github.event.inputs.tinybird-reporting || 'true') == 'true' }}
run: |
source .venv/bin/activate
cd pytest-tinybird
python setup.py install
uv run python setup.py install

- name: Setup LocalStack
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
TMP_USER: ${{ secrets.TMP_USER }}
TMP_PW: ${{ secrets.TMP_PW }}
run: |
source .venv/bin/activate
pip install --pre localstack
uv pip install --pre localstack
docker pull localstack/localstack-pro
localstack extensions init
localstack extensions install "git+https://github.com/localstack/localstack-moto-test-coverage/#egg=collect-raw-metric-data-extension&subdirectory=collect-raw-metric-data-extension"
uv run localstack extensions init
uv run localstack extensions install "git+https://github.com/localstack/localstack-moto-test-coverage/#egg=collect-raw-metric-data-extension&subdirectory=collect-raw-metric-data-extension"

- name: Run ${{ matrix.service_partition.service }} - ${{ matrix.service_partition.partition }} Tests
env:
Expand All @@ -127,26 +119,25 @@ jobs:
CI_JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
CI_JOB_NAME: ${{ github.job }}-${{ matrix.service_partition.service }}-${{ matrix.service_partition.partition }}
run: |
source .venv/bin/activate
export LOCALSTACK_AUTH_TOKEN=${{ secrets.LOCALSTACK_AUTH_TOKEN }}

if [[ $enable_tinybird == 'true' ]]
then
options="-s -v --ls-start --gather-metrics --report-to-tinybird"
else
options="-s -v --ls-start --gather-metrics"
fi

if [[ ${{ matrix.service_partition.service }} == "organizations" ]]
then
make prepare-organizations
fi

if [[ ${{ matrix.service_partition.partition }} == "All" ]]
if [[ ${{ matrix.service_partition.partition }} == "All" ]]
then
python -m pytest --junitxml=target/reports/pytest.xml terraform-provider-aws/internal/service/${{ matrix.service_partition.service }} $options
uv run python -m pytest --junitxml=target/reports/pytest.xml terraform-provider-aws/internal/service/${{ matrix.service_partition.service }} $options
else
python -m pytest --junitxml=target/reports/pytest.xml $(python -m terraform_pytest.cli partition-tests ${{ matrix.service_partition.service }} ${{ matrix.service_partition.partition }} ) $options
uv run python -m pytest --junitxml=target/reports/pytest.xml $(uv run python -m terraform_pytest.cli partition-tests ${{ matrix.service_partition.service }} ${{ matrix.service_partition.partition }} ) $options
fi

- name: Archive Test Result
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
32 changes: 7 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,41 +1,23 @@
SHELL := /bin/bash

VENV_BIN ?= python3 -m venv
VENV_DIR ?= .venv
PIP_CMD ?= pip3

ifeq ($(OS), Windows_NT)
VENV_ACTIVATE = $(VENV_DIR)/Scripts/activate
else
VENV_ACTIVATE = $(VENV_DIR)/bin/activate
endif

usage: ## Show this help in table format
@echo "| Target | Description |"
@echo "|------------------------|-------------------------------------------------------------------|"
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/:.*##\s*/##/g' | awk -F'##' '{ printf "| %-22s | %-65s |\n", $$1, $$2 }'

$(VENV_ACTIVATE):
test -d $(VENV_DIR) || $(VENV_BIN) $(VENV_DIR)
$(VENV_RUN); $(PIP_CMD) install --upgrade pip setuptools wheel plux
touch $(VENV_ACTIVATE)

VENV_RUN = . $(VENV_ACTIVATE)

venv: $(VENV_ACTIVATE) ## Create a new (empty) virtual environment

install: venv ## Install the package in editable mode
$(VENV_RUN); $(PIP_CMD) install -r requirements.txt
install: ## Install the package and dependencies
uv sync

init_precommit: ## Install the pre-commit hook into your local git repository
($(VENV_RUN); pre-commit install)
uv run pre-commit install

lint: ## Run linting
@echo "Running ruff... "
$(VENV_RUN); python -m ruff check .
uv run ruff check .

format: ## Run formatting
$(VENV_RUN); python -m isort .; python -m ruff format .
uv run isort .; uv run ruff format .

reset-submodules: ## Reset the submodules to the specified commit
git submodule foreach git reset --hard
Expand All @@ -45,7 +27,7 @@ get-submodules: ## Get the submodules


prepare-organizations: install
$(VENV_RUN); awslocal organizations create-organization --feature-set ALL
uv run awslocal organizations create-organization --feature-set ALL


.PHONY: usage venv install init_precommit lint format reset-submodules
.PHONY: usage install init_precommit lint format reset-submodules
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# project configuration

[project]
name = "terraform-pytest"
version = "0.1.0"
requires-python = ">=3.13"
dependencies = [
"click>=8.1.3",
"pytest>=8.4.1",
"docker>=7.1.0",
"requests>=2.32.4",
"ruff>=0.12.1",
"isort>=6.0.1",
"pytest-xdist>=3.1.0",
"pre-commit>=4.2.0",
"localstack>=4.6.0",
"PyYAML~=6.0",
"awscli-local",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project.scripts]
terraform-pytest = "terraform_pytest.cli:cli"

Expand Down
11 changes: 0 additions & 11 deletions requirements.txt

This file was deleted.

Loading
Loading