Skip to content

Commit

Permalink
workflow update (#29)
Browse files Browse the repository at this point in the history
* workflow update

* misc update

* fix tests

---------

Co-authored-by: Doğan Can Bakır <dogancanbakir@protonmail.com>
  • Loading branch information
ehsandeep and dogancanbakir committed Oct 11, 2023
1 parent 8ee0275 commit ce060c0
Show file tree
Hide file tree
Showing 12 changed files with 138 additions and 16 deletions.
45 changes: 45 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:

# Maintain dependencies for go modules
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
target-branch: "main"
commit-message:
prefix: "chore"
include: "scope"
labels:
- "Type: Maintenance"
allow:
- dependency-name: "github.com/projectdiscovery/*"

# # Maintain dependencies for docker
# - package-ecosystem: "docker"
# directory: "/"
# schedule:
# interval: "weekly"
# target-branch: "dev"
# commit-message:
# prefix: "chore"
# include: "scope"
# labels:
# - "Type: Maintenance"
#
# # Maintain dependencies for GitHub Actions
# - package-ecosystem: "github-actions"
# directory: "/"
# schedule:
# interval: "weekly"
# target-branch: "dev"
# commit-message:
# prefix: "chore"
# include: "scope"
# labels:
# - "Type: Maintenance"
17 changes: 17 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
changelog:
exclude:
authors:
- dependabot
categories:
- title: 🎉 New Features
labels:
- "Type: Enhancement"
- title: 🐞 Bugs Fixes
labels:
- "Type: Bug"
- title: 🔨 Maintenance
labels:
- "Type: Maintenance"
- title: Other Changes
labels:
- "*"
6 changes: 3 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
pull_request:
branches:
- dev
- main
paths:
- '**.go'
- '**.mod'
Expand All @@ -14,8 +14,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-12]
go-version: [1.19.x, 1.20.x]
os: [ubuntu-latest, windows-latest, macOS-latest]
go-version: [1.20.x]
steps:
- name: Set up Go
uses: actions/setup-go@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
pull_request:
branches:
- dev
- main
paths:
- '**.go'
- '**.mod'
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/dep-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 🤖 dep auto merge

on:
pull_request:
branches:
- main
workflow_dispatch:

permissions:
pull-requests: write
issues: write
repository-projects: write

jobs:
automerge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.DEPENDABOT_PAT }}

- uses: ahmadnassri/action-dependabot-auto-merge@v2
with:
github-token: ${{ secrets.DEPENDABOT_PAT }}
target: all
4 changes: 2 additions & 2 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
pull_request:
branches:
- dev
- main
paths:
- '**.go'
- '**.mod'
Expand All @@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: 1.20.x
cache: true

- name: Run golangci-lint
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ jobs:
release:
runs-on: ubuntu-latest-16-cores
steps:
- name: "Check out code"
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: "Set up Go"
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: 1.20.x
cache: true

- name: "Create release on GitHub"
uses: goreleaser/goreleaser-action@v4
with:
args: "release --rm-dist"
args: "release --clean"
version: latest
workdir: .
env:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 🔨 Release Test

on:
pull_request:
paths:
- '**.go'
- '**.mod'
- '**.yml'
workflow_dispatch:

jobs:
release-test:
runs-on: ubuntu-latest-16-cores
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x

- name: release test
uses: goreleaser/goreleaser-action@v4
with:
args: "release --clean --snapshot"
version: latest
workdir: .
7 changes: 4 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ builds:
- arm64

ignore:
- goos: darwin
goarch: 386
- goos: windows
goarch: arm
- goos: windows
Expand All @@ -26,8 +28,7 @@ builds:

archives:
- format: zip
replacements:
darwin: macOS
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ if eq .Os "darwin" }}macOS{{ else }}{{ .Os }}{{ end }}_{{ .Arch }}'

checksum:
algorithm: sha256
Expand All @@ -37,7 +38,7 @@ announce:
enabled: true
channel: '#release'
username: GoReleaser
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
message_template: 'New Release: {{ .ProjectName }} {{.Tag}} is published! Check it out at {{ .ReleaseURL }}'

discord:
enabled: true
Expand Down
5 changes: 3 additions & 2 deletions inputs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ func TestExtractVar(t *testing.T) {
}{
{statement: "{{sub}}.something.{{tld}}", expected: []string{"sub", "tld"}},
{statement: "{{sub}}.{{sub1}}.{{sub2}}.{{root}}", expected: []string{"sub", "sub1", "sub2", "root"}},
{statement: "no variables", expected: []string{}},
{statement: "no variables", expected: nil},
}
for _, v := range testcases {
require.Equal(t, v.expected, getAllVars(v.statement))
actual := getAllVars(v.statement)
require.Equal(t, v.expected, actual)
}
}
2 changes: 1 addition & 1 deletion internal/runner/banner.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var banner = `
/_/ |_/_/\__/\__/_/ /_/|_|
`

var version = "v0.0.2"
var version = "v0.0.3"

// showBanner is used to show the banner to the user
func showBanner() {
Expand Down
2 changes: 2 additions & 0 deletions mutator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package alterx

import (
"bytes"
"math"
"strings"
"testing"

Expand Down Expand Up @@ -39,6 +40,7 @@ func TestMutatorResults(t *testing.T) {
}
opts.Patterns = testConfig.Patterns
opts.Payloads = testConfig.Payloads
opts.MaxSize = math.MaxInt
m, err := New(opts)
require.Nil(t, err)
var buff bytes.Buffer
Expand Down

0 comments on commit ce060c0

Please sign in to comment.