Added all unit-tests to CI #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow will build a golang project | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
| name: Go | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| services: | |
| # Database service containers | |
| mariadb-vector: | |
| image: mariadb:11.7.2 | |
| env: | |
| MYSQL_ROOT_PASSWORD: password | |
| MYSQL_DATABASE: perfkit_db_ci | |
| MYSQL_USER: user | |
| MYSQL_PASSWORD: password | |
| # Disable features that cause warnings in GitHub Actions | |
| MARIADB_INNODB_USE_NATIVE_AIO: "0" | |
| ports: | |
| - 3306:3306 | |
| # Additional options to handle GitHub Actions environment limitations | |
| options: >- | |
| --health-cmd "mysqladmin ping -h localhost -u root -ppassword" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| --health-start-period 40s | |
| --tmpfs /tmp:rw | |
| --tmpfs /run/mysqld:rw | |
| postgres: | |
| image: ankane/pgvector:v0.5.1 | |
| env: | |
| POSTGRES_USER: root | |
| POSTGRES_PASSWORD: password | |
| POSTGRES_DB: perfkit_pg_vector_db_ci | |
| ports: | |
| - 5432:5432 | |
| # Health check to wait until postgres is ready | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| elasticsearch: | |
| image: docker.elastic.co/elasticsearch/elasticsearch:8.15.1 | |
| env: | |
| node.name: es-test | |
| cluster.name: es-docker-cluster | |
| bootstrap.memory_lock: true | |
| discovery.type: single-node | |
| ES_JAVA_OPTS: -Xms512m -Xmx512m | |
| xpack.security.enabled: false | |
| xpack.security.http.ssl.enabled: false | |
| xpack.security.transport.ssl.enabled: false | |
| ports: | |
| - 9200:9200 | |
| # Health check for Elasticsearch | |
| options: >- | |
| --health-cmd "curl -s http://localhost:9200/_cluster/health || exit 1" | |
| --health-interval 20s | |
| --health-timeout 10s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.22' | |
| - name: Install database clients | |
| run: | | |
| # Install PostgreSQL client | |
| sudo apt-get update | |
| sudo apt-get install -y postgresql-client | |
| - name: Create vector extension | |
| run: PGPASSWORD=password psql -h localhost -U root -d perfkit_pg_vector_db_ci -c "CREATE EXTENSION vector;" | |
| - name: Test with Coverage | |
| run: go test -v -coverprofile=coverage.txt -covermode=atomic ./db/sql/... | |
| - name: Upload results to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} |