Merge pull request #19 from CodeLogicIncEngineering/renovate/snowflak… #34
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
| name: Main Build | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '*' | |
| - '!/docs/*' # Don't run workflow when files are only in the /docs directory | |
| jobs: | |
| vm-job: | |
| name: Ubuntu | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres | |
| ports: | |
| - 5432/tcp | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: test | |
| options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| sqlserver: | |
| image: mcr.microsoft.com/mssql/server:2019-latest | |
| ports: | |
| - 1433/tcp | |
| env: | |
| ACCEPT_EULA: Y | |
| SA_PASSWORD: "Password." | |
| mysql: | |
| image: mysql | |
| ports: | |
| - 3306/tcp | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v1 | |
| - name: Setup dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.0.x' | |
| - name: .NET Build | |
| id: build | |
| run: | | |
| set -o pipefail | |
| dotnet build Build.csproj -c Release /p:CI=true 2>&1 | tee build.log | |
| - name: Dapper Tests | |
| id: test | |
| run: | | |
| set -o pipefail | |
| dotnet test tests/Dapper.Tests/Dapper.Tests.csproj -c Release --logger GitHubActions -p:CI=true -p:TestTfmsInParallel=false 2>&1 | tee test.log | |
| env: | |
| MySqlConnectionString: Server=localhost;Port=${{ job.services.mysql.ports[3306] }};Uid=root;Pwd=root;Database=test;Allow User Variables=true | |
| OLEDBConnectionString: Provider=SQLOLEDB;Server=tcp:localhost,${{ job.services.sqlserver.ports[1433] }};Database=tempdb;User Id=sa;Password=Password.; | |
| PostgesConnectionString: Server=localhost;Port=${{ job.services.postgres.ports[5432] }};Database=test;User Id=postgres;Password=postgres; | |
| SqlServerConnectionString: Server=tcp:localhost,${{ job.services.sqlserver.ports[1433] }};Database=tempdb;User Id=sa;Password=Password.; | |
| - name: .NET Lib Pack | |
| run: dotnet pack Build.csproj --no-build -c Release /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true | |
| - name: CodeLogic Agent Scan | |
| if: success() && github.ref == 'refs/heads/main' | |
| run: | | |
| docker run --pull always --rm \ | |
| --env CODELOGIC_HOST="https://dapper.app.codelogic.com" \ | |
| --env AGENT_UUID="${{ secrets.AGENT_UUID }}" \ | |
| --env AGENT_PASSWORD="${{ secrets.AGENT_PASSWORD }}" \ | |
| --volume "${{ github.workspace }}/Dapper/bin/Release/net461:/scan" \ | |
| dapper.app.codelogic.com/codelogic_dotnet:latest analyze \ | |
| --application "dapper-app" \ | |
| --scan-space-name "dapper-ss" \ | |
| --path /scan \ | |
| -m "Dapper" \ | |
| --rescan \ | |
| -e | |
| - name: Send Build Info on Failure | |
| if: failure() | |
| run: | | |
| LOG_FILE_ARGS="" | |
| # Prioritize build failure, then test failure | |
| if [ "${{ steps.build.outcome }}" == "failure" ] && [ -f "build.log" ]; then | |
| LOG_FILE_ARGS="--log-file=/log_file_path/build.log --log-lines=10000" | |
| elif [ "${{ steps.test.outcome }}" == "failure" ] && [ -f "test.log" ]; then | |
| LOG_FILE_ARGS="--log-file=/log_file_path/test.log --log-lines=10000" | |
| fi | |
| docker run --rm \ | |
| --env CODELOGIC_HOST="https://dapper.app.codelogic.com" \ | |
| --env AGENT_UUID="${{ secrets.AGENT_UUID }}" \ | |
| --env AGENT_PASSWORD="${{ secrets.AGENT_PASSWORD }}" \ | |
| --volume "${{ github.workspace }}:/scan" \ | |
| --volume "${{ github.workspace }}:/log_file_path" \ | |
| dapper.app.codelogic.com/codelogic_dotnet:latest send_build_info \ | |
| --pipeline-system="GitHub Actions" \ | |
| --job-name="${{ github.job }}" \ | |
| --build-number="${{ github.run_number }}" \ | |
| --build-status="FAILURE" \ | |
| --path="/scan" \ | |
| $LOG_FILE_ARGS | |
| continue-on-error: true |