From ffd3310e53d5c43b95f07991340c6006cb00f4a5 Mon Sep 17 00:00:00 2001 From: Onur Cinar Date: Sun, 18 Aug 2024 10:20:49 -0700 Subject: [PATCH] Taskfile added. --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ taskfile.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 taskfile.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..efa7629 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: Build + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: ./go.mod + + - name: Setup cache + uses: actions/cache@v4 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Run task + run: go run github.com/go-task/task/v3/cmd/task@v3.38.0 + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.5.0 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/taskfile.yml b/taskfile.yml new file mode 100644 index 0000000..eb18359 --- /dev/null +++ b/taskfile.yml @@ -0,0 +1,28 @@ +version: '3' +output: 'prefixed' + +tasks: + default: + cmds: + - task: fmt + - task: lint + - task: test + + action: + deps: [lint, test] + + fmt: + cmds: + - go fix ./... + + lint: + cmds: + - go vet ./... + - go run github.com/securego/gosec/v2/cmd/gosec@v2.20.0 ./... + - go run honnef.co/go/tools/cmd/staticcheck@v0.5.1 ./... + - go run github.com/mgechev/revive@v1.3.4 -config=revive.toml ./... + + test: + cmds: + - go test -cover -coverprofile=coverage.out ./... +