diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..632e8eb --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + - package-ecosystem: gomod + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..33ae759 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,24 @@ +name: lint + +on: pull_request + +env: + GO111MODULE: on + +permissions: + contents: read + +concurrency: + group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 1.x + cache-dependency-path: "**/go.sum" + - run: make lint diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..ce74136 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,51 @@ +name: pr + +on: pull_request + +env: + GO111MODULE: on + +permissions: + contents: read + +concurrency: + group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + defaults: + run: + shell: bash + strategy: + matrix: + go-version: [1.x, 1.21.x] + platform: [ubuntu-latest] + include: + - go-version: 1.x + platform: ubuntu-latest + update-coverage: true + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + - uses: actions/checkout@v4 + + - id: cache-paths + run: | + echo "go-cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT + echo "go-mod-cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT + + - name: Cache go modules + uses: actions/cache@v4 + with: + path: | + ${{ steps.cache-paths.outputs.go-cache }} + ${{ steps.cache-paths.outputs.go-mod-cache }} + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go- + + - name: Build + run: make build diff --git a/.gitignore b/.gitignore index c07171e..0d2c7b7 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ # Dependency directories (remove the comment below to include it) vendor/ coverage.txt -go-github-mock \ No newline at end of file +go-github-mock +target/ diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..e69de29 diff --git a/go.defs b/go.defs index 22dadcf..2b697eb 100644 --- a/go.defs +++ b/go.defs @@ -6,7 +6,7 @@ HOST := github.com OWNER := migueleliasweb init: - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.2 + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2 lint: init $(GOPATH)/bin/golangci-lint run ./... diff --git a/main.go b/main.go index 0304ca1..cd642c3 100644 --- a/main.go +++ b/main.go @@ -4,7 +4,6 @@ import ( "bytes" "flag" "fmt" - "io/ioutil" "os" "os/exec" @@ -74,7 +73,7 @@ func main() { "paths", ) - ioutil.WriteFile( + os.WriteFile( gen.OUTPUT_FILEPATH, buf.Bytes(), 0755,