Added working and tested base for impacket, smbserver and fixed an is… #24
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: Verify Pull Request | |
on: | |
pull_request: | |
env: | |
TOOL_DIR: tools | |
jobs: | |
pre-configure: | |
runs-on: ubuntu-latest | |
outputs: | |
tools_matrix: ${{ steps.set-matrix.outputs.tools_matrix }} | |
steps: | |
- name: Checkout to repository | |
uses: actions/checkout@v3 | |
- name: Set tools matrix data | |
id: set-matrix | |
run: echo "tools_matrix=$(jq -c . < ./tools.json)" >> $GITHUB_OUTPUT | |
basic-test-tools: | |
runs-on: ubuntu-20.04 | |
needs: pre-configure | |
strategy: | |
matrix: ${{ fromJson(needs.pre-configure.outputs.tools_matrix) }} | |
env: | |
DOCKER_NETWORK_TYPE: none | |
DEBIAN_FRONTEND: noninteractive | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Test - check if proper files exist | |
uses: andstor/file-existence-action@v3 | |
with: | |
fail: true | |
files: | | |
${{ env.TOOL_DIR }}/${{ matrix.tool_name }}/README.md, | |
${{ env.TOOL_DIR }}/${{ matrix.tool_name }}/Dockerfile, | |
${{ env.TOOL_DIR }}/${{ matrix.tool_name }}/test.sh | |
- name: test-list-available-tools | |
run: | | |
$GITHUB_WORKSPACE/c4p.sh --list | |
- name: test-unexisting-tool | |
run: | | |
echo $( $GITHUB_WORKSPACE/c4p.sh --log-level 4 --tool unexisting || true ) | tee console.txt; \ | |
[ -s $GITHUB_WORKSPACE/console.txt ] && grep -q "unexisting" console.txt | |
- name: test-logging-to-file | |
run: | | |
echo $( $GITHUB_WORKSPACE/c4p.sh --log-level 4 --log-file logs.txt --tool unexisting || true ) | tee console.txt; \ | |
[ -s $GITHUB_WORKSPACE/logs.txt ] && [ -s $GITHUB_WORKSPACE/console.txt ] | |
- name: test-logging-only-to-file | |
run: | | |
echo $( $GITHUB_WORKSPACE/c4p.sh --log-level 4 --log-file logs.txt --only-log-file --tool unexisting || true ) | tee console.txt; \ | |
[ -s $GITHUB_WORKSPACE/logs.txt ] && ! grep -q '[^[:space:]]' $GITHUB_WORKSPACE/console.txt | |
test-install-all-tools: | |
runs-on: ubuntu-latest | |
needs: basic-test-tools | |
env: | |
DOCKER_NETWORK_TYPE: none | |
DEBIAN_FRONTEND: noninteractive | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Test - install all tools | |
run: | | |
$GITHUB_WORKSPACE/c4p.sh --fail --log-level 1 --log-file $GITHUB_WORKSPACE/c4p-logs.txt -t all | |
after-tests-notification: | |
name: Send notifications after the job is finished | |
env: | |
IS_TELEGRAM_TOKEN_SET: ${{ secrets.TELEGRAM_TOKEN != '' }} | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
needs: [basic-test-tools, test-install-all-tools] | |
steps: | |
- name: Telegram notification | |
if: ${{ env.IS_TELEGRAM_TOKEN_SET == 'true' }} | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_TO }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
format: markdown | |
message: | | |
*Workflow* `${{ github.workflow }}` *for PR ${{ github.event.number }} finished!* | |
*Info:* | |
- Job status: `${{ (job.status == 'success' && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')) && 'success' || 'failure' }}` | |
- Branch: [${{ github.head_ref }}](https://github.com/${{ github.repository }}/tree/${{ github.head_ref }}) | |
- Job started by: `${{ github.actor }}` | |
- Repository: [${{ github.repository }}](https://github.com/${{ github.repository }}) | |
See changes: [Pull Request ${{ github.event.number }}](https://github.com/${{ github.repository }}/pull/${{ github.event.number }}) | |
- name: Set action status - fail if any previous job failed | |
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} | |
run: | | |
exit 1 |