Skip to content

feat: add scheduled hourly test runs with Slack notifications #1493

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
68 changes: 68 additions & 0 deletions .github/workflows/scheduled-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Scheduled Tests

on:
schedule:
# Run every hour
- cron: "0 * * * *"
workflow_dispatch: # Allow manual triggering for testing

jobs:
test:
name: Run All Tests
runs-on:
group: ubuntu-latest-large
permissions:
contents: read
id-token: write
actions: read

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: "go.mod"

- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.9"

- name: Set up Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"

- name: Set up gotestfmt
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest

- name: Configure git for private modules
env:
GIT_AUTH_TOKEN: ${{ secrets.BOT_REPO_TOKEN }}
run: git config --global url."https://speakeasybot:${GIT_AUTH_TOKEN}@github.com".insteadOf "https://github.com"

- name: Build
run: go build ./...

- name: Run Tests
id: test
run: |
go test -json -v -p 1 -timeout=20m ./... | gotestfmt
env:
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}

- name: Notify Slack on Failure
if: failure()
uses: 8398a7/action-slack@807a8cb6243c41285b60b87ea5da7c6c5b1de3b9 # v3.18.0
with:
status: failure
text: |
:x: Scheduled tests failed!

*Workflow:* ${{ github.workflow }}
*Job:* ${{ github.job }}
*Branch:* ${{ github.ref }}
*Run:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
webhook_url: ${{ secrets.SLACK_DEV_SDKS_WEBHOOK_URL }}
Loading