Skip to content

Commit

Permalink
feat: replace makefile with taskfile
Browse files Browse the repository at this point in the history
Signed-off-by: AtomicFS <vojtech_vesely@white-hat-hacker.icu>
  • Loading branch information
AtomicFS committed Sep 17, 2024
1 parent 1dd4fd8 commit 8062546
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 33 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"words": [
"GOARCH",
"GOARM",
"Taskfile",
"armv",
"cocogitto",
"commitlint",
Expand Down
29 changes: 11 additions & 18 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,17 @@ permissions:
contents: read

jobs:
build-cross:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install dependencies
shell: bash
run: sudo apt-get install -y golang make
- name: checkout
uses: actions/checkout@v4
- name: setup go
uses: actions/setup-go@v5
with:
go-version: stable
- name: install taskfile
uses: arduino/setup-task@v2
- name: build
shell: bash
run: make cross

build-native:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install dependencies
shell: bash
run: sudo apt-get install -y golang make
- name: build
shell: bash
run: make native
run: |
task build
3 changes: 3 additions & 0 deletions .github/workflows/release-prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
- name: Update main.go
run: |
sed -i -E 's/const bmcTestGoVersion = .*/const bmcTestGoVersion = "${{ steps.semver.outputs.next }}"/g' main.go
- name: Update Taskfile.yml
run: |
sed -i -E "s/SEMVER: .*/SEMVER: '${{ steps.semver.outputs.next }}'/g" Taskfile.yml
# Changelog
- name: Get cocogitto
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
bmc-test-*
bin/
coverage.html
coverage.out
14 changes: 0 additions & 14 deletions Makefile

This file was deleted.

55 changes: 55 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
version: '3'
vars:
SEMVER: 'v0.0.0'

tasks:
build:
desc: Build go binary
cmds:
# For Matrix build a Taskfile v3.39.0 or newer is needed
- for:
matrix:
OS: ['linux']
ARCH: ['amd64', 'arm', 'arm64']
cmd: GOOS="{{.ITEM.OS}}" GOARCH="{{.ITEM.ARCH}}" go build -ldflags="-s -w" -o "bin/bmc-test-go-{{.ITEM.OS}}-{{.ITEM.ARCH}}-{{.SEMVER}}"

lint:
desc: Run linters
cmds:
- task: lint:revive
- task: lint:vet
- task: lint:staticcheck
- task: lint:golangci-lint

lint:revive:
desc: Faster and stricter golint replacement
cmds:
- revive ./...

lint:vet:
desc: Reports suspicious constructs
cmds:
- go vet ./...

lint:staticcheck:
desc: Static analysis and style rules enforcer
cmds:
- staticcheck -fail "" ./...

lint:golangci-lint:
desc: Collection of golang linters
cmds:
- golangci-lint run --issues-exit-code 0 ./...

format:
desc: Run gofumt (fork of gofmt, stricter) to format the code
cmds:
- gofumpt -w .

test:
desc: Run unit-tests
cmds:
- go test {{.CLI_ARGS}} -race -timeout 60m -shuffle=on -covermode=atomic -coverprofile coverage.out ./...
- go tool cover -func=coverage.out
- go tool cover -html=coverage.out -o coverage.html

0 comments on commit 8062546

Please sign in to comment.