Skip to content

Merge pull request #56 from blacklanternsecurity/dependabot/pip/maste… #467

Merge pull request #56 from blacklanternsecurity/dependabot/pip/maste…

Merge pull request #56 from blacklanternsecurity/dependabot/pip/maste… #467

Workflow file for this run

name: tests
on:
push:
pull_request:
schedule:
# At 00:25 every day
- cron: '25 0 * * *'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
options: "--check"
- name: Install Python 3
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
pip install flake8
- name: flake8
run: |
flake8 --select F,E722 --ignore F403,F405,F541 --per-file-ignores="*/__init__.py:F401,F403"
test:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
pip install poetry
poetry install
- name: Run tests
run: |
poetry run pytest --exitfirst --disable-warnings --log-cli-level=DEBUG
update:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master' && github.actor != 'dependabot[bot]' && (github.event_name == 'push' || github.event_name == 'schedule')
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
pip install poetry
poetry install
- name: Install ASN database
run: |
poetry run pip install pyasn
poetry run pyasn_util_download.py --latestv46
poetry run pyasn_util_convert.py --single rib.*.bz2 asn.db
- name: Update cloud_providers.json
run: poetry run cloudcheck forceupdate
- name: git add cloud_providers.json
uses: EndBug/add-and-commit@v9
with:
add: "cloud_providers.json"
default_author: github_actions
message: "update cloud_providers.json"
publish:
runs-on: ubuntu-latest
needs: update
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Dynamic version
run: "sed -i s/5.0.1.0/5.0.1.$(git rev-list HEAD --count)/g pyproject.toml"
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python3 -m pip install poetry
poetry install
- name: Build Pypi package
run: poetry build
- name: Publish Pypi package
uses: pypa/gh-action-pypi-publish@release/v1.5
with:
password: ${{ secrets.PYPI_API_TOKEN }}