-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
32 lines (26 loc) · 893 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
SHELL = bash
PROJ := $(shell basename `pwd`)
DOCKEREXCUTABLE = $(shell type podman >/dev/null 2>&1 && echo "podman" || echo "docker")
VERSION := $(shell grep ^version pyproject.toml | sed 's/version = //' | xargs | sed 's/^v//')
GIT_REF := $(shell [ -d ".git" ] && git rev-parse --short HEAD || echo '')
GIT_BASE_REF := HEAD~1
ifeq ($(GIT_REF), '')
BUILD_VERSION := ${VERSION}
else
BUILD_VERSION := ${VERSION}+${GIT_REF}
endif
CHANGED_FILES=git --no-pager diff ${GIT_BASE_REF}..${GIT_REF} --name-only --diff-filter=ACMR
foo: .git
@echo 'hello world'
@echo ${PROJ}
check:
pre-commit run --files $(shell $(CHANGED_FILES))
test:
pytest tests
build:
yarn build
poetry version v${BUILD_VERSION}
poetry build
poetry version v${VERSION}
build-docker:
$(DOCKEREXCUTABLE) build --build-arg VERSION=v${BUILD_VERSION} -t saksa:v${VERSION}.${GIT_REF} -t saksa:latest -f docker/Dockerfile .