Test gofmt changes #20
Workflow file for this run
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: Lint and check code for errors | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
- test/** | |
paths: | |
- Payload_Type/thanatos/agent/** | |
- Payload_Type/thanatos/mythic/** | |
- .github/** | |
pull_request: | |
branches: | |
- main | |
- dev | |
paths: | |
- Payload_Type/thanatos/agent/** | |
- Payload_Type/thanatos/mythic/** | |
workflow_call: | |
env: | |
AGENT_CODE: Payload_Type/thanatos/agent | |
MYTHIC_CODE: Payload_Type/thanatos/mythic | |
jobs: | |
syntax: | |
name: Check Syntax | |
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: Check Mythic code for errors | |
working-directory: ${{ env.MYTHIC_CODE }} | |
run: gofmt -e . 1>/dev/null | |
- name: Check Agent code for errors | |
working-directory: ${{ env.AGENT_CODE }} | |
run: | | |
make genconfig | |
env SRC_CONFIG=$(pwd)/.config CONFIG=$(pwd)/.config.bin cargo check --color always --workspace --exclude genconfig --all-targets --all-features | |
format: | |
name: Check Formatting | |
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: Check Mythic code formatting | |
working-directory: ${{ env.MYTHIC_CODE }} | |
run: gofmt -l -d . | diff -u /dev/null - | |
- name: Check Agent code formatting | |
working-directory: ${{ env.AGENT_CODE }} | |
run: cargo fmt --all -- --color always --check | |
lint: | |
name: Lint Code | |
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: Install Clippy | |
run: rustup component add clippy | |
- name: Lint Mythic code with golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest | |
working-directory: ${{ env.MYTHIC_CODE }} | |
- name: Lint Agent code with clippy | |
working-directory: ${{ env.AGENT_CODE }} | |
run: cargo clippy --color always --all-features --all-targets -- -D warnings |