From 5006729c42b1fd2528973cfb1e44aff653ac87b0 Mon Sep 17 00:00:00 2001 From: Seiji Takahashi Date: Sat, 17 May 2025 17:20:39 +0900 Subject: [PATCH] Switch CI to GitHub Actions --- .circleci/config.yml | 48 ---------------------------------------- .github/workflows/go.yml | 21 ++++++++++++++++++ README.md | 2 +- go.mod | 2 +- main.go | 1 + main_go112.go | 1 + 6 files changed, 25 insertions(+), 50 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/go.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 4724725..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,48 +0,0 @@ -version: 2.1 - -orbs: - go-module: timakin/go-module@0.3.0 - golangci-lint: timakin/golangci-lint@0.1.0 - -executors: - default: - working_directory: /go/src/github.com/timakin/bodyclose - docker: - - image: circleci/golang:1.12 - environment: - - APP_NAME: bodyclose - - GO111MODULE: "on" - -jobs: - test: - executor: - name: default - steps: - - attach_workspace: - at: /go/src/github.com/timakin/bodyclose - - run: go test ./... - -workflows: - version: 2 - setup_and_deploy: - jobs: - - go-module/download: - executor: default - checkout: true - vendoring: true - persist-to-workspace: true - workspace-root: /go/src/github.com/timakin/bodyclose - - test: - requires: - - go-module/download - - golangci-lint/lint: - checkout: false - attach-workspace: true - workspace-root: /go/src/github.com/timakin/bodyclose - working-directory: /go/src/github.com/timakin/bodyclose - requires: - - go-module/download - filters: - branches: - ignore: - - master diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..bde51b5 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,21 @@ +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.22 + - name: Download modules + run: go mod download + - name: Run tests + run: go test ./... diff --git a/README.md b/README.md index 8e7ffbb..9fd2393 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # bodyclose -[![CircleCI](https://circleci.com/gh/timakin/bodyclose.svg?style=svg)](https://circleci.com/gh/timakin/bodyclose) +[![Go](https://github.com/timakin/bodyclose/actions/workflows/go.yml/badge.svg)](https://github.com/timakin/bodyclose/actions/workflows/go.yml) `bodyclose` is a static analysis tool which checks whether `res.Body` is correctly closed. diff --git a/go.mod b/go.mod index 17f59b8..d71af10 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/timakin/bodyclose -go 1.12 +go 1.22 require ( github.com/gostaticanalysis/analysisutil v0.7.1 diff --git a/main.go b/main.go index ef32009..220cfcc 100644 --- a/main.go +++ b/main.go @@ -1,3 +1,4 @@ +//go:build !go1.12 // +build !go1.12 package main diff --git a/main_go112.go b/main_go112.go index 34efc13..2315731 100644 --- a/main_go112.go +++ b/main_go112.go @@ -1,3 +1,4 @@ +//go:build go1.12 // +build go1.12 package main