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

Automation, Lint'ing, etc Mega Refactor #208

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
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-go-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-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: 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
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-go-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-go-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-go-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
30 changes: 0 additions & 30 deletions .github/workflows/go.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/tests-daily.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build - Daily Official Build

on:
workflow_dispatch:
repository_dispatch:
types:
- manual-daily-build
schedule:
- cron: "0 9 * * *"

jobs:
build-release:
name: Daily Build Tests
# 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: Config git
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_ACCESS_TOKEN }}
shell: bash
run: |
git config --global init.defaultBranch main
git config --global pull.rebase true
git config --global url."https://git:[email protected]".insteadOf "https://github.com"
- name: Get dependencies
shell: bash
run: |
make ensure-deps
- name: Get dependencies
shell: bash
run: |
BRANCH_NAME="response-shape-${{ github.run_id }}"
git checkout -b "$BRANCH_NAME"
# run daily tests
go test -v -run TestDaily_ ./...
# create a PR
git add -A ./tests/response_data
git commit -s -m "auto-generated - update Response Shapes"
git push origin "$BRANCH_NAME"
gh pr create --title "auto-generated - update API spec" --body "auto-generated - update API spec" --base "main"
sleep 30
gh pr merge "$BRANCH_NAME" --delete-branch --squash --admin
47 changes: 47 additions & 0 deletions .github/workflows/tests-unit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Go Tests

on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
jobs:
build:
name: Go Tests
# 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
timeout-minutes: 5
steps:

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

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.19"

- name: Ensure dependencies installed
shell: bash
run: |
make ensure-deps
- name: Go Tidy
shell: bash
run: go mod tidy

- name: Go Mod
shell: bash
run: go mod download

- name: Go Mod Verify
shell: bash
run: go mod verify

- name: Run Tests
shell: bash
run: |
go test -v -run Test_ ./...
Loading
Loading