From 01ddcc8f92406c20219d2a1345ede2dd603c9da1 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Wed, 20 Mar 2024 14:55:37 +0100 Subject: [PATCH] chore: use GitHub Action --- .github/workflows/go-cross.yml | 32 +++++++++++++++++++++++++ .github/workflows/main.yml | 43 ++++++++++++++++++++++++++++++++++ .travis.yml | 4 ---- Makefile | 15 ++++++++++++ README.md | 4 ++-- 5 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/go-cross.yml create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml create mode 100644 Makefile diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml new file mode 100644 index 0000000..206b6d8 --- /dev/null +++ b/.github/workflows/go-cross.yml @@ -0,0 +1,32 @@ +name: Go Matrix +on: [push, pull_request] + +jobs: + + cross: + name: Go + runs-on: ${{ matrix.os }} + env: + CGO_ENABLED: 0 + + strategy: + matrix: + go-version: [ olstable, stable ] + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + # https://github.com/marketplace/actions/checkout + - name: Checkout code + uses: actions/checkout@v4 + + # https://github.com/marketplace/actions/setup-go-environment + - name: Set up Go ${{ matrix.go-version }} + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + + - name: Test + run: go test -v -cover ./... + + - name: Build + run: go build -v -ldflags "-s -w" -trimpath diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..8d8ce52 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,43 @@ +name: Main + +on: + push: + branches: + - main + pull_request: + +jobs: + + main: + name: Main Process + runs-on: ubuntu-latest + env: + GO_VERSION: stable + GOLANGCI_LINT_VERSION: v1.57.0 + CGO_ENABLED: 0 + + steps: + # https://github.com/marketplace/actions/checkout + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # https://github.com/marketplace/actions/setup-go-environment + - name: Set up Go ${{ env.GO_VERSION }} + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Check and get dependencies + run: | + go mod download + go mod tidy + git diff --exit-code go.mod + + # https://golangci-lint.run/usage/install#other-ci + - name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }} + run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION} + + - name: Make + run: make diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b8ee13a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: go -go: - - 1.14 - - 1.15 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0a10017 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +.PHONY: clean check test build + +default: clean check test build + +clean: + rm -rf dist/ cover.out + +test: clean + go test -v -cover ./... + +check: + golangci-lint run + +build: + go build -ldflags "-s -w" -trimpath diff --git a/README.md b/README.md index 4267fe2..3529aff 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# dupl [![Build Status](https://travis-ci.org/mibk/dupl.png)](https://travis-ci.org/mibk/dupl) +# dupl **dupl** is a tool written in Go for finding code clones. So far it can find clones only in the Go source files. The method uses suffix tree for serialized ASTs. It ignores values of AST nodes. It just operates with their types (e.g. `if a == 13 {}` and `if x == 100 {}` are considered the same provided it exceeds the minimal token sequence size). -Due to the used method dupl can report so called "false positives" on the output. These are +Due to the used method dupl can report so-called "false positives" on the output. These are the ones we do not consider clones (whether they are too small, or the values of the matched tokens are completely different).