language: csharp
mono: none
dist: bionic
dotnet: 3.1
services:
  - postgresql
addons:
  postgresql: "10"
before_install:
- curl -s -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.0-amd64.deb
- sudo dpkg -i --force-confnew elasticsearch-7.8.0-amd64.deb
- sudo sed -i.old 's/-Xms1g/-Xms128m/' /etc/elasticsearch/jvm.options
- sudo sed -i.old 's/-Xmx1g/-Xmx128m/' /etc/elasticsearch/jvm.options
- echo -e '-XX:+DisableExplicitGC\n-Djdk.io.permissionsUseCanonicalPath=true\n-Dlog4j.skipJansi=true\n-server\n' | sudo tee -a /etc/elasticsearch/jvm.options
- sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch
- sudo systemctl start elasticsearch
- sudo chmod +x ./Scripts/install-clickhouse.sh && ./Scripts/install-clickhouse.sh
install:
  - dotnet restore
before_script:
  - sleep 30
script:
  - dotnet build --configuration Release
  - dotnet test Tests/YY.EventLogExportAssistant.Core.Tests/YY.EventLogExportAssistant.Core.Tests.csproj
  - dotnet test Tests/YY.EventLogExportAssistant.PostgreSQL.Tests/YY.EventLogExportAssistant.PostgreSQL.Tests.csproj
  - dotnet test Tests/YY.EventLogExportAssistant.ElasticSearch.Tests/YY.EventLogExportAssistant.ElasticSearch.Tests.csproj
  - dotnet test Tests/YY.EventLogExportAssistant.ClickHouse.Tests/YY.EventLogExportAssistant.ClickHouse.Tests.csproj
deploy:
  skip_cleanup: true
  provider: script
  script: chmod +x ./Scripts/deploy.sh && ./Scripts/deploy.sh $NUGET_API_KEY
  on:
    branch: master