mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-06 00:39:40 -06:00
131 lines
3.7 KiB
YAML
131 lines
3.7 KiB
YAML
name: Test Go
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'go/**'
|
|
- '.github/workflows/ci-go-tests.yaml'
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ci-go-tests-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
name: Go tests
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, ubuntu-22.04, windows-latest]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Go 1.x
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go/go.mod
|
|
id: go
|
|
- name: Install ICU4C (MacOS)
|
|
if: ${{ matrix.os == 'macos-latest' }}
|
|
run: |
|
|
dir=$(brew --cellar icu4c)
|
|
dir="$dir"/$(ls "$dir")
|
|
echo CGO_CPPFLAGS=-I$dir/include >> $GITHUB_ENV
|
|
echo CGO_LDFLAGS=-L$dir/lib >> $GITHUB_ENV
|
|
- name: Install ICU4C (Windows)
|
|
id: msys2
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
path-type: inherit
|
|
msystem: UCRT64
|
|
pacboy: icu:p toolchain:p pkg-config:p
|
|
- name: Test All
|
|
working-directory: ./go
|
|
run: |
|
|
files=$(go list ./...)
|
|
SAVEIFS=$IFS
|
|
IFS=$'\n'
|
|
file_arr=($files)
|
|
IFS=$SAVEIFS
|
|
if [ "$MATRIX_OS" == 'windows-latest' ]; then
|
|
export PATH=$(cygpath -u "$MSYS2_LOCATION"/ucrt64/bin):"$PATH"
|
|
fi
|
|
|
|
for (( i=0; i<${#file_arr[@]}; i++ ))
|
|
do
|
|
# Skip binlog tests as they run in a separate CI job
|
|
if [[ "${file_arr[$i]}" == *binlogreplication* ]]; then
|
|
echo "Skipping binlog package: ${file_arr[$i]} (runs in separate CI)"
|
|
continue
|
|
fi
|
|
|
|
echo "Testing Package: ${file_arr[$i]}"
|
|
if [ "$MATRIX_OS" == 'ubuntu-22.04' ]
|
|
then
|
|
if [[ "${file_arr[$i]}" != *enginetest* ]]; then
|
|
go test -vet=off -timeout 45m -race "${file_arr[$i]}"
|
|
else
|
|
echo "skipping enginetests for -race"
|
|
fi
|
|
else
|
|
go test -vet=off -timeout 45m "${file_arr[$i]}"
|
|
fi
|
|
succeeded=$(echo "$?")
|
|
if [ "$succeeded" -ne 0 ]; then
|
|
echo "Testing failed in package ${file_arr[$i]}"
|
|
exit 1;
|
|
fi
|
|
done
|
|
env:
|
|
MATRIX_OS: ${{ matrix.os }}
|
|
MSYS2_LOCATION: ${{ steps.msys2.outputs.msys2-location }}
|
|
noracetest:
|
|
name: Go tests - no race
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, ubuntu-22.04, windows-latest]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Go 1.x
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go/go.mod
|
|
id: go
|
|
- name: Install ICU4C (MacOS)
|
|
if: ${{ matrix.os == 'macos-latest' }}
|
|
run: |
|
|
dir=$(brew --cellar icu4c)
|
|
dir="$dir"/$(ls "$dir")
|
|
echo CGO_CPPFLAGS=-I$dir/include >> $GITHUB_ENV
|
|
echo CGO_LDFLAGS=-L$dir/lib >> $GITHUB_ENV
|
|
- name: Install ICU4C (Windows)
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
|
id: msys2
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
path-type: inherit
|
|
msystem: UCRT64
|
|
pacboy: icu:p toolchain:p pkg-config:p
|
|
- name: Test All
|
|
working-directory: ./go
|
|
run: |
|
|
if [ "$MATRIX_OS" == 'windows-latest' ]; then
|
|
export PATH=$(cygpath -u "$MSYS2_LOCATION"/ucrt64/bin):"$PATH"
|
|
fi
|
|
go test -vet=off -timeout 30m ./libraries/doltcore/sqle/integration_test
|
|
env:
|
|
MATRIX_OS: ${{ matrix.os }}
|
|
DOLT_TEST_RUN_NON_RACE_TESTS: "true"
|
|
MSYS2_LOCATION: ${{ steps.msys2.outputs.msys2-location }}
|