Skip to content

Commit 8bdac71

Browse files
committed
make test just runs workflow
1 parent 66b9a58 commit 8bdac71

File tree

4 files changed

+37
-28
lines changed

4 files changed

+37
-28
lines changed

.github/workflows/github-workflow-molecule.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ jobs:
4141
fail-fast: false
4242
matrix:
4343
config:
44-
- 2204-no-uv
45-
- 2404-no-uv
46-
- 2404-uv
44+
- 2204
45+
- 2404
4746

4847
steps:
4948
- name: Checkout code
@@ -63,4 +62,7 @@ jobs:
6362
uses: docker/setup-buildx-action@v3
6463

6564
- name: Run molecule test
66-
run: make molecule-${{ matrix.config }}
65+
run: molecule test
66+
env:
67+
MOLECULE_UBUNTU_VERSION: ${{ matrix.config }}
68+

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ Icon
88
.ci-env
99
.ansible
1010
__pycache__
11-
molecule*.log
11+
molecule*.log
12+
.act/

Makefile

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
.PHONY: help clean lint test molecule molecule-test format \
2-
molecule-test molecule-2204-no-uv molecule-2404-no-uv molecule-2404-uv
31

2+
.PHONY: help clean lint test format act act-download distclean
3+
4+
ACT_VERSION ?= 0.2.82
5+
ACT_BINARY := $(shell pwd)/.act/act
46
molecule ?= molecule
57

68
help: ## Display this help message
@@ -23,37 +25,41 @@ format: ## Format code with black and other formatters
2325
black tests/ --line-length 88 --target-version py39
2426
@echo "Code formatting completed!"
2527

26-
test: lint molecule ## Run default test suite (lint + default molecule scenario)
27-
@echo "Default testing completed!"
28-
2928
molecule-2204-no-uv:
30-
@echo "==> molecule: ubuntu-22.04 (no uv)"; \
31-
LOG=molecule-2204-no-uv.log; \
32-
( MOLECULE_UBUNTU_VERSION=2204 PYTHON_UV_INSTALL=false $(molecule) test -s default 2>&1 | tee $$LOG ) || ( echo "FAILED: see $$LOG"; cat $$LOG; false )
29+
@echo "molecule: ubuntu-22.04 (no uv)"
30+
LOG=molecule-2204-no-uv.log; \
31+
( MOLECULE_UBUNTU_VERSION=2204 PYTHON_UV_INSTALL=false $(molecule) test -s default 2>&1 | tee $$LOG ) || ( echo "FAILED: see $$LOG"; cat $$LOG; false )
3332

3433
molecule-2404-no-uv:
35-
@echo "==> molecule: ubuntu-24.04 (no uv)"; \
36-
LOG=molecule-2404-no-uv.log; \
37-
( MOLECULE_UBUNTU_VERSION=2404 PYTHON_UV_INSTALL=false $(molecule) test -s default 2>&1 | tee $$LOG ) || ( echo "FAILED: see $$LOG"; cat $$LOG; false )
34+
@echo "molecule: ubuntu-24.04 (no uv)"
35+
LOG=molecule-2404-no-uv.log; \
36+
( MOLECULE_UBUNTU_VERSION=2404 PYTHON_UV_INSTALL=false $(molecule) test -s default 2>&1 | tee $$LOG ) || ( echo "FAILED: see $$LOG"; cat $$LOG; false )
3837

3938
molecule-2404-uv:
40-
@echo "==> molecule: ubuntu-24.04 (with uv)"; \
41-
LOG=molecule-2404-uv.log; \
42-
( MOLECULE_UBUNTU_VERSION=2404 PYTHON_UV_INSTALL=true PYTHON_UV_SUFFIX="-alt" $(molecule) test -s default 2>&1 | tee $$LOG ) || ( echo "FAILED: see $$LOG"; cat $$LOG; false )
39+
@echo "molecule: ubuntu-24.04 (with uv)"
40+
LOG=molecule-2404-uv.log; \
41+
( MOLECULE_UBUNTU_VERSION=2404 PYTHON_UV_INSTALL=true PYTHON_UV_SUFFIX="-alt" $(molecule) test -s default 2>&1 | tee $$LOG ) || ( echo "FAILED: see $$LOG"; cat $$LOG; false )
4342

44-
molecule:
45-
@echo "Running all molecule scenarios..."
46-
make -j molecule-test
43+
act-download: ## download act
44+
@if [ ! -f "$(ACT_BINARY)" ]; then \
45+
@echo "Downloading act..." ; \
46+
mkdir -p $(shell pwd)/.act ; \
47+
curl -L https://github.com/nektos/act/releases/download/v$(ACT_VERSION)/act_Linux_x86_64.tar.gz | tar -xz -C $(shell pwd)/.act act ; \
48+
fi
4749

48-
molecule-test: molecule-2404-uv molecule-2404-no-uv molecule-2204-no-uv
50+
molecule: molecule-2404-uv molecule-2404-no-uv molecule-2204-no-uv
4951

50-
molecule-destroy:
51-
@echo "Removing molecule instances"
52-
molecule destroy
52+
test: act-download ## Run GitHub workflows, but locally
53+
@echo "Running Tests!"
54+
$(ACT_BINARY)
5355

5456
clean: molecule-destroy ## Clean up molecule instances and temporary files
5557
@echo "Cleaning up..."
5658
find . -name "*.pyc" -delete
5759
find . -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
5860
find . -name ".pytest_cache" -type d -exec rm -rf {} + 2>/dev/null || true
5961
@echo "Cleanup completed!"
62+
63+
distclean: clean
64+
@echo "Dist cleaning..."
65+
rm -rf $(shell pwd)/.act

molecule/default/molecule.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ driver:
66
name: docker
77

88
platforms:
9-
- name: "ubuntu-${MOLECULE_UBUNTU_VERSION:-2404}${PYTHON_UV_SUFFIX}"
10-
image: "geerlingguy/docker-ubuntu${MOLECULE_UBUNTU_VERSION:-2404}${PYTHON_UV_SUFFIX}-ansible:latest"
9+
- name: "anxs-python-ubuntu-${MOLECULE_UBUNTU_VERSION:-2404}${PYTHON_UV_SUFFIX}"
10+
image: "geerlingguy/docker-ubuntu${MOLECULE_UBUNTU_VERSION:-2404}-ansible:latest"
1111
volumes:
1212
- /sys/fs/cgroup:/sys/fs/cgroup:rw
1313
privileged: true

0 commit comments

Comments
 (0)