mirror of
https://github.com/SamTherapy/dnscrypt.git
synced 2024-12-22 00:50:42 +00:00
added github actions
This commit is contained in:
parent
5ddb58f703
commit
d2deac6243
3 changed files with 135 additions and 94 deletions
109
.github/workflows/build.yaml
vendored
Normal file
109
.github/workflows/build.yaml
vendored
Normal file
|
@ -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/dnscrypt-*
|
||||
|
||||
- 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/dnscrypt-*.tar.gz;build/dnscrypt-*.zip"
|
||||
tags: true
|
||||
draft: false
|
26
.github/workflows/lint.yaml
vendored
Normal file
26
.github/workflows/lint.yaml
vendored
Normal file
|
@ -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
|
94
.travis.yml
94
.travis.yml
|
@ -1,94 +0,0 @@
|
|||
language: go
|
||||
sudo: false
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
- windows
|
||||
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
|
||||
go:
|
||||
- 1.x
|
||||
|
||||
before_install:
|
||||
- |-
|
||||
case $TRAVIS_OS_NAME in
|
||||
linux | osx)
|
||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.31.0
|
||||
;;
|
||||
esac
|
||||
|
||||
script:
|
||||
- |-
|
||||
# Fail if any command fails
|
||||
set -e
|
||||
|
||||
case $TRAVIS_OS_NAME in
|
||||
linux | osx)
|
||||
# Run linter
|
||||
golangci-lint run
|
||||
|
||||
# Run tests
|
||||
go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./...
|
||||
|
||||
# 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
|
||||
|
||||
# Linux-arm64 build
|
||||
GOOS=linux GOARCH=arm64 VERSION=${TRAVIS_TAG:-dev} make release
|
||||
|
||||
# Linux-armv6 build
|
||||
GOOS=linux GOARCH=arm GOARM=6 VERSION=${TRAVIS_TAG:-dev} make release
|
||||
|
||||
# Linux-mips build
|
||||
GOOS=linux GOARCH=mips GOMIPS=softfloat VERSION=${TRAVIS_TAG:-dev} make release
|
||||
|
||||
# Linux-mipsle build
|
||||
GOOS=linux GOARCH=mipsle GOMIPS=softfloat VERSION=${TRAVIS_TAG:-dev} make release
|
||||
|
||||
# freebsd-armv6 build
|
||||
GOOS=freebsd GOARCH=arm GOARM=6 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/dnscrypt-*
|
||||
;;
|
||||
windows)
|
||||
# Run tests
|
||||
go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./...
|
||||
;;
|
||||
esac
|
||||
|
||||
after_success:
|
||||
- |-
|
||||
case $TRAVIS_OS_NAME in
|
||||
linux)
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
;;
|
||||
esac
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key: $GITHUB_TOKEN
|
||||
file:
|
||||
- build/dnscrypt-*.zip
|
||||
- build/dnscrypt-*.tar.gz
|
||||
on:
|
||||
repo: ameshkov/dnscrypt
|
||||
tags: true
|
||||
condition: $TRAVIS_OS_NAME = linux
|
||||
file_glob: true
|
||||
skip_cleanup: true
|
Loading…
Reference in a new issue