mirror of
https://github.com/projectdiscovery/httpx.git
synced 2024-11-24 05:05:54 +03:00
Updating GH workflows + Sonar (#514)
* Updating GH workflows + Sonar * adding missing step to build
This commit is contained in:
parent
09b278bc86
commit
5a562107f4
10
.github/dependabot.yml
vendored
10
.github/dependabot.yml
vendored
@ -15,16 +15,20 @@ updates:
|
|||||||
commit-message:
|
commit-message:
|
||||||
prefix: "chore"
|
prefix: "chore"
|
||||||
include: "scope"
|
include: "scope"
|
||||||
|
labels:
|
||||||
|
- "Type: Maintenance"
|
||||||
|
|
||||||
# Maintain dependencies for go modules
|
# Maintain dependencies for go modules
|
||||||
- package-ecosystem: "gomod"
|
- package-ecosystem: "gomod"
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "weekly"
|
interval: "daily"
|
||||||
target-branch: "dev"
|
target-branch: "dev"
|
||||||
commit-message:
|
commit-message:
|
||||||
prefix: "chore"
|
prefix: "chore"
|
||||||
include: "scope"
|
include: "scope"
|
||||||
|
labels:
|
||||||
|
- "Type: Maintenance"
|
||||||
|
|
||||||
# Maintain dependencies for docker
|
# Maintain dependencies for docker
|
||||||
- package-ecosystem: "docker"
|
- package-ecosystem: "docker"
|
||||||
@ -34,4 +38,6 @@ updates:
|
|||||||
target-branch: "dev"
|
target-branch: "dev"
|
||||||
commit-message:
|
commit-message:
|
||||||
prefix: "chore"
|
prefix: "chore"
|
||||||
include: "scope"
|
include: "scope"
|
||||||
|
labels:
|
||||||
|
- "Type: Maintenance"
|
35
.github/workflows/build-test.yml
vendored
35
.github/workflows/build-test.yml
vendored
@ -5,25 +5,38 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Test Builds
|
name: Test Builds
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
- uses: actions/setup-go@v2
|
|
||||||
with:
|
with:
|
||||||
go-version: 1.17
|
go-version: 1.17
|
||||||
|
|
||||||
- name: Test
|
- name: Check out code
|
||||||
run: go test ./...
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Integration Tests
|
|
||||||
run: bash run.sh
|
|
||||||
working-directory: integration_tests/
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: go build .
|
run: go build .
|
||||||
working-directory: cmd/httpx/
|
working-directory: cmd/httpx/
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: go test ./...
|
||||||
|
working-directory: .
|
||||||
|
|
||||||
|
- name: Integration Tests
|
||||||
|
env:
|
||||||
|
GH_ACTION: true
|
||||||
|
run: bash run.sh
|
||||||
|
working-directory: integration_tests/
|
||||||
|
|
||||||
|
- name: Race Condition Tests
|
||||||
|
run: go build -race .
|
||||||
|
working-directory: cmd/httpx/
|
||||||
|
|
||||||
|
|
||||||
|
1
.github/workflows/codeql-analysis.yml
vendored
1
.github/workflows/codeql-analysis.yml
vendored
@ -2,6 +2,7 @@ name: 🚨 CodeQL Analysis
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
|
8
.github/workflows/functional-test.yml
vendored
8
.github/workflows/functional-test.yml
vendored
@ -4,11 +4,13 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
functional:
|
functional:
|
||||||
name: Functional Test
|
name: Functional Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
@ -21,5 +23,5 @@ jobs:
|
|||||||
- name: Functional Tests
|
- name: Functional Tests
|
||||||
run: |
|
run: |
|
||||||
chmod +x run.sh
|
chmod +x run.sh
|
||||||
bash run.sh
|
bash run.sh ${{ matrix.os }}
|
||||||
working-directory: cmd/functional-test
|
working-directory: cmd/functional-test
|
||||||
|
23
.github/workflows/release-binary.yml
vendored
23
.github/workflows/release-binary.yml
vendored
@ -9,18 +9,21 @@ jobs:
|
|||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: "Check out code"
|
||||||
|
uses: actions/checkout@v2
|
||||||
- uses: actions/setup-go@v2
|
with:
|
||||||
with:
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: "Set up Go"
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
go-version: 1.17
|
go-version: 1.17
|
||||||
|
|
||||||
-
|
- name: "Create release on GitHub"
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
name: "Create release on GitHub"
|
|
||||||
uses: goreleaser/goreleaser-action@v2
|
uses: goreleaser/goreleaser-action@v2
|
||||||
with:
|
with:
|
||||||
args: "release --rm-dist"
|
args: "release --rm-dist"
|
||||||
version: latest
|
version: latest
|
||||||
workdir: .
|
workdir: .
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
38
.github/workflows/sonarcloud.yml
vendored
Normal file
38
.github/workflows/sonarcloud.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
name: 👮🏼♂️ Sonarcloud
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- dev
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sonarcloud:
|
||||||
|
name: SonarCloud
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||||
|
|
||||||
|
- name: "Set up Go"
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.17
|
||||||
|
|
||||||
|
- name: Run unit Tests
|
||||||
|
run: |
|
||||||
|
go test -coverprofile=./cov.out ./...
|
||||||
|
|
||||||
|
- name: Run Gosec Security Scanner
|
||||||
|
run: |
|
||||||
|
go install github.com/securego/gosec/cmd/gosec@latest
|
||||||
|
gosec -no-fail -fmt=sonarqube -out report.json ./...
|
||||||
|
|
||||||
|
- name: SonarCloud Scan
|
||||||
|
uses: SonarSource/sonarcloud-github-action@master
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
@ -1,13 +1,23 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo 'Building functional-test binary'
|
# reading os type from arguments
|
||||||
go build
|
CURRENT_OS=$1
|
||||||
|
|
||||||
echo 'Building HTTPX binary from current branch'
|
if [ "${CURRENT_OS}" == "windows-latest" ];then
|
||||||
go build -o httpx_dev ../httpx
|
extension=.exe
|
||||||
|
fi
|
||||||
|
|
||||||
echo 'Installing latest release of HTTPX'
|
echo "::group::Building functional-test binary"
|
||||||
GO111MODULE=on go build -v github.com/projectdiscovery/httpx/cmd/httpx
|
go build -o functional-test$extension
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo 'Starting HTTPX functional test'
|
echo "::group::Building dnsx binary from current branch"
|
||||||
./functional-test -main ./httpx -dev ./httpx_dev -testcases testcases.txt
|
go build -o httpx_dev$extension ../httpx
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
echo "::group::Building latest release of dnsx"
|
||||||
|
go build -o httpx$extension -v github.com/projectdiscovery/httpx/cmd/httpx
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
echo 'Starting dnsx functional test'
|
||||||
|
./functional-test$extension -main ./httpx$extension -dev ./httpx_dev$extension -testcases testcases.txt
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "::group::Build httpx"
|
||||||
rm integration-test httpx 2>/dev/null
|
rm integration-test httpx 2>/dev/null
|
||||||
cd ../cmd/httpx
|
cd ../cmd/httpx
|
||||||
go build
|
go build
|
||||||
mv httpx ../../integration_tests/httpx
|
mv httpx ../../integration_tests/httpx
|
||||||
|
echo "::endgroup::"
|
||||||
|
echo "::group::Build httpx integration-test"
|
||||||
cd ../integration-test
|
cd ../integration-test
|
||||||
go build
|
go build
|
||||||
mv integration-test ../../integration_tests/integration-test
|
mv integration-test ../../integration_tests/integration-test
|
||||||
cd ../../integration_tests
|
cd ../../integration_tests
|
||||||
|
echo "::endgroup::"
|
||||||
./integration-test
|
./integration-test
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
|
16
sonar-project.properties
Normal file
16
sonar-project.properties
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
sonar.projectKey=projectdiscovery_httpx
|
||||||
|
sonar.organization=projectdiscovery
|
||||||
|
|
||||||
|
# This is the name and version displayed in the SonarCloud UI.
|
||||||
|
#sonar.projectName=dnsx
|
||||||
|
#sonar.projectVersion=1.0
|
||||||
|
|
||||||
|
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
|
||||||
|
sonar.sources=.
|
||||||
|
sonar.tests=.
|
||||||
|
sonar.test.inclusions=**/*_test.go
|
||||||
|
sonar.go.coverage.reportPaths=cov.out
|
||||||
|
sonar.externalIssuesReportPaths=report.json
|
||||||
|
|
||||||
|
# Encoding of the source code. Default is default system encoding
|
||||||
|
#sonar.sourceEncoding=UTF-8
|
Loading…
Reference in New Issue
Block a user