mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
178 lines
6.3 KiB
YAML
178 lines
6.3 KiB
YAML
# The nightly-gauntlet runs the full test suite on macOS and Windows.
|
|
# This complements ci.yaml which only runs a subset of packages on these platforms.
|
|
name: nightly-gauntlet
|
|
on:
|
|
schedule:
|
|
# Every day at 4AM UTC on weekdays
|
|
- cron: "0 4 * * 1-5"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test-go-pg:
|
|
# make sure to adjust NUM_PARALLEL_PACKAGES and NUM_PARALLEL_TESTS below
|
|
# when changing runner sizes
|
|
runs-on: ${{ matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'depot-macos-latest' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'depot-windows-2022-16' || matrix.os }}
|
|
# This timeout must be greater than the timeout set by `go test` in
|
|
# `make test` to ensure we receive a trace of running goroutines.
|
|
# Setting this to the timeout +5m should work quite well even if
|
|
# some of the preceding steps are slow.
|
|
timeout-minutes: 25
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- macos-latest
|
|
- windows-2022
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@f808768d1510423e83855289c910610ca9b43176 # v2.17.0
|
|
with:
|
|
egress-policy: audit
|
|
|
|
# macOS indexes all new files in the background. Our Postgres tests
|
|
# create and destroy thousands of databases on disk, and Spotlight
|
|
# tries to index all of them, seriously slowing down the tests.
|
|
- name: Disable Spotlight Indexing
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
enabled=$(sudo mdutil -a -s | { grep -Fc "Indexing enabled" || true; })
|
|
if [ "$enabled" -eq 0 ]; then
|
|
echo "Spotlight indexing is already disabled"
|
|
exit 0
|
|
fi
|
|
sudo mdutil -a -i off
|
|
sudo mdutil -X /
|
|
sudo launchctl bootout system /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
|
|
|
|
# Set up RAM disks to speed up the rest of the job. This action is in
|
|
# a separate repository to allow its use before actions/checkout.
|
|
- name: Setup RAM Disks
|
|
if: runner.os == 'Windows'
|
|
uses: coder/setup-ramdisk-action@e1100847ab2d7bcd9d14bcda8f2d1b0f07b36f1b # v0.1.0
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 1
|
|
persist-credentials: false
|
|
|
|
- name: Setup GNU tools (macOS)
|
|
uses: ./.github/actions/setup-gnu-tools
|
|
|
|
- name: Set up mise tools
|
|
uses: ./.github/actions/setup-mise
|
|
with:
|
|
install-args: "go terraform"
|
|
|
|
- name: Restore Go cache
|
|
uses: ./.github/actions/go-cache
|
|
|
|
- name: Install Go mise tools
|
|
run: ./.github/scripts/retry.sh -- mise install --locked go:gotest.tools/gotestsum
|
|
|
|
- name: Setup Embedded Postgres Cache Paths
|
|
id: embedded-pg-cache
|
|
uses: ./.github/actions/setup-embedded-pg-cache-paths
|
|
|
|
- name: Download Embedded Postgres Cache
|
|
id: download-embedded-pg-cache
|
|
uses: ./.github/actions/embedded-pg-cache/download
|
|
with:
|
|
key-prefix: embedded-pg-${{ runner.os }}-${{ runner.arch }}
|
|
cache-path: ${{ steps.embedded-pg-cache.outputs.cached-dirs }}
|
|
|
|
- name: Setup RAM disk for Embedded Postgres (Windows)
|
|
if: runner.os == 'Windows'
|
|
shell: bash
|
|
run: mkdir -p "R:/temp/embedded-pg"
|
|
|
|
- name: Setup RAM disk for Embedded Postgres (macOS)
|
|
if: runner.os == 'macOS'
|
|
shell: bash
|
|
run: |
|
|
mkdir -p /tmp/tmpfs
|
|
sudo mount_tmpfs -o noowners -s 8g /tmp/tmpfs
|
|
|
|
- name: Test with PostgreSQL Database (macOS)
|
|
if: runner.os == 'macOS'
|
|
uses: ./.github/actions/test-go-pg
|
|
with:
|
|
postgres-version: "13"
|
|
# Our macOS runners have 8 cores.
|
|
test-parallelism-packages: "8"
|
|
test-parallelism-tests: "16"
|
|
test-count: "1"
|
|
embedded-pg-path: "/tmp/tmpfs/embedded-pg"
|
|
embedded-pg-cache: ${{ steps.embedded-pg-cache.outputs.embedded-pg-cache }}
|
|
|
|
- name: Test with PostgreSQL Database (Windows)
|
|
if: runner.os == 'Windows'
|
|
uses: ./.github/actions/test-go-pg
|
|
with:
|
|
postgres-version: "13"
|
|
# Our Windows runners have 16 cores.
|
|
test-parallelism-packages: "8"
|
|
test-parallelism-tests: "16"
|
|
test-count: "1"
|
|
embedded-pg-path: "R:/temp/embedded-pg"
|
|
embedded-pg-cache: ${{ steps.embedded-pg-cache.outputs.embedded-pg-cache }}
|
|
|
|
- name: Upload Embedded Postgres Cache
|
|
uses: ./.github/actions/embedded-pg-cache/upload
|
|
with:
|
|
cache-key: ${{ steps.download-embedded-pg-cache.outputs.cache-key }}
|
|
cache-path: "${{ steps.embedded-pg-cache.outputs.embedded-pg-cache }}"
|
|
|
|
- name: Upload test stats to Datadog
|
|
timeout-minutes: 1
|
|
continue-on-error: true
|
|
uses: ./.github/actions/upload-datadog
|
|
if: success() || failure()
|
|
with:
|
|
api-key: ${{ secrets.DATADOG_API_KEY }}
|
|
|
|
notify-slack-on-failure:
|
|
needs:
|
|
- test-go-pg
|
|
runs-on: ubuntu-latest
|
|
if: failure()
|
|
|
|
steps:
|
|
- name: Send Slack notification
|
|
run: |
|
|
ESCAPED_PROMPT=$(printf "%s" "<@U09LQ75AHKR> $BLINK_CI_FAILURE_PROMPT" | jq -Rsa .)
|
|
curl -X POST -H 'Content-type: application/json' \
|
|
--data '{
|
|
"blocks": [
|
|
{
|
|
"type": "header",
|
|
"text": {
|
|
"type": "plain_text",
|
|
"text": "❌ Nightly gauntlet failed",
|
|
"emoji": true
|
|
}
|
|
},
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "*View failure:* <'"${RUN_URL}"'|Click here>"
|
|
}
|
|
},
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": '"$ESCAPED_PROMPT"'
|
|
}
|
|
}
|
|
]
|
|
}' "${SLACK_WEBHOOK}"
|
|
env:
|
|
SLACK_WEBHOOK: ${{ secrets.CI_FAILURE_SLACK_WEBHOOK }}
|
|
RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
BLINK_CI_FAILURE_PROMPT: ${{ vars.BLINK_CI_FAILURE_PROMPT }}
|