Skip to content

Commit

Permalink
remove travis, add GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ameshkov committed Apr 4, 2021
1 parent 49ab796 commit b0feb9b
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 40 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
# This field is required. Dont set the patch version to always use
# the latest patch version.
version: v1.38
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
7 changes: 5 additions & 2 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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`
Expand All @@ -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:
Expand Down

0 comments on commit b0feb9b

Please sign in to comment.