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 .. diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 5050679..7c96553 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -3,6 +3,7 @@ name: "CodeQL" on: push: branches: [ '*' ] + paths: [ '**.go' ] pull_request: branches: [ '*' ] schedule: