Skip to content

build(deps): bump github.com/coredns/coredns from 1.8.4 to 1.11.2 #89

build(deps): bump github.com/coredns/coredns from 1.8.4 to 1.11.2

build(deps): bump github.com/coredns/coredns from 1.8.4 to 1.11.2 #89

Workflow file for this run

name: coredns-dnsredir auto build
on:
push:
branches: [ master, dev ]
paths:
- '**.go'
- '**.h'
- '**.c'
- '**.sh'
- '**.yml'
- '**.mod'
pull_request:
branches: [ master ]
workflow_dispatch:
branches: [ master ]
release:
types: [ created ]
jobs:
build-on-linux:
#if: 'false'
name: Build on Linux
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Prepare CoreDNS for dnsredir plugin
run: |
set -eufxo pipefail
whoami
nproc
uname -v
DNSREDIR_DIR=$PWD
REPO_ADDR=$(git remote get-url origin | sed -e 's/^https:\/\///' -e 's/\.git//')
HEAD_COMMIT=$(git describe --dirty --always)
DNSREDIR_TAG=$(curl -sL https://api.github.com/repos/leiless/dnsredir/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
COREDNS_URL=https://github.com/coredns/coredns.git
COREDNS_DIR=coredns
COREDNS_TAG=$(curl -sL https://api.github.com/repos/coredns/coredns/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
git clone --branch $COREDNS_TAG --depth 1 $COREDNS_URL $COREDNS_DIR 2> /dev/null
mkdir -p ~/go/pkg/mod/github.com/leiless
# Link leiless/dnsredir to latest master tree.
ln -s $DNSREDIR_DIR ~/go/pkg/mod/github.com/leiless/dnsredir@$DNSREDIR_TAG
pushd $COREDNS_DIR
sed -i "s|forward:forward|dnsredir:$REPO_ADDR\nforward:forward|g" plugin.cfg
sed -i "s|GITCOMMIT:=|CUSTOM_FLAGS=-X $REPO_ADDR.pluginVersion=$DNSREDIR_TAG -X $REPO_ADDR.pluginHeadCommit=$HEAD_COMMIT\nGITCOMMIT:=|g" Makefile
sed -i 's|$(GITCOMMIT)|$(GITCOMMIT) $(CUSTOM_FLAGS)|g' Makefile
go generate coredns.go
git diff
git status
go get
popd
- name: Debug build ${{ env.GOOS }}-${{ env.GOARCH }}
env:
GOOS: linux
GOARCH: amd64
# Disable code optimization
CGO_CFLAGS: -g -O0 -DDEBUG
CGO_CXXFLAGS: -g -O0 -DDEBUG
run: |
set -eufxo pipefail
COREDNS_DIR=coredns
pushd $COREDNS_DIR
# Temporary fix to the 'missing go.sum entry for module providing package ...' bug
# see: https://github.com/golang/go/issues/44129#issuecomment-806400315
make CGO_ENABLED=1 BUILDOPTS="-mod=mod -race" -j$(nproc)
./coredns -plugins | grep -q dns.dnsredir$
popd
- name: Debug build for release ${{ env.GOOS }}-${{ env.GOARCH }}
if: startsWith(github.ref, 'refs/tags/')
env:
GOOS: linux
GOARCH: amd64
run: |
set -eufxo pipefail
COREDNS_DIR=coredns
pushd $COREDNS_DIR
mkdir bin
mv coredns bin/coredns-dnsredir-$GOOS-$GOARCH-debug
popd
- name: Release build ${{ env.GOOS }}-${{ env.GOARCH }}
if: startsWith(github.ref, 'refs/tags/')
env:
GOOS: linux
GOARCH: amd64
run: |
set -eufxo pipefail
COREDNS_DIR=coredns
pushd $COREDNS_DIR
make BUILDOPTS="-mod=mod" -j$(nproc)
mv coredns bin/coredns-dnsredir-$GOOS-$GOARCH
popd
- name: Release build ${{ env.GOOS }}-${{ env.GOARCH }}
if: startsWith(github.ref, 'refs/tags/')
env:
GOOS: linux
GOARCH: arm64
run: |
set -eufxo pipefail
COREDNS_DIR=coredns
pushd $COREDNS_DIR
make BUILDOPTS="-mod=mod" -j$(nproc)
mv coredns bin/coredns-dnsredir-$GOOS-$GOARCH
popd
- name: Release build ${{ env.GOOS }}-${{ env.GOARCH }}
if: startsWith(github.ref, 'refs/tags/')
env:
GOOS: windows
GOARCH: amd64
run: |
set -eufxo pipefail
COREDNS_DIR=coredns
pushd $COREDNS_DIR
make BUILDOPTS="-mod=mod" -j$(nproc)
mv coredns bin/coredns-dnsredir-$GOOS-$GOARCH.exe
popd
- name: Packaging
if: startsWith(github.ref, 'refs/tags/')
run: |
set -eufxo pipefail
COREDNS_DIR=coredns
pushd $COREDNS_DIR/bin
ls -1 | xargs -I{} bash -c "zip -qr9 {}.zip {} && shasum -a 256 {}.zip > {}.zip.shasum256 && rm {}"
ls -l
popd
- name: Upload files
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: true
fail_on_unmatched_files: true
files: |
coredns/bin/*.zip
coredns/bin/*.zip.shasum256
build-on-darwin:
#if: 'false'
name: Build on Darwin
runs-on: macos-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Hack macOS 10.x to allow arm64 build support
run: |
if [ "$(sw_vers -productVersion | cut -d'.' -f1)" = 10 ]; then
pushd /Library/Developer/CommandLineTools/SDKs
sudo rm MacOSX.sdk
sudo ln -s MacOSX11.1.sdk MacOSX.sdk
sudo rm -rf MacOSX10.15.sdk
ls -l
popd
fi
- name: Prepare CoreDNS for dnsredir plugin
env:
BYPASS_GH_API_RATE_LIMIT: ${{ secrets.BYPASS_GH_API_RATE_LIMIT }}
run: |
set -eufxo pipefail
whoami
sysctl -n hw.model
sysctl -n hw.ncpu
sysctl -n hw.memsize
sysctl -n machdep.cpu.brand_string
sw_vers
uname -v
xcode-select -p
xcodebuild -version
GH_API_CRED=$GITHUB_ACTOR:$BYPASS_GH_API_RATE_LIMIT
DNSREDIR_DIR=$PWD
REPO_ADDR=$(git remote get-url origin | sed -e 's/^https:\/\///' -e 's/\.git//')
HEAD_COMMIT=$(git describe --dirty --always)
# GH#18: Fix macOS GitHub API access rate limit
DNSREDIR_TAG=$(curl -sL -u $GH_API_CRED https://api.github.com/repos/leiless/dnsredir/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
pushd pf
./download-pf-headers.sh
popd
COREDNS_URL=https://github.com/coredns/coredns.git
COREDNS_DIR=coredns
COREDNS_TAG=$(curl -sL -u $GH_API_CRED https://api.github.com/repos/coredns/coredns/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
git clone --branch $COREDNS_TAG --depth 1 $COREDNS_URL $COREDNS_DIR 2> /dev/null
mkdir -p ~/go/pkg/mod/github.com/leiless
# Link leiless/dnsredir to latest master tree.
ln -s $DNSREDIR_DIR ~/go/pkg/mod/github.com/leiless/dnsredir@$DNSREDIR_TAG
# BSD sed sucks!
brew install gnu-sed
pushd $COREDNS_DIR
gsed -i "s|forward:forward|dnsredir:$REPO_ADDR\nforward:forward|g" plugin.cfg
gsed -i "s|GITCOMMIT:=|CUSTOM_FLAGS=-X $REPO_ADDR.pluginVersion=$DNSREDIR_TAG -X $REPO_ADDR.pluginHeadCommit=$HEAD_COMMIT\nGITCOMMIT:=|g" Makefile
gsed -i 's|$(GITCOMMIT)|$(GITCOMMIT) $(CUSTOM_FLAGS)|g' Makefile
go generate coredns.go
git diff
git status
go get
popd
- name: Debug build ${{ env.GOOS }}-${{ env.GOARCH }}
env:
GOOS: darwin
GOARCH: amd64
CGO_CFLAGS: -g -O0 -DDEBUG
CGO_CXXFLAGS: -g -O0 -DDEBUG
run: |
set -eufxo pipefail
COREDNS_DIR=coredns
pushd $COREDNS_DIR
make CGO_ENABLED=1 BUILDOPTS="-race" -j$(sysctl -n hw.ncpu)
./coredns -plugins | grep -q dns.dnsredir$
popd
- name: Debug build for release ${{ env.GOOS }}-${{ env.GOARCH }}
if: startsWith(github.ref, 'refs/tags/')
env:
GOOS: darwin
GOARCH: amd64
run: |
set -eufxo pipefail
COREDNS_DIR=coredns
pushd $COREDNS_DIR
mkdir bin
mv coredns bin/coredns-dnsredir-$GOOS-$GOARCH-debug
popd
- name: Release build ${{ env.GOOS }}-${{ env.GOARCH }}
if: startsWith(github.ref, 'refs/tags/')
env:
GOOS: darwin
GOARCH: amd64
run: |
set -eufxo pipefail
COREDNS_DIR=coredns
pushd $COREDNS_DIR
make CGO_ENABLED=1 -j$(sysctl -n hw.ncpu)
mv coredns bin/coredns-dnsredir-$GOOS-$GOARCH
popd
- name: Release build ${{ env.GOOS }}-${{ env.GOARCH }}
if: startsWith(github.ref, 'refs/tags/')
env:
GOOS: darwin
GOARCH: arm64
run: |
set -eufxo pipefail
COREDNS_DIR=coredns
pushd $COREDNS_DIR
make CGO_ENABLED=1 -j$(sysctl -n hw.ncpu)
mv coredns bin/coredns-dnsredir-$GOOS-$GOARCH
popd
- name: Packaging
if: startsWith(github.ref, 'refs/tags/')
run: |
set -eufxo pipefail
COREDNS_DIR=coredns
pushd $COREDNS_DIR/bin
ls -1 | xargs -I{} bash -c "zip -qr9 {}.zip {} && shasum -a 256 {}.zip > {}.zip.shasum256 && rm {}"
ls -l
popd
- name: Upload files
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: true
fail_on_unmatched_files: true
files: |
coredns/bin/*.zip
coredns/bin/*.zip.shasum256