test(Dtmgrpc.IntegrationTests): add workflow testing support #137
Workflow file for this run
This file contains 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
name: Build_And_GRPC_IntegrationTests | |
on: | |
push: | |
branches: [dev, main, "feat/**"] | |
pull_request: | |
branches: [dev, main] | |
jobs: | |
linux: | |
name: build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
services: | |
redis6379: | |
image: redis | |
ports: | |
- 6379:6379 | |
mysql: | |
image: "mysql:8.0" | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
-e MYSQL_ROOT_PASSWORD=123456 | |
--entrypoint sh mysql:8.0 -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password" | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET SDK 8.0.x | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Show dotnet Version | |
run: | | |
dotnet --list-sdks | |
dotnet --list-runtimes | |
- name: Create database | |
run: | | |
mysql -h127.0.0.1 -uroot -p123456 < /home/runner/work/client-csharp/client-csharp/sqls/barrier.mysql.sql | |
mysql -h127.0.0.1 -uroot -p123456 < /home/runner/work/client-csharp/client-csharp/sqls/busi.mysql.sql | |
- name: Setup DTM server | |
run: | | |
wget https://github.com/dtm-labs/dtm/releases/download/v1.18.0/dtm_1.18.0_linux_amd64.tar.gz | |
tar -xvf dtm_1.18.0_linux_amd64.tar.gz | |
pwd | |
mkdir /home/runner/work/client-csharp/client-csharp/logs | |
nohup ./dtm > /home/runner/work/client-csharp/client-csharp/logs/dtm.log 2>&1 & | |
sleep 5 | |
curl "127.0.0.1:36789/api/dtmsvr/newGid" | |
- name: Setup Busi Service | |
run: | | |
cd tests/BusiGrpcService | |
nohup dotnet run > /home/runner/work/client-csharp/client-csharp/logs/app.log 2>&1 & | |
- name: Run Integration Tests | |
run: | | |
dotnet build tests/Dtmgrpc.IntegrationTests/Dtmgrpc.IntegrationTests.csproj | |
dotnet test --framework=net8.0 tests/Dtmgrpc.IntegrationTests/Dtmgrpc.IntegrationTests.csproj | |
- name: Upload logs | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dtm-logs | |
path: /home/runner/work/client-csharp/client-csharp/logs |