Ability to build release zips in CI
This commit is contained in:
parent
8f5511327e
commit
cd7d8a2e4c
@ -1,6 +1,22 @@
|
||||
---
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: 'kmkfw/base'
|
||||
|
||||
environment:
|
||||
KMK_TEST: 1
|
||||
PIPENV_VENV_IN_PROJECT: 1
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v2-kmk-venv-{{ checksum "Pipfile.lock" }}
|
||||
|
||||
- run: make dist
|
||||
|
||||
test:
|
||||
docker:
|
||||
- image: 'kmkfw/base'
|
||||
@ -21,6 +37,13 @@ workflows:
|
||||
version: 2
|
||||
build-deploy:
|
||||
jobs:
|
||||
- build:
|
||||
filters:
|
||||
branches:
|
||||
# only: /master/
|
||||
only: /.*/
|
||||
tags:
|
||||
only: /.*/
|
||||
- test:
|
||||
filters:
|
||||
branches:
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -102,6 +102,7 @@ venv.bak/
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.compiled/
|
||||
|
||||
.ampy
|
||||
.submodules
|
||||
|
@ -3,7 +3,7 @@ FROM python:3.7-alpine
|
||||
RUN mkdir -p /app
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk update && apk add alpine-sdk curl gettext git git-lfs openssh rsync wget
|
||||
RUN apk update && apk add alpine-sdk curl gettext git git-lfs openssh rsync wget zip
|
||||
|
||||
RUN pip install pipenv
|
||||
|
||||
|
25
Makefile
25
Makefile
@ -6,6 +6,8 @@
|
||||
|
||||
.DEFAULT: all
|
||||
|
||||
DIST_DESCRIBE_CMD = git describe --always --abbrev=0 --dirty --broken
|
||||
|
||||
DOCKER_BASE_TAG ?= latest
|
||||
DOCKER_TAG ?= latest
|
||||
|
||||
@ -22,14 +24,31 @@ MPY_TARGET_DIR ?= .compiled
|
||||
all: copy-kmk copy-bootpy copy-keymap
|
||||
|
||||
compile: $(MPY_TARGET_DIR)/.mpy.compiled
|
||||
|
||||
$(MPY_TARGET_DIR)/.mpy.compiled: $(shell find $(MPY_SOURCES) -name "*.py")
|
||||
ifeq ($(MPY_CROSS),)
|
||||
@echo "===> Could not find mpy-cross in PATH, exiting"
|
||||
@false
|
||||
endif
|
||||
|
||||
$(MPY_TARGET_DIR)/.mpy.compiled: $(shell find $(MPY_SOURCES) -name "*.py")
|
||||
@mkdir -p $(MPY_TARGET_DIR)
|
||||
@find $(MPY_SOURCES) -name "*.py" -exec sh -c 'mkdir -p $(MPY_TARGET_DIR)/$$(dirname {}) && mpy-cross $(MPY_FLAGS) {} -o $(MPY_TARGET_DIR)/$$(dirname {})/$$(basename -s .py {}).mpy' \;
|
||||
@touch $(MPY_TARGET_DIR)/.mpy.compiled
|
||||
|
||||
dist: dist/latest.zip dist/latest.unoptimized.zip dist/$(shell $(DIST_DESCRIBE_CMD)).zip dist/$(shell $(DIST_DESCRIBE_CMD)).unoptimized.zip
|
||||
|
||||
dist/latest.zip: compile
|
||||
@mkdir -p dist
|
||||
@cd $(MPY_TARGET_DIR) && zip -r ../dist/latest.zip kmk
|
||||
|
||||
dist/$(shell $(DIST_DESCRIBE_CMD)).zip: dist/latest.zip
|
||||
@cp dist/latest.zip dist/$$($(DIST_DESCRIBE_CMD)).zip
|
||||
|
||||
dist/latest.unoptimized.zip:
|
||||
@mkdir -p dist
|
||||
@zip -r dist/latest.unoptimized.zip kmk
|
||||
|
||||
dist/$(shell $(DIST_DESCRIBE_CMD)).unoptimized.zip: dist/latest.unoptimized.zip
|
||||
@cp dist/latest.unoptimized.zip dist/$$($(DIST_DESCRIBE_CMD)).unoptimized.zip
|
||||
|
||||
.docker_base: Dockerfile
|
||||
@echo "===> Building Docker base image kmkfw/base:${DOCKER_BASE_TAG}"
|
||||
@ -57,7 +76,7 @@ fix-isort: devdeps
|
||||
|
||||
clean: clean-build-log
|
||||
@echo "===> Cleaning build artifacts"
|
||||
@rm -rf .devdeps build
|
||||
@rm -rf .devdeps build dist $(MPY_TARGET_DIR)
|
||||
|
||||
clean-build-log:
|
||||
@echo "===> Clearing previous .build.log"
|
||||
|
Loading…
Reference in New Issue
Block a user