Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Automation Minus Python Static Checking #394

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ What would you expect to happen when following the steps above?
We want to make sure the problem isn't specific to your operating system or programming language.

- **Operating System/Version:** (ex. MacOS 14.2, Windows 10, RHEL 6, etc)
- **Go Version:** (ex. v1.18)
- **Python Version:** (ex. v1.18)
-->


Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/CD-dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Development Releases
name: CD - Publish Development Releases

on:
push:
Expand All @@ -14,14 +14,14 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.10'

- name: Update Version in __init__.py
run: |
sed -i 's/0.0.0/${{ github.ref_name }}/g' ./deepgram/__init__.py
sed -i 's/name = "deepgram-sdk"/name = "deepgram-unstable-sdk"/g' ./pyproject.toml
sed -i 's/name="deepgram-sdk"/name="deepgram-unstable-sdk"/g' ./setup.py

- name: Install Dependencies
run: pip install .

Expand All @@ -40,4 +40,4 @@ jobs:
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_DEV_API_TOKEN }}
password: ${{ secrets.PYPI_DEV_API_TOKEN }}
11 changes: 6 additions & 5 deletions .github/workflows/CD.yml → .github/workflows/CD.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: CD
name: CD - Publish Releases

on:
release:
types: [ published ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.10'

- name: Update Version in __init__.py
run: sed -i 's/0.0.0/${{ github.event.release.tag_name }}/g' ./deepgram/__init__.py

- name: Install Dependencies
run: pip install .

Expand All @@ -33,4 +34,4 @@ jobs:
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
password: ${{ secrets.PYPI_API_TOKEN }}
9 changes: 5 additions & 4 deletions .github/workflows/CI.yml → .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
name: CI
name: CI - Build SDK

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.10'

- name: Install Dependencies
run: pip install .

Expand All @@ -24,4 +25,4 @@ jobs:
run: python -m pip install --upgrade build

- name: Build SDK
run: python -m build
run: python -m build
27 changes: 13 additions & 14 deletions .github/workflows/PyDocs.yml → .github/workflows/PyDocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@ name: Generate PyDocs on Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-doc.[0-9]+"

- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-doc.[0-9]+"

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code from main branch
- name: Checkout code from main branch
uses: actions/checkout@v3
with:
ref: main
repository: ${{ github.repository }}

- name: Set up Python
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
Expand All @@ -30,13 +29,13 @@ jobs:
pip install --upgrade py2app
pip install python-dotenv
pip install -r requirements.txt

- name: Get the current tag name
run: echo "TAG_NAME=${GITHUB_REF##*/}" >> "$GITHUB_ENV"

# New Step: Extracting Major Version Number
- name: Set the current major version
run: echo "MAJOR_VERSION=$(echo $TAG_NAME | cut -d '.' -f 1)" >> "$GITHUB_ENV" # This extracts the major version assuming a 'vX.Y.Z' format
run: echo "MAJOR_VERSION=$(echo "$TAG_NAME" | cut -d '.' -f 1)" >> "$GITHUB_ENV" # This extracts the major version assuming a 'vX.Y.Z' format

- name: Checkout the gh-pages branch
uses: actions/checkout@v3
Expand All @@ -46,12 +45,12 @@ jobs:

- name: Generate Documentation for the current tag
run: |
ROOT_PATH=$(pwd) # Moved this line up to ensure ROOT_PATH is set before its usage
rm -rf $ROOT_PATH/gh-pages/docs/$MAJOR_VERSION
mkdir -p $ROOT_PATH/gh-pages/docs/$MAJOR_VERSION # Note: Changed to use MAJOR_VERSION to create/update the major version folder
cd $ROOT_PATH/deepgram
pdoc $ROOT_PATH/deepgram -o $ROOT_PATH/gh-pages/docs/$MAJOR_VERSION # Documentation is generated/updated in the major version folder
ROOT_PATH="$(pwd)" # Moved this line up to ensure ROOT_PATH is set before its usage
rm -rf "$ROOT_PATH/gh-pages/docs/$MAJOR_VERSION"
mkdir -p "$ROOT_PATH/gh-pages/docs/$MAJOR_VERSION" # Note: Changed to use MAJOR_VERSION to create/update the major version folder
cd "$ROOT_PATH/deepgram"
pdoc "$ROOT_PATH/deepgram" -o "$ROOT_PATH/gh-pages/docs/$MAJOR_VERSION" # Documentation is generated/updated in the major version folder

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/check-actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check - actionlint

on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
paths:
- ".github/workflows/**"

jobs:
checkactionlint:
name: Check actionlint
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'deepgram/deepgram-python-sdk'
runs-on: ubuntu-latest
steps:

- name: Checkout code by commit
uses: actions/checkout@v4

- name: Ensure dependencies installed
shell: bash
run: |
make ensure-deps

- name: Run actionlint
run: |
make actionlint
35 changes: 35 additions & 0 deletions .github/workflows/check-all.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check - All linters, etc
on:
push:
branches:
- main
- release-*
tags-ignore:
- "**"

jobs:
build:
name: Change to Main/Release Branch
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'deepgram/deepgram-python-sdk'
runs-on: ubuntu-latest
steps:

- name: Checkout code by commit
uses: actions/checkout@v4

- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: "1.19"
id: go

- name: Ensure dependencies installed
shell: bash
run: |
make ensure-deps

- name: Run all checks
shell: bash
run: |
make check
53 changes: 53 additions & 0 deletions .github/workflows/check-lint.yaml.DISABLE
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Check - lint

on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
paths:
- "**.go"
- "**/go.mod"
- ".golangci.yaml"

jobs:
checklint:
name: Lint
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'deepgram/deepgram-go-sdk'
runs-on: ubuntu-latest
steps:

- name: Checkout code by commit
uses: actions/checkout@v4

- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: "1.19"
id: go

# - name: Get Date
# id: get-date
# shell: bash
# run: |
# echo "date=$(date -u "+%Y-%m")" >> $GITHUB_OUTPUT

- name: Restore Lint Cache
uses: actions/cache@v3
timeout-minutes: 10
continue-on-error: true
with:
path: ${{ runner.temp }}/lint_cache
# key: ${{ runner.os }}-lint-cache-${{ steps.get-date.outputs.date }}
key: ${{ runner.os }}-lint-cache
restore-keys: |
${{ runner.os }}-lint-cache

- name: Run golangci-lint
env:
GOLANGCI_LINT_CACHE: ${{ runner.temp }}/lint_cache
run: |
make lint
32 changes: 32 additions & 0 deletions .github/workflows/check-mdlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Check - mdlint

on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
paths:
- "**.md"
- "hack/check/check-mdlint.sh"

jobs:
checkmdlint:
name: Check mdlint
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'deepgram/deepgram-python-sdk'
runs-on: ubuntu-latest
steps:

- name: Checkout code by commit
uses: actions/checkout@v4

- name: Ensure dependencies installed
shell: bash
run: |
make ensure-deps

- name: Run mdlint
run: |
make mdlint
33 changes: 33 additions & 0 deletions .github/workflows/check-shell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Check - shell

on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
paths:
- "**/Makefile"
- "**.sh"
- "hack/check/check-shell.sh"

jobs:
checkshell:
name: Check shell
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'deepgram/deepgram-python-sdk'
runs-on: ubuntu-latest
steps:

- name: Checkout code by commit
uses: actions/checkout@v4

- name: Ensure dependencies installed
shell: bash
run: |
make ensure-deps

- name: Run shellcheck
run: |
make shellcheck
31 changes: 31 additions & 0 deletions .github/workflows/check-yaml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check - yaml

on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
paths:
- ".github/workflows/**"

jobs:
checkmdlint:
name: Check mdlint
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'deepgram/deepgram-python-sdk'
runs-on: ubuntu-latest
steps:

- name: Checkout code by commit
uses: actions/checkout@v4

- name: Ensure dependencies installed
shell: bash
run: |
make ensure-deps

- name: Run mdlint
run: |
make mdlint
Loading
Loading