forked from tshort/dactyl-keyboard
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from rpanfili/makefile_pipeline
add Makefile pipeline.
- Loading branch information
Showing
2 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
name: "Dactyl keyboard" | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
name: "Build artifacts and publish Release" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- uses: satackey/[email protected] | ||
continue-on-error: true | ||
- name: Clean up | ||
run: rm -r things/* | ||
- name: Build | ||
run: make build | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
draft: false | ||
files: things/* | ||
tag_name: v${{ github.run_number }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#SHELL := /bin/sh | ||
|
||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
current_dir := $(dir $(mkfile_path)) | ||
|
||
source_dir := ${current_dir}"src" | ||
artifact_dir := ${current_dir}"things" | ||
|
||
DOCKER_CMD := "docker" | ||
.DEFAULT_GOAL := help | ||
|
||
help: ## Will print this help. | ||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | ||
.PHONY: help | ||
|
||
.DELETE_ON_ERROR: | ||
|
||
build: build-container config build-models ## Build everything. Executes the complete pipeline. | ||
@echo "\nAll done" | ||
.PHONY: build | ||
|
||
check-requirements: # private | ||
@if ! command -v ${DOCKER_CMD} %> /dev/null; then \ | ||
echo "Docker executable not found (\`${DOCKER_CMD}\`)." && \ | ||
exit 1; \ | ||
fi | ||
.PHONY: check-requirements | ||
|
||
build-container: check-requirements ## Build docker container. | ||
@echo "\nBuilding container..\n" && \ | ||
${DOCKER_CMD} build -t dactyl-keyboard -f docker/Dockerfile . && \ | ||
echo "Done" | ||
.PHONY: build-container | ||
|
||
config: check-requirements ## Generate configuration. | ||
@echo "\nGenerate configuration..\n" && \ | ||
${DOCKER_CMD} run --rm --name DM-config -v ${source_dir}:/app/src -v ${artifact_dir}:/app/things dactyl-keyboard python3 -i generate_configuration.py && \ | ||
echo "Done" | ||
.PHONY: config | ||
|
||
build-models: check-requirements ## Build models. | ||
@echo "\nGenerate models..\n" && \ | ||
cd ${current_dir} && \ | ||
${DOCKER_CMD} run --rm --name DM-run -v ${source_dir}:/app/src -v ${artifact_dir}:/app/things dactyl-keyboard python3 -i dactyl_manuform.py && \ | ||
echo "Done" | ||
.PHONY: config | ||
|
||
shell: check-requirements ## Open an interactive shell inside a container. | ||
@${DOCKER_CMD} run --rm -it --name DM-shell -v "src:/app/src" -v "things:/app/things" dactyl-keyboard bash && \ | ||
echo "\nBye!" | ||
.PHONY: shell | ||
|