2022-11-06 07:42:20 +01:00
|
|
|
name: Go Tests
|
2022-04-09 20:56:25 +02:00
|
|
|
|
|
|
|
on:
|
2022-05-28 03:52:09 +02:00
|
|
|
workflow_dispatch:
|
2022-09-17 20:54:26 +02:00
|
|
|
pull_request:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 0 * * *'
|
2022-04-09 20:56:25 +02:00
|
|
|
push:
|
2022-04-09 20:58:49 +02:00
|
|
|
branches: [ master ]
|
2022-04-09 20:56:25 +02:00
|
|
|
|
|
|
|
jobs:
|
2022-04-09 21:19:01 +02:00
|
|
|
test:
|
2022-04-17 19:50:37 +02:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-02-04 19:55:11 +01:00
|
|
|
os: [ubuntu-latest, macos-latest, macos-14]
|
2022-11-05 06:52:02 +01:00
|
|
|
fail-fast: false
|
2022-04-09 20:56:25 +02:00
|
|
|
steps:
|
2023-09-13 16:35:18 +02:00
|
|
|
- uses: actions/checkout@v4
|
2022-04-09 20:56:25 +02:00
|
|
|
- name: Set up Go
|
2022-09-21 08:20:28 +02:00
|
|
|
uses: actions/setup-go@v3
|
2022-04-09 20:56:25 +02:00
|
|
|
with:
|
2023-10-02 03:00:58 +02:00
|
|
|
go-version: 1.21
|
2023-09-03 03:03:26 +02:00
|
|
|
- name: Linux Setup
|
2023-10-11 07:20:07 +02:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest'}}
|
2022-04-18 05:08:54 +02:00
|
|
|
run: |
|
2023-09-03 02:58:36 +02:00
|
|
|
|
2023-09-03 02:33:02 +02:00
|
|
|
# Install our dependencies
|
2023-09-03 03:03:26 +02:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y zsh tmux fish
|
2023-09-03 02:33:02 +02:00
|
|
|
|
|
|
|
# Work around a weird bug where zsh on ubuntu actions gives that directory 0777 which makes zsh refuse to start
|
2023-09-03 03:03:26 +02:00
|
|
|
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
|
2024-02-04 19:55:11 +01:00
|
|
|
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macos-14' }}
|
2023-09-03 03:03:26 +02:00
|
|
|
run: |
|
|
|
|
|
|
|
|
# Install our dependencies
|
2023-09-05 03:03:46 +02:00
|
|
|
brew install fish tmux bash
|
2023-09-03 02:33:02 +02:00
|
|
|
|
|
|
|
# Set a consistent hostname so we can run tests that depend on it
|
2023-09-05 03:03:46 +02:00
|
|
|
sudo scutil --set HostName ghaction-runner-hostname
|
2023-09-09 04:27:16 +02:00
|
|
|
- name: MacOS Docker Setup
|
2024-02-05 07:29:04 +01:00
|
|
|
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macos-14 '}}
|
2023-09-09 04:27:16 +02:00
|
|
|
continue-on-error: true
|
2023-09-09 04:41:42 +02:00
|
|
|
run: |
|
2023-09-08 07:00:47 +02:00
|
|
|
# Install docker so it can be used for datadog
|
|
|
|
brew install docker
|
|
|
|
colima start
|
2023-09-08 07:02:08 +02:00
|
|
|
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
|
2023-09-08 07:00:47 +02:00
|
|
|
- name: Set up Datadog
|
2024-02-05 07:29:04 +01:00
|
|
|
if: ${{ github.ref == 'refs/heads/master' && matrix.os != 'macos-14' }}
|
2023-09-08 07:00:47 +02:00
|
|
|
uses: datadog/agent-github-action@v1.3
|
|
|
|
with:
|
|
|
|
api_key: ${{ secrets.DD_API_KEY }}
|
2023-10-11 07:20:07 +02:00
|
|
|
- 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
|
2023-09-03 02:58:36 +02:00
|
|
|
- name: Go test
|
2023-09-08 18:59:55 +02:00
|
|
|
env:
|
|
|
|
DD_API_KEY: ${{ secrets.DD_API_KEY }}
|
2023-11-12 10:27:05 +01:00
|
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
2023-09-03 02:58:36 +02:00
|
|
|
run: |
|
2023-12-21 04:57:02 +01:00
|
|
|
go install gotest.tools/gotestsum@bc98120
|
2023-10-22 00:41:32 +02:00
|
|
|
make test
|
2023-10-23 04:37:09 +02:00
|
|
|
- name: Extra Delay
|
|
|
|
run: |
|
|
|
|
|
|
|
|
# Add an extra short delay to allow datadog to flush metrics
|
|
|
|
sleep 300 # 5 minutes
|
2023-12-03 22:15:38 +01:00
|
|
|
- name: Upload test results json
|
2023-10-22 09:21:47 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2023-10-22 20:12:11 +02:00
|
|
|
if: success() || failure()
|
2023-10-22 09:21:47 +02:00
|
|
|
with:
|
2023-12-04 01:47:09 +01:00
|
|
|
name: test-results-${{ matrix.os }}.json
|
2023-10-22 09:21:47 +02:00
|
|
|
path: /tmp/testrun.json
|
2023-12-03 22:15:38 +01:00
|
|
|
- name: Upload failed test goldens
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
if: success() || failure()
|
|
|
|
with:
|
2023-12-29 04:32:09 +01:00
|
|
|
name: test-goldens-${{ matrix.os }}.zip
|
2023-12-03 22:15:38 +01:00
|
|
|
path: /tmp/test-goldens/
|
2023-12-21 00:02:16 +01:00
|
|
|
- name: Upload test log
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
if: success() || failure()
|
|
|
|
with:
|
2023-12-22 03:27:46 +01:00
|
|
|
name: testlog-${{ matrix.os }}.txt
|
2023-12-21 00:02:16 +01:00
|
|
|
path: /tmp/test.log
|
2023-10-22 09:21:47 +02:00
|
|
|
|
2023-09-03 03:25:09 +02:00
|
|
|
# - name: Setup tmate session
|
|
|
|
# if: ${{ failure() }}
|
|
|
|
# uses: mxschmitt/action-tmate@v3
|
|
|
|
# with:
|
|
|
|
# limit-access-to-actor: true
|