-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from projectdiscovery/dev
v1.0.7 Release preparation
- Loading branch information
Showing
23 changed files
with
822 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,40 @@ | ||
name: 🌥 Docker Push | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_run: | ||
workflows: ["🎉 Release Binary"] | ||
types: | ||
- completed | ||
workflow_dispatch: | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
- name: Git Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up QEMU | ||
|
||
- name: Get Github tag | ||
id: meta | ||
run: | | ||
echo "::set-output name=tag::$(curl --silent "https://api.github.com/repos/projectdiscovery/dnsx/releases/latest" | jq -r .tag_name)" | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to DockerHub | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
- | ||
name: Build and push | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64,linux/arm | ||
push: true | ||
tags: projectdiscovery/dnsx:latest | ||
tags: projectdiscovery/dnsx:latest,projectdiscovery/dnsx:${{ steps.meta.outputs.tag }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: 🧪 Functional Test | ||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
|
||
jobs: | ||
functional: | ||
name: Functional Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Functional Tests | ||
run: | | ||
chmod +x run.sh | ||
bash run.sh | ||
working-directory: cmd/functional-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
cmd/dnsx/dnsx | ||
.DS_Store | ||
dist/ | ||
dist/ | ||
cmd/functional-test/dnsx_dev | ||
cmd/functional-test/functional-test | ||
cmd/functional-test/dnsx | ||
cmd/functional-test/log.txt | ||
cmd/functional-test/*.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,35 @@ | ||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- binary: dnsx | ||
main: cmd/dnsx/dnsx.go | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- 386 | ||
- arm | ||
- arm64 | ||
|
||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- windows | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- 386 | ||
- arm | ||
- arm64 | ||
|
||
ignore: | ||
- goos: darwin | ||
goarch: '386' | ||
- goos: windows | ||
goarch: 'arm' | ||
- goos: windows | ||
goarch: 'arm64' | ||
|
||
binary: '{{ .ProjectName }}' | ||
main: cmd/dnsx/dnsx.go | ||
|
||
archives: | ||
- id: tgz | ||
format: tar.gz | ||
replacements: | ||
darwin: macOS | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
- format: zip | ||
replacements: | ||
darwin: macOS | ||
|
||
checksum: | ||
algorithm: sha256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package main | ||
|
||
import ( | ||
"bufio" | ||
"flag" | ||
"fmt" | ||
"log" | ||
"os" | ||
"strings" | ||
|
||
"github.com/logrusorgru/aurora" | ||
"github.com/pkg/errors" | ||
|
||
"github.com/projectdiscovery/dnsx/internal/testutils" | ||
) | ||
|
||
var ( | ||
debug = os.Getenv("DEBUG") == "true" | ||
success = aurora.Green("[✓]").String() | ||
failed = aurora.Red("[✘]").String() | ||
errored = false | ||
|
||
mainDnsxBinary = flag.String("main", "", "Main Branch Dnsx Binary") | ||
devDnsxBinary = flag.String("dev", "", "Dev Branch Dnsx Binary") | ||
testcases = flag.String("testcases", "", "Test cases file for dnsx functional tests") | ||
) | ||
|
||
func main() { | ||
flag.Parse() | ||
|
||
if err := runFunctionalTests(); err != nil { | ||
log.Fatalf("Could not run functional tests: %s\n", err) | ||
} | ||
if errored { | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func runFunctionalTests() error { | ||
file, err := os.Open(*testcases) | ||
if err != nil { | ||
return errors.Wrap(err, "could not open test cases") | ||
} | ||
defer file.Close() | ||
|
||
scanner := bufio.NewScanner(file) | ||
for scanner.Scan() { | ||
text := strings.TrimSpace(scanner.Text()) | ||
if text == "" { | ||
continue | ||
} | ||
if err := runIndividualTestCase(text); err != nil { | ||
errored = true | ||
fmt.Fprintf(os.Stderr, "%s Test \"%s\" failed: %s\n", failed, text, err) | ||
} else { | ||
fmt.Printf("%s Test \"%s\" passed!\n", success, text) | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func runIndividualTestCase(testcase string) error { | ||
parts := strings.Fields(testcase) | ||
|
||
var finalArgs []string | ||
var target string | ||
if len(parts) > 1 { | ||
finalArgs = parts[2:] | ||
target = parts[0] | ||
} | ||
mainOutput, err := testutils.RunDnsxBinaryAndGetResults(target, *mainDnsxBinary, debug, finalArgs) | ||
if err != nil { | ||
return errors.Wrap(err, "could not run dnsx main test") | ||
} | ||
devOutput, err := testutils.RunDnsxBinaryAndGetResults(target, *devDnsxBinary, debug, finalArgs) | ||
if err != nil { | ||
return errors.Wrap(err, "could not run dnsx dev test") | ||
} | ||
if len(mainOutput) == len(devOutput) { | ||
return nil | ||
} | ||
return fmt.Errorf("%s main is not equal to %s dev", mainOutput, devOutput) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
echo 'Building functional-test binary' | ||
go build | ||
|
||
echo 'Building DNSX binary from current branch' | ||
go build -o dnsx_dev ../dnsx | ||
|
||
echo 'Installing latest release of DNSX' | ||
GO111MODULE=on go build -v github.com/projectdiscovery/dnsx/cmd/dnsx | ||
|
||
echo 'Starting DNSX functional test' | ||
./functional-test -main ./dnsx -dev ./dnsx_dev -testcases testcases.txt |
Oops, something went wrong.