Skip to content

Commit

Permalink
github actions: ensure dependencies are present
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielfalcao committed Jan 9, 2024
1 parent 9132ee7 commit fb6ac11
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 29 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,14 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Install python version
- name: Install Python
uses: gabrielfalcao/pyenv-action@v18
with:
default: "${{ matrix.python }}"
command: pip install -U pip setuptools

- name: Install dependencies
run: pip install -r development.txt

- name: Install sure
run: pip install -e .
command: make dependencies

- name: Test with PyTest
run: make tests
run: make dependencies tests

- name: Self/Auto Test
run: make run
run: make dependencies run
39 changes: 20 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ GIT_ROOT := $(shell dirname $(MAKEFILE_PATH))
VENV_ROOT := $(GIT_ROOT)/.venv

PACKAGE_NAME := sure
MAIN_CLI_NAME := sure
LIBEXEC_NAME := sure
REQUIREMENTS_FILE := development.txt

PACKAGE_PATH := $(GIT_ROOT)/$(PACKAGE_NAME)
REQUIREMENTS_PATH := $(GIT_ROOT)/$(REQUIREMENTS_FILE)
MAIN_CLI_PATH := $(VENV_ROOT)/bin/$(MAIN_CLI_NAME)
LIBEXEC_PATH := $(VENV_ROOT)/bin/$(LIBEXEC_NAME)
export VENV ?= $(VENV_ROOT)

OSNAME := $(shell uname)
Expand All @@ -28,7 +28,7 @@ AUTO_STYLE_TARGETS := sure/runtime.py sure/runner.py sure/meta.py sure/meta.py s
######################################################################

# default target when running `make` without arguments
all: | $(MAIN_CLI_PATH)
all: | $(LIBEXEC_PATH)

# creates virtualenv
venv: | $(VENV)
Expand All @@ -37,12 +37,12 @@ venv: | $(VENV)
develop: | $(VENV)/bin/python $(VENV)/bin/pip

# installs the requirements and the package dependencies
setup: | $(MAIN_CLI_PATH)
setup: | $(LIBEXEC_PATH)

# Convenience target to ensure that the venv exists and all
# requirements are installed
dependencies:
@rm -f $(MAIN_CLI_PATH) # remove MAIN_CLI_PATH to trigger pip install
dependencies: $(VENV)/bin/pytest
@rm -f $(LIBEXEC_PATH) # remove LIBEXEC_PATH to trigger pip install
$(MAKE) develop setup

clean-docs:
Expand All @@ -58,10 +58,10 @@ test tests:
@$(VENV)/bin/pytest --cov=sure --ignore tests/crashes tests

# runs main command-line tool
run: | $(MAIN_CLI_PATH)
$(MAIN_CLI_PATH) --reporter=test tests/crashes || true
$(MAIN_CLI_PATH) --special-syntax --with-coverage --cover-branches --cover-module=sure.core --cover-module=sure tests/runner
$(MAIN_CLI_PATH) --special-syntax --with-coverage --cover-branches --cover-module=sure --immediate --cover-module=sure --ignore=crashes tests
run: | $(LIBEXEC_PATH)
$(LIBEXEC_PATH) --reporter=test tests/crashes || true
$(LIBEXEC_PATH) --special-syntax --with-coverage --cover-branches --cover-module=sure.core --cover-module=sure tests/runner
$(LIBEXEC_PATH) --special-syntax --with-coverage --cover-branches --cover-module=sure --immediate --cover-module=sure --ignore=crashes tests

push-release: dist # pushes distribution tarballs of the current version
$(VENV)/bin/twine upload dist/*.tar.gz
Expand Down Expand Up @@ -119,7 +119,7 @@ $(VENV)/bin/flake8: | $(VENV)/bin/pip

# installs this package in "edit" mode after ensuring its requirements are installed

$(VENV)/bin/sure $(VENV)/bin/pytest $(MAIN_CLI_PATH): | $(VENV) $(VENV)/bin/pip $(VENV)/bin/python $(REQUIREMENTS_PATH)
install $(VENV)/bin/pytest $(LIBEXEC_PATH): | $(VENV) $(VENV)/bin/pip $(VENV)/bin/python $(REQUIREMENTS_PATH)
$(VENV)/bin/pip install -r $(REQUIREMENTS_PATH)
$(VENV)/bin/pip install .

Expand All @@ -140,20 +140,21 @@ $(REQUIREMENTS_PATH):

.PHONY: \
all \
black \
isort \
flake8 \
autostyle \
black \
build-release \
clean \
clean-docs \
dependencies \
develop \
docs \
flake8 \
html-docs \
install \
isort \
push-release \
release \
setup \
run \
setup \
test \
tests \
clean-docs \
html-docs \
docs
tests

0 comments on commit fb6ac11

Please sign in to comment.