From e8c681888820d1e391b7e98e0ead20f02b871901 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Tue, 23 Jun 2020 15:27:44 -0300 Subject: [PATCH] feat(ci): github actions Signed-off-by: Carlos Alexandro Becker --- .github/workflows/build.yml | 56 +++++++++++++++++++++++++++++++++++++ .github/workflows/gosum.yml | 40 ++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/gosum.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e88bc13 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,56 @@ +name: build + +on: + push: + branches: + - 'master' + tags: + - 'v*' + pull_request: + +jobs: + build: + 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.14 + - + name: Cache Go modules + uses: actions/cache@v1 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - + name: Make Setup + run: | + make setup + - + name: Make CI + run: | + make ci + - + name: Upload coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.txt + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + if: success() && startsWith(github.ref, 'refs/tags/') + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/gosum.yml b/.github/workflows/gosum.yml new file mode 100644 index 0000000..90248c6 --- /dev/null +++ b/.github/workflows/gosum.yml @@ -0,0 +1,40 @@ +name: gosum + +on: + push: + branches: + - 'master' + paths: + - '.github/workflows/gosum.yml' + - 'go.mod' + - 'go.sum' + +jobs: + fix: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.14 + - + name: Tidy + run: | + rm -f go.sum + go mod tidy + - + name: Create Pull Request + uses: peter-evans/create-pull-request@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "chore(deps): go mod tidy" + title: "chore(deps): go mod tidy" + body: | + Current `go.mod` and `go.sum` don't match the source code. + branch: go-mod-tidy + branch-suffix: timestamp + labels: automerge