Skip to content

Commit 66a014d

Browse files
GitHub Automation Minus Python Static Checking
1 parent 83d5f03 commit 66a014d

27 files changed

+876
-78
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ What would you expect to happen when following the steps above?
3030
We want to make sure the problem isn't specific to your operating system or programming language.
3131
3232
- **Operating System/Version:** (ex. MacOS 14.2, Windows 10, RHEL 6, etc)
33-
- **Go Version:** (ex. v1.18)
33+
- **Python Version:** (ex. v1.18)
3434
-->
3535

3636

.github/workflows/CD-dev.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Development Releases
1+
name: CD - Publish Development Releases
22

33
on:
44
push:
@@ -14,14 +14,14 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- uses: actions/setup-python@v4
1616
with:
17-
python-version: '3.10'
18-
17+
python-version: '3.10'
18+
1919
- name: Update Version in __init__.py
2020
run: |
2121
sed -i 's/0.0.0/${{ github.ref_name }}/g' ./deepgram/__init__.py
2222
sed -i 's/name = "deepgram-sdk"/name = "deepgram-unstable-sdk"/g' ./pyproject.toml
2323
sed -i 's/name="deepgram-sdk"/name="deepgram-unstable-sdk"/g' ./setup.py
24-
24+
2525
- name: Install Dependencies
2626
run: pip install .
2727

@@ -40,4 +40,4 @@ jobs:
4040
- name: Publish to PyPi
4141
uses: pypa/gh-action-pypi-publish@release/v1
4242
with:
43-
password: ${{ secrets.PYPI_DEV_API_TOKEN }}
43+
password: ${{ secrets.PYPI_DEV_API_TOKEN }}

.github/workflows/CD.yml renamed to .github/workflows/CD.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
name: CD
1+
name: CD - Publish Releases
22

33
on:
44
release:
55
types: [ published ]
6+
67
jobs:
78
build:
89
runs-on: ubuntu-latest
910
steps:
1011
- uses: actions/checkout@v3
1112
- uses: actions/setup-python@v4
1213
with:
13-
python-version: '3.10'
14-
14+
python-version: '3.10'
15+
1516
- name: Update Version in __init__.py
1617
run: sed -i 's/0.0.0/${{ github.event.release.tag_name }}/g' ./deepgram/__init__.py
17-
18+
1819
- name: Install Dependencies
1920
run: pip install .
2021

@@ -33,4 +34,4 @@ jobs:
3334
- name: Publish to PyPi
3435
uses: pypa/gh-action-pypi-publish@release/v1
3536
with:
36-
password: ${{ secrets.PYPI_API_TOKEN }}
37+
password: ${{ secrets.PYPI_API_TOKEN }}
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
name: CI
1+
name: CI - Build SDK
22

33
on:
44
push:
55
branches: [ main ]
66
pull_request:
77
branches: [ main ]
8+
89
jobs:
910
build:
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v3
1314
- uses: actions/setup-python@v4
1415
with:
15-
python-version: '3.10'
16-
16+
python-version: '3.10'
17+
1718
- name: Install Dependencies
1819
run: pip install .
1920

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

2627
- name: Build SDK
27-
run: python -m build
28+
run: python -m build

.github/workflows/PyDocs.yml renamed to .github/workflows/PyDocs.yaml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,21 @@ name: Generate PyDocs on Release
33
on:
44
push:
55
tags:
6-
- "v[0-9]+.[0-9]+.[0-9]+"
7-
- "v[0-9]+.[0-9]+.[0-9]+-doc.[0-9]+"
8-
6+
- "v[0-9]+.[0-9]+.[0-9]+"
7+
- "v[0-9]+.[0-9]+.[0-9]+-doc.[0-9]+"
98

109
jobs:
1110
build-and-deploy:
1211
runs-on: ubuntu-latest
13-
12+
1413
steps:
15-
- name: Checkout code from main branch
14+
- name: Checkout code from main branch
1615
uses: actions/checkout@v3
1716
with:
1817
ref: main
1918
repository: ${{ github.repository }}
2019

21-
- name: Set up Python
20+
- name: Set up Python
2221
uses: actions/setup-python@v2
2322
with:
2423
python-version: '3.11'
@@ -30,13 +29,13 @@ jobs:
3029
pip install --upgrade py2app
3130
pip install python-dotenv
3231
pip install -r requirements.txt
33-
32+
3433
- name: Get the current tag name
3534
run: echo "TAG_NAME=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
3635

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

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

4746
- name: Generate Documentation for the current tag
4847
run: |
49-
ROOT_PATH=$(pwd) # Moved this line up to ensure ROOT_PATH is set before its usage
50-
rm -rf $ROOT_PATH/gh-pages/docs/$MAJOR_VERSION
51-
mkdir -p $ROOT_PATH/gh-pages/docs/$MAJOR_VERSION # Note: Changed to use MAJOR_VERSION to create/update the major version folder
52-
cd $ROOT_PATH/deepgram
53-
pdoc $ROOT_PATH/deepgram -o $ROOT_PATH/gh-pages/docs/$MAJOR_VERSION # Documentation is generated/updated in the major version folder
54-
48+
ROOT_PATH="$(pwd)" # Moved this line up to ensure ROOT_PATH is set before its usage
49+
rm -rf "$ROOT_PATH/gh-pages/docs/$MAJOR_VERSION"
50+
mkdir -p "$ROOT_PATH/gh-pages/docs/$MAJOR_VERSION" # Note: Changed to use MAJOR_VERSION to create/update the major version folder
51+
cd "$ROOT_PATH/deepgram"
52+
pdoc "$ROOT_PATH/deepgram" -o "$ROOT_PATH/gh-pages/docs/$MAJOR_VERSION" # Documentation is generated/updated in the major version folder
53+
5554
- name: Deploy to GitHub Pages
5655
uses: peaceiris/actions-gh-pages@v3
5756
with:
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Check - actionlint
2+
3+
on:
4+
pull_request:
5+
types:
6+
- assigned
7+
- opened
8+
- synchronize
9+
- reopened
10+
paths:
11+
- ".github/workflows/**"
12+
13+
jobs:
14+
checkactionlint:
15+
name: Check actionlint
16+
# Only run this job if we're in the main repo, not a fork.
17+
if: github.repository == 'deepgram/deepgram-python-sdk'
18+
runs-on: ubuntu-latest
19+
steps:
20+
21+
- name: Checkout code by commit
22+
uses: actions/checkout@v4
23+
24+
- name: Ensure dependencies installed
25+
shell: bash
26+
run: |
27+
make ensure-deps
28+
29+
- name: Run actionlint
30+
run: |
31+
make actionlint

.github/workflows/check-all.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Check - All linters, etc
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- release-*
7+
tags-ignore:
8+
- "**"
9+
10+
jobs:
11+
build:
12+
name: Change to Main/Release Branch
13+
# Only run this job if we're in the main repo, not a fork.
14+
if: github.repository == 'deepgram/deepgram-python-sdk'
15+
runs-on: ubuntu-latest
16+
steps:
17+
18+
- name: Checkout code by commit
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Go 1.x
22+
uses: actions/setup-go@v3
23+
with:
24+
go-version: "1.19"
25+
id: go
26+
27+
- name: Ensure dependencies installed
28+
shell: bash
29+
run: |
30+
make ensure-deps
31+
32+
- name: Run all checks
33+
shell: bash
34+
run: |
35+
make check
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Check - lint
2+
3+
on:
4+
pull_request:
5+
types:
6+
- assigned
7+
- opened
8+
- synchronize
9+
- reopened
10+
paths:
11+
- "**.go"
12+
- "**/go.mod"
13+
- ".golangci.yaml"
14+
15+
jobs:
16+
checklint:
17+
name: Lint
18+
# Only run this job if we're in the main repo, not a fork.
19+
if: github.repository == 'deepgram/deepgram-go-sdk'
20+
runs-on: ubuntu-latest
21+
steps:
22+
23+
- name: Checkout code by commit
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Go 1.x
27+
uses: actions/setup-go@v3
28+
with:
29+
go-version: "1.19"
30+
id: go
31+
32+
# - name: Get Date
33+
# id: get-date
34+
# shell: bash
35+
# run: |
36+
# echo "date=$(date -u "+%Y-%m")" >> $GITHUB_OUTPUT
37+
38+
- name: Restore Lint Cache
39+
uses: actions/cache@v3
40+
timeout-minutes: 10
41+
continue-on-error: true
42+
with:
43+
path: ${{ runner.temp }}/lint_cache
44+
# key: ${{ runner.os }}-lint-cache-${{ steps.get-date.outputs.date }}
45+
key: ${{ runner.os }}-lint-cache
46+
restore-keys: |
47+
${{ runner.os }}-lint-cache
48+
49+
- name: Run golangci-lint
50+
env:
51+
GOLANGCI_LINT_CACHE: ${{ runner.temp }}/lint_cache
52+
run: |
53+
make lint

.github/workflows/check-mdlint.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Check - mdlint
2+
3+
on:
4+
pull_request:
5+
types:
6+
- assigned
7+
- opened
8+
- synchronize
9+
- reopened
10+
paths:
11+
- "**.md"
12+
- "hack/check/check-mdlint.sh"
13+
14+
jobs:
15+
checkmdlint:
16+
name: Check mdlint
17+
# Only run this job if we're in the main repo, not a fork.
18+
if: github.repository == 'deepgram/deepgram-python-sdk'
19+
runs-on: ubuntu-latest
20+
steps:
21+
22+
- name: Checkout code by commit
23+
uses: actions/checkout@v4
24+
25+
- name: Ensure dependencies installed
26+
shell: bash
27+
run: |
28+
make ensure-deps
29+
30+
- name: Run mdlint
31+
run: |
32+
make mdlint

.github/workflows/check-shell.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Check - shell
2+
3+
on:
4+
pull_request:
5+
types:
6+
- assigned
7+
- opened
8+
- synchronize
9+
- reopened
10+
paths:
11+
- "**/Makefile"
12+
- "**.sh"
13+
- "hack/check/check-shell.sh"
14+
15+
jobs:
16+
checkshell:
17+
name: Check shell
18+
# Only run this job if we're in the main repo, not a fork.
19+
if: github.repository == 'deepgram/deepgram-python-sdk'
20+
runs-on: ubuntu-latest
21+
steps:
22+
23+
- name: Checkout code by commit
24+
uses: actions/checkout@v4
25+
26+
- name: Ensure dependencies installed
27+
shell: bash
28+
run: |
29+
make ensure-deps
30+
31+
- name: Run shellcheck
32+
run: |
33+
make shellcheck

0 commit comments

Comments
 (0)