hishtory/.github/workflows/go-test.yml

127 lines
4.1 KiB
YAML
Raw Normal View History

name: Go Tests
2022-04-09 20:56:25 +02:00
on:
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:
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:
2022-04-17 19:50:37 +02:00
runs-on: ${{ matrix.os }}
needs: extra-delay
2022-04-17 19:50:37 +02:00
strategy:
matrix:
os: [ubuntu-latest, macos-latest, macos-14]
Run integration tests in parallel to speed up testing (#175) * Remove a few direct DB insertions to prepare for parallel tests * Revert "Remove a few direct DB insertions to prepare for parallel tests" This reverts commit f8a3552ad8b942d5ff98cc7722750a1640ebdc88. * Add rudimentary experiment of splitting tests into two chunks to make them faster * Add missing tag * Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks * Lay out the framework for checking goldens being used across all test runs * Fix missing brace * Revert "Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks" This reverts commit 06cc3eedbc5be6a09dbc3f274adcacd875eb25a8. * Add initial work towards checking that all goldens are used * Delete incorrect and unreferenced matrix * Upgrade actions/upload-artifact to see if that makes the download in the next job work * Alternatively, try downloading the artifact by name * Update golden checker to read all the golden artifacts * Swap to using glob to enumerate all golden files, rather than hardcoding them * Remove debugging commands * Remove goldens that are actually used * Remove another golden that is actually used * Add more comprehensive support for test sharding * Fix references to test shards and increase shard count * Shard the fuzz test * Add debug prints * Mark additional tests for sharding * Fix logic error that broke test sharding * Remove debug print * Fix incorrect logic with skipping the fuzz test * Move sharding functions to testutils and add some comments * Upgrade all setup-go actions to enable caching of deps * Remove goldens that don't exist * Remove new line * Reduce delay * Correct stage name * Remove incorrect skip code from the first version of sharding * Remove unused import * Reduce number of test shards to match GitHub's limit of 5 concurrent macos jobs * Use cask for installing homebrew to speed up github actions * More cleanup for unused goldens
2024-02-11 20:54:27 +01:00
test_shard: ["0", "1", "2", "3", "4"]
fail-fast: false
2022-04-09 20:56:25 +02:00
steps:
- uses: actions/checkout@v4
2022-04-09 20:56:25 +02:00
- name: Set up Go
uses: actions/setup-go@v4
2022-04-09 20:56:25 +02:00
with:
go-version: 1.21
- name: Linux Setup
2023-10-11 07:20:07 +02:00
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 '}}
Run integration tests in parallel to speed up testing (#175) * Remove a few direct DB insertions to prepare for parallel tests * Revert "Remove a few direct DB insertions to prepare for parallel tests" This reverts commit f8a3552ad8b942d5ff98cc7722750a1640ebdc88. * Add rudimentary experiment of splitting tests into two chunks to make them faster * Add missing tag * Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks * Lay out the framework for checking goldens being used across all test runs * Fix missing brace * Revert "Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks" This reverts commit 06cc3eedbc5be6a09dbc3f274adcacd875eb25a8. * Add initial work towards checking that all goldens are used * Delete incorrect and unreferenced matrix * Upgrade actions/upload-artifact to see if that makes the download in the next job work * Alternatively, try downloading the artifact by name * Update golden checker to read all the golden artifacts * Swap to using glob to enumerate all golden files, rather than hardcoding them * Remove debugging commands * Remove goldens that are actually used * Remove another golden that is actually used * Add more comprehensive support for test sharding * Fix references to test shards and increase shard count * Shard the fuzz test * Add debug prints * Mark additional tests for sharding * Fix logic error that broke test sharding * Remove debug print * Fix incorrect logic with skipping the fuzz test * Move sharding functions to testutils and add some comments * Upgrade all setup-go actions to enable caching of deps * Remove goldens that don't exist * Remove new line * Reduce delay * Correct stage name * Remove incorrect skip code from the first version of sharding * Remove unused import * Reduce number of test shards to match GitHub's limit of 5 concurrent macos jobs * Use cask for installing homebrew to speed up github actions * More cleanup for unused goldens
2024-02-11 20:54:27 +01:00
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/agent-github-action@v1.3
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
Run integration tests in parallel to speed up testing (#175) * Remove a few direct DB insertions to prepare for parallel tests * Revert "Remove a few direct DB insertions to prepare for parallel tests" This reverts commit f8a3552ad8b942d5ff98cc7722750a1640ebdc88. * Add rudimentary experiment of splitting tests into two chunks to make them faster * Add missing tag * Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks * Lay out the framework for checking goldens being used across all test runs * Fix missing brace * Revert "Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks" This reverts commit 06cc3eedbc5be6a09dbc3f274adcacd875eb25a8. * Add initial work towards checking that all goldens are used * Delete incorrect and unreferenced matrix * Upgrade actions/upload-artifact to see if that makes the download in the next job work * Alternatively, try downloading the artifact by name * Update golden checker to read all the golden artifacts * Swap to using glob to enumerate all golden files, rather than hardcoding them * Remove debugging commands * Remove goldens that are actually used * Remove another golden that is actually used * Add more comprehensive support for test sharding * Fix references to test shards and increase shard count * Shard the fuzz test * Add debug prints * Mark additional tests for sharding * Fix logic error that broke test sharding * Remove debug print * Fix incorrect logic with skipping the fuzz test * Move sharding functions to testutils and add some comments * Upgrade all setup-go actions to enable caching of deps * Remove goldens that don't exist * Remove new line * Reduce delay * Correct stage name * Remove incorrect skip code from the first version of sharding * Remove unused import * Reduce number of test shards to match GitHub's limit of 5 concurrent macos jobs * Use cask for installing homebrew to speed up github actions * More cleanup for unused goldens
2024-02-11 20:54:27 +01:00
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
Run integration tests in parallel to speed up testing (#175) * Remove a few direct DB insertions to prepare for parallel tests * Revert "Remove a few direct DB insertions to prepare for parallel tests" This reverts commit f8a3552ad8b942d5ff98cc7722750a1640ebdc88. * Add rudimentary experiment of splitting tests into two chunks to make them faster * Add missing tag * Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks * Lay out the framework for checking goldens being used across all test runs * Fix missing brace * Revert "Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks" This reverts commit 06cc3eedbc5be6a09dbc3f274adcacd875eb25a8. * Add initial work towards checking that all goldens are used * Delete incorrect and unreferenced matrix * Upgrade actions/upload-artifact to see if that makes the download in the next job work * Alternatively, try downloading the artifact by name * Update golden checker to read all the golden artifacts * Swap to using glob to enumerate all golden files, rather than hardcoding them * Remove debugging commands * Remove goldens that are actually used * Remove another golden that is actually used * Add more comprehensive support for test sharding * Fix references to test shards and increase shard count * Shard the fuzz test * Add debug prints * Mark additional tests for sharding * Fix logic error that broke test sharding * Remove debug print * Fix incorrect logic with skipping the fuzz test * Move sharding functions to testutils and add some comments * Upgrade all setup-go actions to enable caching of deps * Remove goldens that don't exist * Remove new line * Reduce delay * Correct stage name * Remove incorrect skip code from the first version of sharding * Remove unused import * Reduce number of test shards to match GitHub's limit of 5 concurrent macos jobs * Use cask for installing homebrew to speed up github actions * More cleanup for unused goldens
2024-02-11 20:54:27 +01:00
sleep 90
- name: Upload test results json
uses: actions/upload-artifact@v3
if: success() || failure()
with:
Run integration tests in parallel to speed up testing (#175) * Remove a few direct DB insertions to prepare for parallel tests * Revert "Remove a few direct DB insertions to prepare for parallel tests" This reverts commit f8a3552ad8b942d5ff98cc7722750a1640ebdc88. * Add rudimentary experiment of splitting tests into two chunks to make them faster * Add missing tag * Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks * Lay out the framework for checking goldens being used across all test runs * Fix missing brace * Revert "Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks" This reverts commit 06cc3eedbc5be6a09dbc3f274adcacd875eb25a8. * Add initial work towards checking that all goldens are used * Delete incorrect and unreferenced matrix * Upgrade actions/upload-artifact to see if that makes the download in the next job work * Alternatively, try downloading the artifact by name * Update golden checker to read all the golden artifacts * Swap to using glob to enumerate all golden files, rather than hardcoding them * Remove debugging commands * Remove goldens that are actually used * Remove another golden that is actually used * Add more comprehensive support for test sharding * Fix references to test shards and increase shard count * Shard the fuzz test * Add debug prints * Mark additional tests for sharding * Fix logic error that broke test sharding * Remove debug print * Fix incorrect logic with skipping the fuzz test * Move sharding functions to testutils and add some comments * Upgrade all setup-go actions to enable caching of deps * Remove goldens that don't exist * Remove new line * Reduce delay * Correct stage name * Remove incorrect skip code from the first version of sharding * Remove unused import * Reduce number of test shards to match GitHub's limit of 5 concurrent macos jobs * Use cask for installing homebrew to speed up github actions * More cleanup for unused goldens
2024-02-11 20:54:27 +01:00
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:
Run integration tests in parallel to speed up testing (#175) * Remove a few direct DB insertions to prepare for parallel tests * Revert "Remove a few direct DB insertions to prepare for parallel tests" This reverts commit f8a3552ad8b942d5ff98cc7722750a1640ebdc88. * Add rudimentary experiment of splitting tests into two chunks to make them faster * Add missing tag * Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks * Lay out the framework for checking goldens being used across all test runs * Fix missing brace * Revert "Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks" This reverts commit 06cc3eedbc5be6a09dbc3f274adcacd875eb25a8. * Add initial work towards checking that all goldens are used * Delete incorrect and unreferenced matrix * Upgrade actions/upload-artifact to see if that makes the download in the next job work * Alternatively, try downloading the artifact by name * Update golden checker to read all the golden artifacts * Swap to using glob to enumerate all golden files, rather than hardcoding them * Remove debugging commands * Remove goldens that are actually used * Remove another golden that is actually used * Add more comprehensive support for test sharding * Fix references to test shards and increase shard count * Shard the fuzz test * Add debug prints * Mark additional tests for sharding * Fix logic error that broke test sharding * Remove debug print * Fix incorrect logic with skipping the fuzz test * Move sharding functions to testutils and add some comments * Upgrade all setup-go actions to enable caching of deps * Remove goldens that don't exist * Remove new line * Reduce delay * Correct stage name * Remove incorrect skip code from the first version of sharding * Remove unused import * Reduce number of test shards to match GitHub's limit of 5 concurrent macos jobs * Use cask for installing homebrew to speed up github actions * More cleanup for unused goldens
2024-02-11 20:54:27 +01:00
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:
Run integration tests in parallel to speed up testing (#175) * Remove a few direct DB insertions to prepare for parallel tests * Revert "Remove a few direct DB insertions to prepare for parallel tests" This reverts commit f8a3552ad8b942d5ff98cc7722750a1640ebdc88. * Add rudimentary experiment of splitting tests into two chunks to make them faster * Add missing tag * Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks * Lay out the framework for checking goldens being used across all test runs * Fix missing brace * Revert "Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks" This reverts commit 06cc3eedbc5be6a09dbc3f274adcacd875eb25a8. * Add initial work towards checking that all goldens are used * Delete incorrect and unreferenced matrix * Upgrade actions/upload-artifact to see if that makes the download in the next job work * Alternatively, try downloading the artifact by name * Update golden checker to read all the golden artifacts * Swap to using glob to enumerate all golden files, rather than hardcoding them * Remove debugging commands * Remove goldens that are actually used * Remove another golden that is actually used * Add more comprehensive support for test sharding * Fix references to test shards and increase shard count * Shard the fuzz test * Add debug prints * Mark additional tests for sharding * Fix logic error that broke test sharding * Remove debug print * Fix incorrect logic with skipping the fuzz test * Move sharding functions to testutils and add some comments * Upgrade all setup-go actions to enable caching of deps * Remove goldens that don't exist * Remove new line * Reduce delay * Correct stage name * Remove incorrect skip code from the first version of sharding * Remove unused import * Reduce number of test shards to match GitHub's limit of 5 concurrent macos jobs * Use cask for installing homebrew to speed up github actions * More cleanup for unused goldens
2024-02-11 20:54:27 +01:00
name: testlog-${{ matrix.os }}-${{ matrix.test_shard }}.txt
path: /tmp/test.log
Run integration tests in parallel to speed up testing (#175) * Remove a few direct DB insertions to prepare for parallel tests * Revert "Remove a few direct DB insertions to prepare for parallel tests" This reverts commit f8a3552ad8b942d5ff98cc7722750a1640ebdc88. * Add rudimentary experiment of splitting tests into two chunks to make them faster * Add missing tag * Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks * Lay out the framework for checking goldens being used across all test runs * Fix missing brace * Revert "Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks" This reverts commit 06cc3eedbc5be6a09dbc3f274adcacd875eb25a8. * Add initial work towards checking that all goldens are used * Delete incorrect and unreferenced matrix * Upgrade actions/upload-artifact to see if that makes the download in the next job work * Alternatively, try downloading the artifact by name * Update golden checker to read all the golden artifacts * Swap to using glob to enumerate all golden files, rather than hardcoding them * Remove debugging commands * Remove goldens that are actually used * Remove another golden that is actually used * Add more comprehensive support for test sharding * Fix references to test shards and increase shard count * Shard the fuzz test * Add debug prints * Mark additional tests for sharding * Fix logic error that broke test sharding * Remove debug print * Fix incorrect logic with skipping the fuzz test * Move sharding functions to testutils and add some comments * Upgrade all setup-go actions to enable caching of deps * Remove goldens that don't exist * Remove new line * Reduce delay * Correct stage name * Remove incorrect skip code from the first version of sharding * Remove unused import * Reduce number of test shards to match GitHub's limit of 5 concurrent macos jobs * Use cask for installing homebrew to speed up github actions * More cleanup for unused goldens
2024-02-11 20:54:27 +01:00
- 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
2023-09-03 03:25:09 +02:00
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
Run integration tests in parallel to speed up testing (#175) * Remove a few direct DB insertions to prepare for parallel tests * Revert "Remove a few direct DB insertions to prepare for parallel tests" This reverts commit f8a3552ad8b942d5ff98cc7722750a1640ebdc88. * Add rudimentary experiment of splitting tests into two chunks to make them faster * Add missing tag * Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks * Lay out the framework for checking goldens being used across all test runs * Fix missing brace * Revert "Remove code that enforces that all goldens are used, since it is incompatible with how tests are currently split into chunks" This reverts commit 06cc3eedbc5be6a09dbc3f274adcacd875eb25a8. * Add initial work towards checking that all goldens are used * Delete incorrect and unreferenced matrix * Upgrade actions/upload-artifact to see if that makes the download in the next job work * Alternatively, try downloading the artifact by name * Update golden checker to read all the golden artifacts * Swap to using glob to enumerate all golden files, rather than hardcoding them * Remove debugging commands * Remove goldens that are actually used * Remove another golden that is actually used * Add more comprehensive support for test sharding * Fix references to test shards and increase shard count * Shard the fuzz test * Add debug prints * Mark additional tests for sharding * Fix logic error that broke test sharding * Remove debug print * Fix incorrect logic with skipping the fuzz test * Move sharding functions to testutils and add some comments * Upgrade all setup-go actions to enable caching of deps * Remove goldens that don't exist * Remove new line * Reduce delay * Correct stage name * Remove incorrect skip code from the first version of sharding * Remove unused import * Reduce number of test shards to match GitHub's limit of 5 concurrent macos jobs * Use cask for installing homebrew to speed up github actions * More cleanup for unused goldens
2024-02-11 20:54:27 +01:00
# 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.21
- name: Download artifact
uses: actions/download-artifact@v4
- name: Check all goldens were used
run: |
go run client/posttest/main.go check-goldens