From f3ee74d818a5d2fa25a17d67cb663eeb7abe6b39 Mon Sep 17 00:00:00 2001 From: bayraktugrul Date: Wed, 9 Oct 2024 20:37:55 +0300 Subject: [PATCH] chore: add workflow for build --- .github/workflows/go.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..b27978d --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,35 @@ +name: build +on: + push: + branches: + - main + pull_request: + +jobs: + test: + name: Build + runs-on: ubuntu-latest + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '>=1.22.0' + + - name: Run go mod tidy + run: | + set -e + go mod tidy + output=$(git status -s) + if [ -z "${output}" ]; then + exit 0 + fi + echo 'We wish to maintain a tidy state for go mod. Please run `go mod tidy` on your branch, commit and push again.' + echo 'Running `go mod tidy` on this CI test yields with the following changes:' + echo "$output" + exit 1 + + - name: Build + run: go build ./... \ No newline at end of file