From b0feb9b2afa3fed00bd19fd2d21935b4d666d75d Mon Sep 17 00:00:00 2001 From: Andrey Meshkov Date: Sun, 4 Apr 2021 21:33:22 +0300 Subject: [PATCH] remove travis, add GH actions --- .github/workflows/build.yaml | 109 +++++++++++++++++++++++++++++++++++ .github/workflows/lint.yaml | 26 +++++++++ .golangci.yml | 2 + .travis.yml | 37 ------------ README.md | 1 - snapcraft.yaml | 7 ++- 6 files changed, 142 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/lint.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..3291299 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,109 @@ +name: Build + +'on': + 'push': + 'tags': + - 'v*' + 'branches': + - '*' + 'pull_request': + +jobs: + tests: + runs-on: ${{ matrix.os }} + env: + GO111MODULE: "on" + strategy: + matrix: + os: + - windows-latest + - macos-latest + - ubuntu-latest + + steps: + - uses: actions/checkout@master + + - uses: actions/setup-go@v2 + with: + go-version: 1.x + + - name: Run tests + run: |- + go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./... + + - name: Upload coverage + uses: codecov/codecov-action@v1 + if: "success() && matrix.os == 'ubuntu-latest'" + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.txt + + build: + needs: + - tests + runs-on: ubuntu-latest + env: + GO111MODULE: "on" + steps: + - uses: actions/checkout@master + + - uses: actions/setup-go@v2 + with: + go-version: 1.x + + - name: Prepare environment + run: |- + RELEASE_VERSION="${GITHUB_REF##*/}" + if [[ "${RELEASE_VERSION}" != v* ]]; then RELEASE_VERSION='dev'; fi + echo "RELEASE_VERSION=\"${RELEASE_VERSION}\"" >> $GITHUB_ENV + + # Win + - run: GOOS=windows GOARCH=386 VERSION=${RELEASE_VERSION} make release + - run: GOOS=windows GOARCH=amd64 VERSION=${RELEASE_VERSION} make release + + # MacOS + - run: GOOS=darwin GOARCH=amd64 VERSION=${RELEASE_VERSION} make release + + # Linux X86 + - run: GOOS=linux GOARCH=386 VERSION=${RELEASE_VERSION} make release + - run: GOOS=linux GOARCH=amd64 VERSION=${RELEASE_VERSION} make release + + # Linux ARM + - run: GOOS=linux GOARCH=arm GOARM=6 VERSION=${RELEASE_VERSION} make release + - run: GOOS=linux GOARCH=arm64 VERSION=${RELEASE_VERSION} make release + + # Linux MIPS/MIPSLE + - run: GOOS=linux GOARCH=mips GOMIPS=softfloat VERSION=${RELEASE_VERSION} make release + - run: GOOS=linux GOARCH=mipsle GOMIPS=softfloat VERSION=${RELEASE_VERSION} make release + + # FreeBSD X86 + - run: GOOS=freebsd GOARCH=386 VERSION=${RELEASE_VERSION} make release + - run: GOOS=freebsd GOARCH=amd64 VERSION=${RELEASE_VERSION} make release + + # FreeBSD ARM/ARM64 + - run: GOOS=freebsd GOARCH=arm GOARM=6 VERSION=${RELEASE_VERSION} make release + - run: GOOS=freebsd GOARCH=arm64 VERSION=${RELEASE_VERSION} make release + + - run: ls -l build/dnslookup-* + + - name: Create release + if: startsWith(github.ref, 'refs/tags/v') + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload + if: startsWith(github.ref, 'refs/tags/v') + uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + file: "build/dnslookup-*.tar.gz;build/dnslookup-*.zip" + tags: true + draft: false diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..0731ced --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,26 @@ +name: golangci-lint +'on': + 'push': + 'tags': + - 'v*' + 'branches': + - '*' + 'pull_request': + +jobs: + golangci: + runs-on: + ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + steps: + - uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2.3.0 + with: + # This field is required. Dont set the patch version to always use + # the latest patch version. + version: v1.38 diff --git a/.golangci.yml b/.golangci.yml index 8a51c46..bb31db8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -53,6 +53,8 @@ issues: # it can be disabled by `exclude-use-default: false`. To list all # excluded by default patterns execute `golangci-lint run --help` exclude: + # gocyclo - allow main to be huge + - cyclomatic complexity 24 of func `main` is high # errcheck defer Close - error return value not checked \(defer .*\.Close()\) # errcheck: Almost all programs ignore errors on these functions and in most cases it's ok diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3da0936..0000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: go -sudo: false - -os: - - linux - -env: - - GO111MODULE=on - -go: - - 1.x - -script: - # Windows-386 build - - GOOS=windows GOARCH=386 VERSION=${TRAVIS_TAG:-dev} make release - # Windows-amd64 build - - GOOS=windows GOARCH=amd64 VERSION=${TRAVIS_TAG:-dev} make release - # Linux-386 build - - GOOS=linux GOARCH=386 VERSION=${TRAVIS_TAG:-dev} make release - # Linux-amd64 build - - GOOS=linux GOARCH=amd64 VERSION=${TRAVIS_TAG:-dev} make release - # Darwin-amd64 build - - GOOS=darwin GOARCH=amd64 VERSION=${TRAVIS_TAG:-dev} make release - # List build output - - ls -l build/dnslookup-* - -deploy: - provider: releases - api_key: $GITHUB_TOKEN - file: - - build/dnslookup-*.zip - - build/dnslookup-*.tar.gz - on: - repo: ameshkov/dnslookup - tags: true - file_glob: true - skip_cleanup: true \ No newline at end of file diff --git a/README.md b/README.md index cf3c384..fa617d5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -[![Build Status](https://travis-ci.com/ameshkov/dnslookup.svg?branch=master)](https://travis-ci.com/ameshkov/dnslookup) [![Go Report Card](https://goreportcard.com/badge/github.com/ameshkov/dnslookup)](https://goreportcard.com/report/ameshkov/dnslookup) [![Latest release](https://img.shields.io/github/release/ameshkov/dnslookup/all.svg)](https://github.com/ameshkov/dnslookup/releases) [![Snap Store](https://snapcraft.io/dnslookup/badge.svg)](https://snapcraft.io/dnslookup) diff --git a/snapcraft.yaml b/snapcraft.yaml index 8b67d9b..c0ee9cb 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -1,5 +1,5 @@ name: dnslookup -version: '1.4.7' +version: '1.4.8' summary: Simple command-line tool to make DNS lookups using any protocol. description: | Simple command-line tool to make DNS lookups to the specified server using any protocol: DNS, DOH, DOT, DNSCrypt. @@ -15,6 +15,9 @@ description: | DNS-over-HTTPS: `./dnslookup example.org https://dns.adguard.com/dns-query` + DNS-over-QUIC: + `./dnslookup example.org quic://dns.adguard.com` + Machine-readable format: `JSON=1 ./dnslookup example.org 94.140.14.14` @@ -32,7 +35,7 @@ parts: build-snaps: [ go ] build-packages: [ git, build-essential ] override-build: | - VERSION="1.4.7-${SNAP_REVISION}" make + VERSION="1.4.8-${SNAP_REVISION}" make cp dnslookup ${SNAPCRAFT_PART_INSTALL}/ apps: