From e0e9a71e372104585dce538ba6109a0921389061 Mon Sep 17 00:00:00 2001 From: Ricky Pike Date: Tue, 22 Feb 2022 14:54:34 -0600 Subject: [PATCH] use GitHub Actions and GoReleaser --- .github/workflows/builder.yml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ .goreleaser.yml | 31 +++++++++++++++++++++++++++++++ .travis.yml | 22 ---------------------- go.mod | 3 +++ 5 files changed, 94 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/builder.yml create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml delete mode 100644 .travis.yml create mode 100644 go.mod diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml new file mode 100644 index 0000000..66c7b7a --- /dev/null +++ b/.github/workflows/builder.yml @@ -0,0 +1,32 @@ +on: [push, pull_request] +name: Build +jobs: + test: + strategy: + matrix: + go-version: [1.17.x] + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: Code format + run: diff -u <(echo -n) <(gofmt -d -s .) + - name: Vet + run: go vet ./... + - name: Unit tests + run: go test -race -coverprofile=coverage.out ./... + - name: Function coverage + run: go tool cover "-func=coverage.out" + - name: Upload coverage report + uses: codecov/codecov-action@v2 + with: + file: ./coverage.out + - name: Build and Execute + run: | + go build -o jacksquat . + ./jacksquat test --help \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..95633b1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17.x + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..fb55b7f --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,31 @@ +release: + draft: true +before: + hooks: + - go mod tidy +builds: + - main: . + binary: jacksquat + ldflags: + - -s -w + env: + - CGO_ENABLED=0 + goos: + - linux + goarch: + - amd64 + - arm + - arm64 + ignore: + - goos: linux + goarch: 386 +archives: + - name_template: "jacksquat_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + files: + - README.md +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + skip: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 451884e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: go - -go: - - 1.13.x - -# Only clone the most recent commit. -git: - depth: 1 - -script: - - make test && bash <(curl -s https://codecov.io/bash) - - make - -deploy: - provider: releases - api_key: $GITHUB_TOKEN - file_glob: true - file: bin/* - skip_cleanup: true - draft: true - on: - tags: true \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..2705776 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/arcanericky/jacksquat + +go 1.17