diff --git a/.github/workflows/scheduled-tests.yml b/.github/workflows/scheduled-tests.yml new file mode 100644 index 00000000..517dce4d --- /dev/null +++ b/.github/workflows/scheduled-tests.yml @@ -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 }}