Skip to content

Commit fe049ce

Browse files
authored
Merge pull request #9 from rpanfili/makefile_pipeline
add Makefile pipeline.
2 parents f4a6371 + 7e65e21 commit fe049ce

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.github/workflows/release.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: "Dactyl keyboard"
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 10
13+
name: "Build artifacts and publish Release"
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- uses: satackey/[email protected]
18+
continue-on-error: true
19+
- name: Clean up
20+
run: rm -r things/*
21+
- name: Build
22+
run: make build
23+
- name: Release
24+
uses: softprops/action-gh-release@v1
25+
with:
26+
draft: false
27+
files: things/*
28+
tag_name: v${{ github.run_number }}
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#SHELL := /bin/sh
2+
3+
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
4+
current_dir := $(dir $(mkfile_path))
5+
6+
source_dir := ${current_dir}"src"
7+
artifact_dir := ${current_dir}"things"
8+
9+
DOCKER_CMD := "docker"
10+
.DEFAULT_GOAL := help
11+
12+
help: ## Will print this help.
13+
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
14+
.PHONY: help
15+
16+
.DELETE_ON_ERROR:
17+
18+
build: build-container config build-models ## Build everything. Executes the complete pipeline.
19+
@echo "\nAll done"
20+
.PHONY: build
21+
22+
check-requirements: # private
23+
@if ! command -v ${DOCKER_CMD} %> /dev/null; then \
24+
echo "Docker executable not found (\`${DOCKER_CMD}\`)." && \
25+
exit 1; \
26+
fi
27+
.PHONY: check-requirements
28+
29+
build-container: check-requirements ## Build docker container.
30+
@echo "\nBuilding container..\n" && \
31+
${DOCKER_CMD} build -t dactyl-keyboard -f docker/Dockerfile . && \
32+
echo "Done"
33+
.PHONY: build-container
34+
35+
config: check-requirements ## Generate configuration.
36+
@echo "\nGenerate configuration..\n" && \
37+
${DOCKER_CMD} run --rm --name DM-config -v ${source_dir}:/app/src -v ${artifact_dir}:/app/things dactyl-keyboard python3 -i generate_configuration.py && \
38+
echo "Done"
39+
.PHONY: config
40+
41+
build-models: check-requirements ## Build models.
42+
@echo "\nGenerate models..\n" && \
43+
cd ${current_dir} && \
44+
${DOCKER_CMD} run --rm --name DM-run -v ${source_dir}:/app/src -v ${artifact_dir}:/app/things dactyl-keyboard python3 -i dactyl_manuform.py && \
45+
echo "Done"
46+
.PHONY: config
47+
48+
shell: check-requirements ## Open an interactive shell inside a container.
49+
@${DOCKER_CMD} run --rm -it --name DM-shell -v "src:/app/src" -v "things:/app/things" dactyl-keyboard bash && \
50+
echo "\nBye!"
51+
.PHONY: shell
52+

0 commit comments

Comments
 (0)