From 7426d68a9ff7f0072b498fe81278037943440d5e Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 12 Jul 2023 21:59:23 +0200 Subject: Makefile: add shortcuts for integration tests --- .github/workflows/ci.yml | 10 +++++----- Makefile | 32 +++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dedadd7..96d8d0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,10 +32,10 @@ jobs: run: pip install -q -e . - name: Verify that scripts are runnable run: cgitize --version - - name: Integration test (local) - run: ./test/integration/local/test.sh - name: Unit tests - run: python -m unittest --buffer + run: make test/unit + - name: Integration test (local) + run: make test/local test_docker: runs-on: ubuntu-latest @@ -44,7 +44,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Integration test (Docker) - run: sudo ./test/integration/docker/test.sh + run: sudo make test/docker test_example_config: needs: [test_local, test_docker] @@ -74,7 +74,7 @@ jobs: with: ssh-private-key: '${{ secrets.SSH_KEY }}' - name: Integration test (example config) - run: ./test/integration/example/test.sh + run: make test/example publish_docker: needs: [test_local, test_example_config, test_docker] diff --git a/Makefile b/Makefile index 71dab31..0622bc1 100644 --- a/Makefile +++ b/Makefile @@ -92,6 +92,7 @@ buildx/push: . venv_dir := .venv +venv_activate := . '$(call escape,$(venv_dir)/bin/activate)' .PHONY: venv/reset venv/reset: @@ -101,33 +102,42 @@ venv/reset: .PHONY: venv venv: venv/reset - . '$(call escape,$(venv_dir))/bin/activate' && pip install -q -r requirements.txt + $(venv_activate) && pip install -q -r requirements.txt # Is there a better way? .PHONY: venv/upgrade venv/upgrade: venv/reset - . '$(call escape,$(venv_dir))/bin/activate' \ + $(venv_activate) \ && pip install -q . \ && pip uninstall -q --yes '$(call escape,$(PROJECT))' \ && pip freeze > requirements.txt -.PHONY: py -py: python +.PHONY: python +python: + $(venv_activate) && python .PHONY: repl repl: python -.PHONY: python -python: - . '$(call escape,$(venv_dir))/bin/activate' && python +.PHONY: test/unit +test/unit: + python -m unittest --verbose --buffer + +.PHONY: test/local +test/local: + ./test/integration/local/test.sh + +.PHONY: test/docker +test/docker: + ./test/integration/docker/test.sh -.PHONY: test -test: - . '$(call escape,$(venv_dir))/bin/activate' && python -m unittest --verbose --buffer +.PHONY: test/example +test/example: + ./test/integration/example/test.sh .PHONY: tag tag: - . '$(call escape,$(venv_dir))/bin/activate' \ + $(venv_activate) \ && pip install -q --upgrade setuptools-scm \ && version="$$( python -m setuptools_scm --strip-dev )" \ && git tag "v$$version" -- cgit v1.2.3