Cyber Roles Testing #80
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 💙" } | |
- { role: "bugbounty", job_name: "🐞 Bug Bounty Hunter 🐞" } | |
- { role: "cracker", job_name: "🍘 Cracker Specialist 🍘" } | |
- { role: "dos", job_name: "💀 DoS Tester 💀" } | |
- { role: "student", job_name: "🎓 Enthusiast Student 🎓" } | |
- { role: "forensic", job_name: "🔍 Forensic Analyst 🔍" } | |
- { role: "malware", job_name: "🦠 Malware Analyst 🦠" } | |
- { role: "mobile", job_name: "📱 Mobile Analyst 📱" } | |
- { role: "network", job_name: "🌐 Network Analyst 🌐" } | |
- { role: "osint", job_name: "🕵️ OSINT Specialist 🕵️" } | |
- { role: "red", job_name: "❤️ Red Teamer ❤️" } | |
- { role: "web", job_name: "🕸️ Web Pentester 🕸️" } | |
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 💙" } | |
- { role: "bugbounty", job_name: "🐞 Bug Bounty Hunter 🐞" } | |
- { role: "cracker", job_name: "🍘 Cracker Specialist 🍘" } | |
- { role: "dos", job_name: "💀 DoS Tester 💀" } | |
- { role: "student", job_name: "🎓 Enthusiast Student 🎓" } | |
- { role: "forensic", job_name: "🔍 Forensic Analyst 🔍" } | |
- { role: "malware", job_name: "🦠 Malware Analyst 🦠" } | |
- { role: "mobile", job_name: "📱 Mobile Analyst 📱" } | |
- { role: "network", job_name: "🌐 Network Analyst 🌐" } | |
- { role: "osint", job_name: "🕵️ OSINT Specialist 🕵️" } | |
- { role: "red", job_name: "❤️ Red Teamer ❤️" } | |
- { role: "web", job_name: "🕸️ Web Pentester 🕸️" } | |
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 }} |