Skip to content

Added working apktool and refactored libs #16

Added working apktool and refactored libs

Added working apktool and refactored libs #16

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 given tool
run: |
exit 1
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: `${{ github.action_status }}`
- 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: ${{ github.action_status == 'fail' }}
run: |
exit 1