From 76b6150a1e70be205dc872b1fab8beb4e3a49ec7 Mon Sep 17 00:00:00 2001 From: Sacha Ligthert Date: Thu, 15 Aug 2024 13:51:10 +0200 Subject: [PATCH] Added pre-commit and replace buildscript with Taskfile --- .gitignore | 2 +- .pre-commit-config.yaml | 8 ++++++++ Taskfile.dist.yaml | 16 ++++++++++++++++ build.sh | 5 ----- 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 .pre-commit-config.yaml create mode 100644 Taskfile.dist.yaml delete mode 100755 build.sh diff --git a/.gitignore b/.gitignore index ec2a80e..d5905e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -builds \ No newline at end of file +builds diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2a788d6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 # this is optional, use `pre-commit autoupdate` to get the latest rev! + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + diff --git a/Taskfile.dist.yaml b/Taskfile.dist.yaml new file mode 100644 index 0000000..ee7e39b --- /dev/null +++ b/Taskfile.dist.yaml @@ -0,0 +1,16 @@ +version: '3' + +vars: + APP: snake + BUILD_DIR: builds + +tasks: + default: + cmds: + - go run . + build: + cmds: + - mkdir -p {{.BUILD_DIR}} + - rm {{.BUILD_DIR}}/* || true + - go tool dist list | grep -v android | grep -v ios | grep -v wasip1 | awk -F '/' '{printf "echo Compiling %s/%s; env CGO_ENABLED=1 GOOS=%s GOARCH=%s go build -o {{.BUILD_DIR}}/{{.APP}}.%s-%s\n",$1,$2,$1,$2,$1,$2 }' | sh + - for i in `ls {{.BUILD_DIR}}/*windows*`; do mv -v $i $i.exe; done diff --git a/build.sh b/build.sh deleted file mode 100755 index 8cd8546..0000000 --- a/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -mkdir -p builds - -go tool dist list | grep -v android | grep -v darwin | grep -v ios | grep -v wasip1 | awk -F '/' '{printf "echo Compiling %s/%s; env CGO_ENABLED=1 GOOS=%s GOARCH=%s go build -o builds/snake.%s-%s\n",$1,$2,$1,$2,$1,$2 }' | sh \ No newline at end of file