diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..6b787ac --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,49 @@ +name: PR + +on: + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + with: + go-version-file: go.mod + - name: Check formatting + run: | + UNFORMATTED="$(gofmt -l .)" + if [ -n "$UNFORMATTED" ]; then + echo "The following files are not gofmt-formatted:" + echo "$UNFORMATTED" + exit 1 + fi + - name: Vet + run: go vet ./... + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + with: + go-version-file: go.mod + - uses: bazel-contrib/setup-bazel@0.19.0 + - name: Build Go CLI + run: go build ./cmd/moltark + - name: Build Bazel target + run: bazel build //:moltark + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + with: + go-version-file: go.mod + - uses: bazel-contrib/setup-bazel@0.19.0 + - name: Go tests + run: go test ./... + - name: Bazel tests + run: bazel test //...