|
| 1 | +name: Build & Test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - "develop" |
| 8 | + - "feature/**" |
| 9 | + paths-ignore: |
| 10 | + - ".github/**" |
| 11 | + - "docs/**" |
| 12 | + - "examples/**" |
| 13 | + - "*.md" |
| 14 | + - "*.yml" |
| 15 | +env: |
| 16 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 17 | + DOTNET_CLI_TELEMETRY_OPTOUT: 1 |
| 18 | + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: true |
| 19 | +defaults: |
| 20 | + run: |
| 21 | + shell: bash |
| 22 | + |
| 23 | +jobs: |
| 24 | + build: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + strategy: |
| 27 | + matrix: |
| 28 | + dotnet: |
| 29 | + [{ ch: "3.1", ver: "netcoreapp31" }, { ch: "6.0", ver: "net60" }] |
| 30 | + channel: ["nightly"] |
| 31 | + fail-fast: false |
| 32 | + |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v3 |
| 36 | + |
| 37 | + - name: Initialize Cache |
| 38 | + uses: actions/cache@v3 |
| 39 | + with: |
| 40 | + path: ~/.nuget/packages |
| 41 | + # Look to see if there is a cache hit for the corresponding requirements file |
| 42 | + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} |
| 43 | + restore-keys: | |
| 44 | + ${{ runner.os }}-nuget |
| 45 | +
|
| 46 | + - name: Initialize SurrealDB |
| 47 | + run: | |
| 48 | + mkdir -p ~/.local/bin || exit 1 |
| 49 | + mkdir -p ~/tmp || exit 1 |
| 50 | + pushd ~/tmp || exit 1 |
| 51 | +
|
| 52 | + curl -sSf https://install.surrealdb.com -o ./surealdb-install.sh |
| 53 | + chmod +x ./surealdb-install.sh |
| 54 | + ./surealdb-install.sh ~/.local/bin --${{ matrix.channel }} |
| 55 | + export PATH="$HOME/.local/bin/:$PATH" |
| 56 | +
|
| 57 | + popd |
| 58 | +
|
| 59 | + surreal version || exit 1 |
| 60 | +
|
| 61 | + - name: Initialize .NET SDK |
| 62 | + run: | |
| 63 | + curl https://dot.net/v1/dotnet-install.sh -o ~/dotnet-install.sh |
| 64 | + chmod +x ~/dotnet-install.sh |
| 65 | + ~/dotnet-install.sh -c ${{ matrix.dotnet.ch }} |
| 66 | + dotnet --info |
| 67 | +
|
| 68 | + - name: Restore Dependencies |
| 69 | + run: dotnet restore |
| 70 | + |
| 71 | + - name: Build Solution |
| 72 | + run: dotnet build --no-restore -f:${{ matrix.dotnet.ver }} |
| 73 | + |
| 74 | + - name: Execute Unit-Tests |
| 75 | + run: | |
| 76 | + dotnet test --no-build -f:${{ matrix.dotnet.ver }} --verbosity normal --logger "trx;LogFileName=$(pwd)/test-results.trx" --collect:"XPlat Code Coverage" /p:CollectCoverage=true /p:CoverletOutputFormat=\"cobertura\" /p:CoverletOutput="$(pwd)/" /p:UseSourceLink=true |
| 77 | +
|
| 78 | + - name: Test Report |
| 79 | + if: success() || failure() |
| 80 | + uses: phoenix-actions/test-reporting@v8 |
| 81 | + with: |
| 82 | + name: results-${{ matrix.dotnet.ver }}-${{ matrix.channel }} |
| 83 | + path: test-results.trx |
| 84 | + reporter: dotnet-trx |
| 85 | + fail-on-error: false |
| 86 | + |
| 87 | + - name: Test Coverage |
| 88 | + if: ${{ github.ref == 'refs/heads/master' }} |
| 89 | + uses: codecov/codecov-action@v3 |
| 90 | + with: |
| 91 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 92 | + files: ./coverage.cobertura.xml |
| 93 | + flags: unittests |
| 94 | + name: Surreal.Net |
| 95 | + fail_ci_if_error: false |
| 96 | + verbose: true |
0 commit comments