Skip to content

Pypi publish updates #7

Pypi publish updates

Pypi publish updates #7

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: python-package
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
DISABLE_SSL: true
SECRET_KEY: s3cr3t
PG_PASSWORD: postgres
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- uses: actions/cache@main
id: cache-poetry
name: Cache venv based on the dependencies lock file
env:
cache-name: cache-poetry
with:
path: ./.venv
key: ${{ runner.os }}-py${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
poetry install
pytest:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
python-version: ["3.11"]
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 30s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Restore dependencies
uses: actions/cache@main
env:
cache-name: cache-poetry
with:
path: .venv
key: ${{ runner.os }}-py${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
poetry install
- run: |
poetry run pytest --cache-clear
black:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Restore dependencies
uses: actions/cache@main
env:
cache-name: cache-poetry
with:
path: .venv
key: ${{ runner.os }}-py${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
poetry install
- run: |
poetry run black --check .
isort:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Restore dependencies
uses: actions/cache@main
env:
cache-name: cache-poetry
with:
path: .venv
key: ${{ runner.os }}-py${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
poetry install
- run: |
poetry run isort --check-only strawberry_django_phonenumber tests test_app
flake8:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Restore dependencies
uses: actions/cache@main
env:
cache-name: cache-poetry
with:
path: .venv
key: ${{ runner.os }}-py${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
poetry install
- run: |
poetry run flake8 strawberry_django_phonenumber/ tests/ test_app/
python-security-check:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Restore dependencies
uses: actions/cache@main
env:
cache-name: cache-poetry
with:
path: .venv
key: ${{ runner.os }}-py${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
poetry install
- run: |
poetry run safety check
poetry run bandit -r strawberry_django_phonenumber/ test_app/