tests #38
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: tests | |
on: | |
push: | |
pull_request: | |
schedule: | |
# At 12:42 every Saturday | |
- cron: '42 12 * * 6' | |
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.10" | |
- 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" | |
refresh_json: | |
runs-on: ubuntu-latest | |
needs: lint | |
if: 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.10" | |
- name: Install dependencies | |
run: | | |
pip install poetry | |
poetry install | |
- name: Refresh cloud_providers.json | |
run: poetry run cloudcheck refresh_json | |
- name: git add cloud_providers.json | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: "cloud_providers.json" | |
default_author: github_actions | |
message: "refresh cloud_providers.json" | |
publish: | |
runs-on: ubuntu-latest | |
needs: refresh_json | |
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/0.1.2.3/2.0.0.$(git rev-list HEAD --count)/g pyproject.toml" | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- 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 }} |