Cyber Roles Testing #91
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
name: Cyber Roles Testing | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 16 */1 * *' | |
jobs: | |
arch-role-testing: | |
runs-on: ubuntu-latest | |
container: | |
image: athenaos/base-devel:latest | |
options: --privileged | |
strategy: | |
fail-fast: false # Ensure all matrix jobs continue even if one fails | |
matrix: | |
role_installer: | |
- { role: "blue", job_name: "💙 Blue Teamer 💙 Arch" } | |
- { role: "bugbounty", job_name: "🐞 Bug Bounty Hunter 🐞 Arch" } | |
- { role: "cracker", job_name: "🍘 Cracker Specialist 🍘 Arch" } | |
- { role: "dos", job_name: "💀 DoS Tester 💀 Arch" } | |
- { role: "student", job_name: "🎓 Enthusiast Student 🎓 Arch" } | |
- { role: "forensic", job_name: "🔍 Forensic Analyst 🔍 Arch" } | |
- { role: "malware", job_name: "🦠 Malware Analyst 🦠 Arch" } | |
- { role: "mobile", job_name: "📱 Mobile Analyst 📱 Arch" } | |
- { role: "network", job_name: "🌐 Network Analyst 🌐 Arch" } | |
- { role: "osint", job_name: "🕵️ OSINT Specialist 🕵️ Arch" } | |
- { role: "red", job_name: "❤️ Red Teamer ❤️ Arch" } | |
- { role: "web", job_name: "🕸️ Web Pentester 🕸️ Arch" } | |
name: ${{ matrix.role_installer.job_name }} Install # Dynamically assign the job name based on the matrix | |
steps: | |
- name: Install dependencies | |
run: pacman -Syyu --noconfirm cyber-toolkit | |
- name: Install role | |
run: cyber-toolkit ${{ matrix.role_installer.role }} | |
nix-role-testing: | |
runs-on: ubuntu-latest | |
container: | |
image: nixos/nix:latest | |
options: --privileged | |
strategy: | |
fail-fast: false # Ensure all matrix jobs continue even if one fails | |
matrix: | |
role_installer: | |
- { role: "blue", job_name: "💙 Blue Teamer 💙 Nix" } | |
- { role: "bugbounty", job_name: "🐞 Bug Bounty Hunter 🐞 Nix" } | |
- { role: "cracker", job_name: "🍘 Cracker Specialist 🍘 Nix" } | |
- { role: "dos", job_name: "💀 DoS Tester 💀 Nix" } | |
- { role: "student", job_name: "🎓 Enthusiast Student 🎓 Nix" } | |
- { role: "forensic", job_name: "🔍 Forensic Analyst 🔍 Nix" } | |
- { role: "malware", job_name: "🦠 Malware Analyst 🦠 Nix" } | |
- { role: "mobile", job_name: "📱 Mobile Analyst 📱 Nix" } | |
- { role: "network", job_name: "🌐 Network Analyst 🌐 Nix" } | |
- { role: "osint", job_name: "🕵️ OSINT Specialist 🕵️ Nix" } | |
- { role: "red", job_name: "❤️ Red Teamer ❤️ Nix" } | |
- { role: "web", job_name: "🕸️ Web Pentester 🕸️ Nix" } | |
name: ${{ matrix.role_installer.job_name }} Install # Dynamically assign the job name based on the matrix | |
steps: | |
- name: Install role | |
run: | | |
git clone https://github.com/Athena-OS/athena-nix | |
nix-shell --expr '{ pkgs ? import <nixpkgs> { config.allowUnfree = true; } }: pkgs.mkShell { buildInputs = (import ./athena-nix/nixos/modules/cyber/roles/${{ matrix.role_installer.role }}.nix { inherit pkgs; }); }' | |
# Final job to send summary to webhook | |
notify-result: | |
runs-on: ubuntu-latest | |
needs: [arch-role-testing, nix-role-testing] # Wait until all matrix jobs complete | |
if: always() # Ensures this job runs even if any job fails or is canceled | |
steps: | |
- name: Generate Job Results Summary | |
id: generate_summary | |
run: | | |
summary="Job Results:" | |
# Convert the entire 'needs' context to JSON | |
job_data=$(echo '${{ toJSON(needs) }}' | jq .) | |
# Loop over each job and collect the results | |
for job_name in $(echo "$job_data" | jq -r 'keys[]'); do | |
job_result=$(echo "$job_data" | jq -r --arg job "$job_name" '.[$job].result') | |
summary="$summary\n$job_name: $job_result" | |
done | |
# Output the summary to be used in later steps | |
echo "$summary" | |
echo "::set-output name=job-summary::$summary" | |
- name: Send a request to webhook | |
run: | | |
curl -H "Content-Type: application/json" -d '{ | |
"embeds": [{ | |
"type": "rich", | |
"title": "Workflow Actions", | |
"thumbnail": { | |
"url": "https://athenaos.org/_astro/athena-chibi.C4AxdAFD_Z1ifHWb.webp" | |
}, | |
"author": { | |
"name": "${{ github.actor }}", | |
"url": "https://github.com/${{ github.actor }}", | |
"icon_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4" | |
} | |
}], | |
"username": "Athena Git Ninja", | |
"content": "Athena Cyber Roles Test\nBranch: ${{ github.ref }} \nCommit Hash: ${{ github.sha }}\n\n${{ steps.generate_summary.outputs.job-summary }}" | |
}' ${{ secrets.WEBHOOK_URL }} |