Skip to content

Commit

Permalink
Add action inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
MEhrn00 committed Jan 31, 2024
1 parent d64b36b commit 256be67
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
24 changes: 15 additions & 9 deletions .github/actions/setup-lint/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: Setup lint environment
description: Sets up an environment for running checks
inputs:
python-requirements:
description: Path to the requiremets.txt for python packages
required: true

agent-code:
description: Path to the agent code
required: true

runs:
using: "composite"
Expand All @@ -11,27 +19,25 @@ runs:
cache: 'pip'

- name: Install Python packages
working-directory: ${{ env.THANATOS_PATH }}
shell: bash
run: |
pip install -r requirements.txt
pip install -r ${{ inputs.python-requirements }}
pip install pylint black
- name: Setup cargo cache
uses: actions/cache@v4
working-directory: ${{ env.AGENT_CODE }}
with:
path: ~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }}
key: ${{ runner.os }}-cargo-${{ hashFiles(format('{0}/Cargo.toml', inputs.agent-code)) }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }}
${{ runner.os }}-cargo-${{ hashFiles(format('{0}/Cargo.toml', inputs.agent-code)) }}
${{ runner.os }}-cargo
- name: Setup cargo target cache
uses: actions/cache@v4
working-directory: ${{ env.AGENT_CODE }}
with:
path: target
key: ${{ runner.os }}-cargo-target-${{ hashFiles('Cargo.toml') }}
path: ${{ inputs.AGENT_CODE }}/target
key: ${{ runner.os }}-cargo-target-${{ hashFiles(format('{0}/Cargo.toml', inputs.agent-code)) }}
restore-keys: |
${{ runner.os }}-cargo-target-${{ hashFiles('Cargo.toml') }}
${{ runner.os }}-cargo-target-${{ hashFiles(format('{0}/Cargo.toml', inputs.agent-code)) }}
${{ runner.os }}-cargo-target
13 changes: 11 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:

- name: Setup environment
uses: ./.github/actions/setup-lint
with:
python-requirements: ${{ env.THANATOS_PATH }}/requirements.txt
agent-code: ${{ env.AGENT_CODE }}

- name: Check Mythic code for errors
run: python -m pylint -f colorized --errors-only ${THANATOS_PATH}/*.py ${MYTHIC_CODE}/*.py
Expand All @@ -57,7 +60,10 @@ jobs:
uses: actions/checkout@v4

- name: Setup environment
uses: ./.github/workflows/lint-setup
uses: ./.github/actions/setup-lint
with:
python-requirements: ${{ env.THANATOS_PATH }}/requirements.txt
agent-code: ${{ env.AGENT_CODE }}

- name: Check Mythic code formatting
run: python -m black --color --diff --check ${THANATOS_PATH}/*.py ${MYTHIC_CODE}/*.py
Expand All @@ -82,7 +88,10 @@ jobs:
uses: actions/checkout@v4

- name: Setup environment
uses: ./.github/workflows/lint-setup
uses: ./.github/actions/setup-lint
with:
python-requirements: ${{ env.THANATOS_PATH }}/requirements.txt
agent-code: ${{ env.AGENT_CODE }}

- name: Install Clippy
run: rustup component add clippy
Expand Down

0 comments on commit 256be67

Please sign in to comment.