**Improve example script for querying risk MMDB with dependencies and tes… #49
This file contains hidden or 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: Test | |
| on: | |
| push: | |
| branches: [latest, main] | |
| paths: | |
| - '**.py' | |
| - '.github/workflows/test.yml' | |
| # - 'requirements_lint.txt' | |
| pull_request: | |
| branches: [latest, main] | |
| paths: | |
| - '**.py' | |
| - '.github/workflows/test.yml' | |
| # - 'requirements_lint.txt' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 1 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.ref }} | |
| - name: Install python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| pip install -r src/riskdb/builder/requirements.txt >/dev/null | |
| pip install -r src/riskdb/api/requirements.txt >/dev/null | |
| sudo apt install curl >/dev/null | |
| shell: bash | |
| - name: Preparing testdata | |
| run: | | |
| unzip -o testdata/asn_full.json.zip | |
| unzip -o testdata/asn_ipv4_full.mmdb.zip | |
| unzip -o testdata/asn_ipv6_full.mmdb.zip | |
| mkdir -p $HOME/Downloads | |
| mv *.json $HOME/Downloads/ | |
| mv *.mmdb $HOME/Downloads/ | |
| shell: bash | |
| - name: Running Builder | |
| run: | | |
| python3 src/riskdb/builder/main.py | |
| shell: bash | |
| - name: Starting API | |
| run: | | |
| timeout 10 python3 src/riskdb/api/main.py & | |
| sleep 2 | |
| curl --fail -v http://localhost:8000/api/asn/398324 | |
| curl --fail -v http://localhost:8000/api/ip/51.158.160.67 | |
| curl --fail -v http://localhost:8000/api/net/162.142.125.44 | |
| curl --fail -v http://localhost:8000/api/list/asn/vpn | |
| curl --fail -v http://localhost:8000/api/list/asn/hosting >/dev/null | |
| exit 0 | |
| shell: bash |