From d3d76ba31212f0c5f84d14a2da709e025bf209a0 Mon Sep 17 00:00:00 2001 From: Thanh Nguyen Date: Sat, 23 Dec 2023 11:40:43 +1100 Subject: [PATCH] CI: optimize CI action --- .github/workflows/ci.yaml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e1eec17..e42f69d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,8 @@ on: workflow_call: env: - COVER_PKG: github.com/btnguyen2k/gocosmos + COVER_PKG: 'github.com/btnguyen2k/gocosmos' + COSMOSDB_URL: 'AccountEndpoint=https://127.0.0.1:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;TimeoutMs=30000' jobs: GoFmt: @@ -111,9 +112,8 @@ jobs: go-version: ${{ matrix.go }} - name: Run tests run: | - export COSMOSDB_URL="AccountEndpoint=https://127.0.0.1:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;TimeoutMs=30000" cd module_test && \ - go test -v -timeout 9999s -count 1 -p 1 -cover -coverpkg="$env:COVER_PKG" -coverprofile="../coverage_other.txt" -run "TestNew|TestDriver_" ./ && \ + go test -v -timeout 9999s -count 1 -p 1 -cover -coverpkg="${COVER_PKG}" -coverprofile="../coverage_other.txt" -run "TestNew|TestDriver_" ./ && \ cd .. - name: Codecov uses: codecov/codecov-action@v3 @@ -141,10 +141,9 @@ jobs: try { & "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" /ShutDown } catch {} choco upgrade azure-cosmosdb-emulator --no-progress & "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" /DisableRateLimiting /NoUI /NoExplorer - Start-Sleep -s 75 + Start-Sleep -s 90 try { Invoke-RestMethod -Method GET https://127.0.0.1:8081/ } catch {} netstat -nt - $env:COSMOSDB_URL='AccountEndpoint=https://127.0.0.1:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;TimeoutMs=30000' cd module_test go test -v -timeout 9999s -count 1 -p 1 -cover -coverpkg="$env:COVER_PKG" -coverprofile="../coverage_restclient_nonquery.txt" -run "TestRestClient_[^Q]" ./ cd .. @@ -174,10 +173,9 @@ jobs: try { & "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" /ShutDown } catch {} choco upgrade azure-cosmosdb-emulator --no-progress & "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" /DisableRateLimiting /NoUI /NoExplorer - Start-Sleep -s 75 + Start-Sleep -s 90 try { Invoke-RestMethod -Method GET https://127.0.0.1:8081/ } catch {} netstat -nt - $env:COSMOSDB_URL='AccountEndpoint=https://127.0.0.1:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;TimeoutMs=30000' cd module_test go test -v -timeout 9999s -count 1 -p 1 -cover -coverpkg="$env:COVER_PKG" -coverprofile="../coverage_restclient_query.txt" -run "TestRestClient_QueryDocuments" ./ cd .. @@ -207,10 +205,9 @@ jobs: try { & "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" /ShutDown } catch {} choco upgrade azure-cosmosdb-emulator --no-progress & "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" /DisableRateLimiting /NoUI /NoExplorer - Start-Sleep -s 75 + Start-Sleep -s 90 try { Invoke-RestMethod -Method GET https://127.0.0.1:8081/ } catch {} netstat -nt - $env:COSMOSDB_URL='AccountEndpoint=https://127.0.0.1:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;TimeoutMs=30000' cd module_test go test -v -timeout 9999s -count 1 -p 1 -cover -coverpkg="$env:COVER_PKG" -coverprofile="../coverage_driver_database.txt" -run "TestStmt.*Databases?_(Exec|Query)" ./ cd .. @@ -240,10 +237,9 @@ jobs: try { & "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" /ShutDown } catch {} choco upgrade azure-cosmosdb-emulator --no-progress & "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" /DisableRateLimiting /NoUI /NoExplorer - Start-Sleep -s 75 + Start-Sleep -s 90 try { Invoke-RestMethod -Method GET https://127.0.0.1:8081/ } catch {} netstat -nt - $env:COSMOSDB_URL='AccountEndpoint=https://127.0.0.1:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;TimeoutMs=30000' cd module_test go test -v -timeout 9999s -count 1 -p 1 -cover -coverpkg="$env:COVER_PKG" -coverprofile="../coverage_driver_collection.txt" -run "TestStmt.*Collections?_(Exec|Query)" ./ cd .. @@ -273,10 +269,9 @@ jobs: try { & "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" /ShutDown } catch {} choco upgrade azure-cosmosdb-emulator --no-progress & "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" /DisableRateLimiting /NoUI /NoExplorer - Start-Sleep -s 75 + Start-Sleep -s 90 try { Invoke-RestMethod -Method GET https://127.0.0.1:8081/ } catch {} netstat -nt - $env:COSMOSDB_URL='AccountEndpoint=https://127.0.0.1:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;TimeoutMs=30000' cd module_test go test -v -timeout 9999s -count 1 -p 1 -cover -coverpkg="$env:COVER_PKG" -coverprofile="../coverage_driver_document_non_query.txt" -run "TestStmt(Insert|Upsert|Update|Delete)_(Exec|Query)" ./ cd .. @@ -306,10 +301,9 @@ jobs: try { & "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" /ShutDown } catch {} choco upgrade azure-cosmosdb-emulator --no-progress & "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" /DisableRateLimiting /NoUI /NoExplorer - Start-Sleep -s 75 + Start-Sleep -s 90 try { Invoke-RestMethod -Method GET https://127.0.0.1:8081/ } catch {} netstat -nt - $env:COSMOSDB_URL='AccountEndpoint=https://127.0.0.1:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;TimeoutMs=30000' cd module_test go test -v -timeout 9999s -count 1 -p 1 -cover -coverpkg="$env:COVER_PKG" -coverprofile="../coverage_driver_document_query.txt" -run "TestStmtSelect_(Exec|Query)" ./ cd ..