Skip to content

Commit

Permalink
final edits
Browse files Browse the repository at this point in the history
  • Loading branch information
EM51641 committed Sep 23, 2023
1 parent f495077 commit 98f8989
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 120 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
// README at: https://github.com/devcontainers/templates/tree/master/src/typescript-node
{
"name": "Python",
"dockerComposeFile": "docker-compose.yml",
Expand Down
19 changes: 0 additions & 19 deletions .github/action/release.yaml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/actions/build_async_sendgrid/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Poetry Composite Action
description: Set Poetry and Python

inputs:
poetry-version:
required: true
type: string

poetry-virtualenv:
required: false
type: boolean
default: true

poetry-virtualenvs-in-project:
required: false
type: boolean
default: true

python-version:
required: true
type: string

runs:
using: "composite"

steps:

# Downloads a copy of the code in your repository before running CI tests
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ inputs.poetry-version }}
virtualenvs-create: ${{ inputs.poetry-virtualenv }}
virtualenvs-in-project: ${{ inputs.poetry-virtualenvs-in-project }}

- name: Install project
run: poetry install --no-root --no-interaction
shell: bash
23 changes: 12 additions & 11 deletions .github/workflows/formatter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,28 @@ name: Formatter
on:
push:
branches:
- main
- master
- dev

pull_request:
branches:
- main
- master
- dev

workflow_call:


jobs:
build:
runs-on: ubuntu-latest

steps:
# Downloads a copy of the code in your repository before running CI tests
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install black
run: pip install black
- name: Set up Python & Poetry
uses: sensodevices/async-sendgrid/.github/actions/build_async_sendgrid@master
with:
poetry-version: "1.6.1"
python-version: "3.11.5"

- name: Execute mypy
run: python -m black async_sendgrid
run: poetry run black async-sendgrid
34 changes: 34 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Integration Tests

on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev

workflow_call:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10.13', '3.11.5' ]

env:
POETRY_NO_INTERACTION: 1
PIP_DEFAULT_TIMEOUT: 100

steps:
- name: Set up Python & Poetry
uses: sensodevices/async-sendgrid/.github/actions/build_async_sendgrid@master
with:
poetry-version: '1.6.1'
python-version: ${{ matrix.python-version }}

- name: Execute Pytest
run: poetry run python -m pytest --cov=async-sendgrid tests/integration
22 changes: 10 additions & 12 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
name: Linting

on:
on:
push:
branches:
- main
- master
- dev

pull_request:
branches:
- main
- master
- dev
workflow_call:


jobs:
build:
runs-on: ubuntu-latest

steps:
# Downloads a copy of the code in your repository before running CI tests
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
- name: Set up Python & Poetry
uses: sensodevices/async-sendgrid/.github/actions/build_async_sendgrid@master
with:
python-version: '3.11'

- name: Install flake8
run: pip install flake8
poetry-version: "1.6.1"
python-version: "3.11.5"

- name: Execute flake8
run: python -m flake8 async_sendgrid
run: poetry run flake8 async-sendgrid
79 changes: 41 additions & 38 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,69 @@ name: Release and Upload Python Package on PyPI

on:
push:
branches:
- main
tags:
- '*'

jobs:
unit:
name: Call Unit Tests
uses: ./.github/workflows/unit.yaml
name: Unit Tests
uses: sensodevices/async-sendgrid/.github/workflows/unit.yaml@master

typing:
name: Call Mypy
uses: ./.github/workflows/typing.yaml
name: Mypy
uses: sensodevices/async-sendgrid/.github/workflows/typing.yaml@master

linting:
name: Call flake8
uses: ./.github/workflows/linting.yaml
name: Flake8
uses: sensodevices/async-sendgrid/.github/workflows/linting.yaml@master

integration:
name: Integration Tests
uses: sensodevices/async-sendgrid/.github/workflows/integration.yaml@master

formatter:
name: Call black
uses: ./.github/workflows/formatter.yaml
name: Black
uses: sensodevices/async-sendgrid/.github/workflows/formatter.yaml@master

release:
runs-on: ubuntu-latest
name: Release version
needs: [unit, typing, linting, formatter]
needs: [unit, typing, linting, formatter, integration]

permissions:
contents: write

steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Use local my-action
uses: ./.github/action/release.yaml
- name: Initiate release
uses: ncipollo/release-action@v1
with:
artifacts: "release.tar.gz,foo/*.txt"

deploy:
needs: [release]
runs-on: ubuntu-latest
needs: release

env:
environment: production

permissions:
contents: read

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.11.5'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: '1.6.1'
virtualenvs-create: false
virtualenvs-in-project: false

- name: Install Dependencies
run: poetry install --no-root

- name: Build package
run: poetry build

- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Set up Python & Poetry
uses: sensodevices/async-sendgrid/.github/actions/build_async_sendgrid@master
with:
poetry-version: "1.6.1"
python-version: "3.11.5"

- name: Build package
run: poetry build

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

24 changes: 11 additions & 13 deletions .github/workflows/typing.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
name: Typing

on:
on:
push:
branches:
- main
- master
- dev

pull_request:
branches:
- main
- master
- dev

workflow_call:

jobs:
build:
runs-on: ubuntu-latest

steps:
# Downloads a copy of the code in your repository before running CI tests
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- name: Set up Python & Poetry
uses: sensodevices/async-sendgrid/.github/actions/build_async_sendgrid@master
with:
python-version: '3.11'

- name: Install mypy and the required stubs
run: |
pip install mypy
poetry-version: "1.6.1"
python-version: "3.11.5"

- name: Execute mypy
run: python -m mypy async_sendgrid
run: poetry run mypy async-sendgrid
Loading

0 comments on commit 98f8989

Please sign in to comment.