Skip to content

Commit

Permalink
Add testing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
MEhrn00 committed Feb 6, 2024
1 parent cb2a35e commit b6047b7
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 4 deletions.
File renamed without changes.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup environment
uses: ./.github/actions/setup-lint
uses: ./.github/actions/setup-env
with:
agent-code: ${{ env.AGENT_CODE }}
mythic-code: ${{ env.MYTHIC_CODE }}
Expand All @@ -60,7 +60,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup environment
uses: ./.github/actions/setup-lint
uses: ./.github/actions/setup-env
with:
agent-code: ${{ env.AGENT_CODE }}
mythic-code: ${{ env.MYTHIC_CODE }}
Expand All @@ -82,7 +82,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup environment
uses: ./.github/actions/setup-lint
uses: ./.github/actions/setup-env
with:
agent-code: ${{ env.AGENT_CODE }}
mythic-code: ${{ env.MYTHIC_CODE }}
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Run tests

on:
push:
branches:
- main
- dev
- test/**
paths:
- Payload_Type/thanatos/agent/**
- Payload_Type/thanatos/mythic/**
- .github/**

workflow_call:

env:
AGENT_CODE: Payload_Type/thanatos/agent
MYTHIC_CODE: Payload_Type/thanatos/mythic


jobs:
agent:
name: Agent tests
runs-on: ubuntu-latest

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

- name: Setup environment
uses: ./.github/actions/setup-env
with:
agent-code: ${{ env.AGENT_CODE }}
mythic-code: ${{ env.MYTHIC_CODE }}

- name: Run agent tests
working-directory: ${{ env.AGENT_CODE }}
run: |
make genconfig
env CONFIG=$(pwd)/.config.bin cargo test --color always --workspace --exclude genconfig --all-targets --all-features
commands:
name: Run Mythic command tests
runs-on: ubuntu-latest

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

- name: Setup environment
uses: ./.github/actions/setup-lint
with:
agent-code: ${{ env.AGENT_CODE }}
mythic-code: ${{ env.MYTHIC_CODE }}

- name: Run command tests
working-directory: ${{ env.MYTHIC_CODE }}
run: go test ./commands/...

mockbuild:
name: Run payload mock build tests
runs-on: ubuntu-latest

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

- name: Setup environment
uses: ./.github/actions/setup-lint
with:
agent-code: ${{ env.AGENT_CODE }}
mythic-code: ${{ env.MYTHIC_CODE }}

- name: Run mockbuild tests
working-directory: ${{ env.MYTHIC_CODE }}
run: go test -run "^TestPayloadMockBuild/" ./builder
2 changes: 1 addition & 1 deletion Payload_Type/thanatos/agent/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ endef


$(SRC_CONFIG):
@echo '$(subst $(newline),\n,${DEFAULT_CONFIG})' > $(SRC_CONFIG)
@echo -e '$(subst $(newline),\n,${DEFAULT_CONFIG})' > $(SRC_CONFIG)

$(CONFIG): $(SRC_CONFIG)
SRC_CONFIG=$(SRC_CONFIG) CONFIG=$(CONFIG) cargo build -p genconfig
Expand Down

0 comments on commit b6047b7

Please sign in to comment.