Pārlūkot izejas kodu

Added pre-commit and replace buildscript with Taskfile

Sacha Ligthert 2 gadi atpakaļ
vecāks
revīzija
76b6150a1e
4 mainītis faili ar 25 papildinājumiem un 6 dzēšanām
  1. 1 1
      .gitignore
  2. 8 0
      .pre-commit-config.yaml
  3. 16 0
      Taskfile.dist.yaml
  4. 0 5
      build.sh

+ 1 - 1
.gitignore

@@ -1 +1 @@
-builds
+builds

+ 8 - 0
.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
+

+ 16 - 0
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

+ 0 - 5
build.sh

@@ -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