-
Notifications
You must be signed in to change notification settings - Fork 48
126 lines (117 loc) · 4.09 KB
/
go-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Go Tests
on:
workflow_dispatch:
pull_request:
schedule:
- cron: '0 0 * * *'
push:
branches: [ master ]
jobs:
extra-delay:
runs-on: ubuntu-latest
steps:
- name: Extra Delay
if: ${{ startsWith(github.event.head_commit.message, 'Release') }}
run: |
# If this is a release, then sleep for before starting the tests so that the newest version is released
# and pushed to the updated server before we run the tests
sleep 1200 # 20 minutes
test:
runs-on: ${{ matrix.os }}
needs: extra-delay
strategy:
matrix:
os: [ubuntu-latest, macos-14]
test_shard: ["0", "1", "2", "3", "4"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.23
- name: Linux Setup
if: ${{ matrix.os == 'ubuntu-latest'}}
run: |
# Install our dependencies
sudo apt-get update
sudo apt-get install -y zsh tmux fish
# Work around a weird bug where zsh on ubuntu actions gives that directory 0777 which makes zsh refuse to start
sudo chmod 0755 -R /usr/share/zsh/
# Set a consistent hostname so we can run tests that depend on it
sudo hostname ghaction-runner-hostname
- name: MacOS Setup
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macos-14' }}
run: |
# Install our dependencies
brew install fish tmux bash
# Set a consistent hostname so we can run tests that depend on it
sudo scutil --set HostName ghaction-runner-hostname
- name: MacOS Docker Setup
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macos-14 '}}
continue-on-error: true # Since colima is flaky, and a failure here only impacts our metrics
run: |
# Install docker so it can be used for datadog
brew install docker
colima start
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
- name: Set up Datadog
if: ${{ github.ref == 'refs/heads/master' && matrix.os != 'macos-14' }}
continue-on-error: true # Since colima is flaky, and a failure here only impacts our metrics
uses: datadog/[email protected]
with:
api_key: ${{ secrets.DD_API_KEY }}
- name: Go test
env:
DD_API_KEY: ${{ secrets.DD_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
go install gotest.tools/gotestsum@bc98120
NUM_TEST_SHARDS=5 CURRENT_SHARD_NUM=${{ matrix.test_shard }} make test
- name: Extra Delay
run: |
# Add an extra short delay to allow datadog to flush metrics
sleep 90
- name: Upload test results json
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: test-results-${{ matrix.os }}-${{ matrix.test_shard }}.json
path: /tmp/testrun.json
- name: Upload failed test goldens
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: test-goldens-${{ matrix.os }}-${{ matrix.test_shard }}.zip
path: /tmp/test-goldens/
- name: Upload test log
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: testlog-${{ matrix.os }}-${{ matrix.test_shard }}.txt
path: /tmp/test.log
- name: Upload used goldens
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: goldens-used-${{ matrix.os }}-${{ matrix.test_shard }}
path: /tmp/goldens-used.txt
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
check-goldens:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.23
- name: Download artifact
uses: actions/download-artifact@v4
- name: Check all goldens were used
run: |
go run client/posttest/main.go check-goldens