Skip to content

Commit

Permalink
Initial commit of workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismaddalena committed Nov 26, 2024
1 parent 565e3b7 commit 74d656c
Show file tree
Hide file tree
Showing 8 changed files with 340 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/codeql-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master, PRs-Require-Approval, Require-Unit-Tests ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '31 6 * * 4'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
# - name: Autobuild
# uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
28 changes: 28 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Go

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./... -race -covermode=atomic -coverprofile=coverage.out

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
35 changes: 35 additions & 0 deletions .github/workflows/publish-workflow-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Binaries to Release (Linux)

on:
workflow_dispatch:
push:
tags:
- "v*.*.*"

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux]
goarch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set Values
run: echo "VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV && echo "BUILD_DATE=$(date -u '+%d %b %Y')" >> $GITHUB_ENV

- name: Build
uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: "."
binary_name: "bloodhound-cli"
ldflags: -s -w -X "github.com/SpecterOps/BloodHound_CLI/cmd/config.Version=${{ env.VERSION }}" -X "github.com/SpecterOps/BloodHound_CLI/cmd/config.BuildDate=${{ env.BUILD_DATE }}"
release_tag: ${{ github.ref_name }}
overwrite: true
executable_compression: upx --brute
34 changes: 34 additions & 0 deletions .github/workflows/publish-workflow-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish Binaries to Release (macOS)

on:
workflow_dispatch:
push:
tags:
- "v*.*.*"

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
goos: [darwin]
goarch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set Values
run: echo "VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV && echo "BUILD_DATE=$(date -u '+%d %b %Y')" >> $GITHUB_ENV

- name: Build
uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: "."
binary_name: "bloodhound-cli"
ldflags: -s -w -X "github.com/SpecterOps/BloodHound_CLI/cmd/config.Version=${{ env.VERSION }}" -X "github.com/SpecterOps/BloodHound_CLI/cmd/config.BuildDate=${{ env.BUILD_DATE }}"
release_tag: ${{ github.ref_name }}
overwrite: true
35 changes: 35 additions & 0 deletions .github/workflows/publish-workflow-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Binaries to Release (Windows)

on:
workflow_dispatch:
push:
tags:
- "v*.*.*"

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
goos: [windows]
goarch: [amd64]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set Values
run: echo "VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV && echo "BUILD_DATE=$(date -u '+%d %b %Y')" >> $GITHUB_ENV

- name: Build
uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: "."
binary_name: "bloodhound-cli"
ldflags: -s -w -X "github.com/SpecterOps/BloodHound_CLI/cmd/config.Version=${{ env.VERSION }}" -X "github.com/SpecterOps/BloodHound_CLI/cmd/config.BuildDate=${{ env.BUILD_DATE }}"
release_tag: ${{ github.ref_name }}
overwrite: true
executable_compression: upx --brute
46 changes: 46 additions & 0 deletions .github/workflows/rolling-release-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build Rolling Release (Linux)

on:
workflow_dispatch:
push:
branches: [ main ]

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux]
goarch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set Values
run: echo "VERSION=rolling" >> $GITHUB_ENV && echo "BUILD_DATE=$(date -u '+%d %b %Y')" >> $GITHUB_ENV

- name: Build
uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: "."
binary_name: "bloodhound-cli"
ldflags: -s -w -X "github.com/SpecterOps/BloodHound_CLI/cmd/config.Version=${{ env.VERSION }}" -X "github.com/SpecterOps/BloodHound_CLI/cmd/config.BuildDate=${{ env.BUILD_DATE }}"
release_tag: rolling
overwrite: true
executable_compression: upx --brute

- name: Update Rolling Release
uses: softprops/action-gh-release@v2
with:
name: Rolling Release (unstable)
tag_name: rolling
prerelease: true
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
body: |
This is the rolling release of BloodHound CLI compiled from source (${{ github.sha }}).
The repository updates releases automatically to keep them up-to-date with the `${{ github.ref_name }}` ${{ github.ref_type }}.
Releases were last built on ${{ env.BUILD_DATE }}.
45 changes: 45 additions & 0 deletions .github/workflows/rolling-release-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build Rolling Release (macOS)

on:
workflow_dispatch:
push:
branches: [ main ]

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
goos: [darwin]
goarch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set Values
run: echo "VERSION=rolling" >> $GITHUB_ENV && echo "BUILD_DATE=$(date -u '+%d %b %Y')" >> $GITHUB_ENV

- name: Build
uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: "."
binary_name: "bloodhound-cli"
ldflags: -s -w -X "github.com/SpecterOps/BloodHound_CLI/cmd/config.Version=${{ env.VERSION }}" -X "github.com/SpecterOps/BloodHound_CLI/cmd/config.BuildDate=${{ env.BUILD_DATE }}"
release_tag: rolling
overwrite: true

- name: Update Rolling Release
uses: softprops/action-gh-release@v2
with:
name: Rolling Release (unstable)
tag_name: rolling
prerelease: true
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
body: |
This is the rolling release of BloodHound CLI compiled from source (${{ github.sha }}).
The repository updates releases automatically to keep them up-to-date with the `${{ github.ref_name }}` ${{ github.ref_type }}.
Releases were last built on ${{ env.BUILD_DATE }}.
46 changes: 46 additions & 0 deletions .github/workflows/rolling-release-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build Rolling Release (Windows)

on:
workflow_dispatch:
push:
branches: [ main ]

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
goos: [windows]
goarch: [amd64]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set Values
run: echo "VERSION=rolling" >> $GITHUB_ENV && echo "BUILD_DATE=$(date -u '+%d %b %Y')" >> $GITHUB_ENV

- name: Build
uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: "."
binary_name: "bloodhound-cli"
ldflags: -s -w -X "github.com/SpecterOps/BloodHound_CLI/cmd/config.Version=${{ env.VERSION }}" -X "github.com/SpecterOps/BloodHound_CLI/cmd/config.BuildDate=${{ env.BUILD_DATE }}"
release_tag: rolling
overwrite: true
executable_compression: upx --brute

- name: Update Rolling Release
uses: softprops/action-gh-release@v2
with:
name: Rolling Release (unstable)
tag_name: rolling
prerelease: true
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
body: |
This is the rolling release of BloodHound CLI compiled from source (${{ github.sha }}).
The repository updates releases automatically to keep them up-to-date with the `${{ github.ref_name }}` ${{ github.ref_type }}.
Releases were last built on ${{ env.BUILD_DATE }}.

0 comments on commit 74d656c

Please sign in to comment.