mirror of
https://github.com/alexhopeoconnor/binarylane-dotnet.git
synced 2026-10-04 02:18:11 +10:00
92 lines
3.1 KiB
YAML
92 lines
3.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
|
DOTNET_NOLOGO: 1
|
|
NUGET_XMLDOC_MODE: skip
|
|
|
|
jobs:
|
|
build-test-pack:
|
|
name: Build, test, and pack
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
|
|
- name: Set up .NET
|
|
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6
|
|
with:
|
|
dotnet-version: 8.0.x
|
|
global-json-file: global.json
|
|
cache: true
|
|
cache-dependency-path: '**/packages.lock.json'
|
|
|
|
- name: Restore locked dependencies
|
|
run: |
|
|
dotnet restore src/BinaryLane.Api/BinaryLane.Api.csproj --locked-mode
|
|
dotnet restore tests/BinaryLane.Api.Tests/BinaryLane.Api.Tests.csproj --locked-mode
|
|
dotnet restore examples/BinaryLane.Api.Demo/BinaryLane.Api.Demo.csproj --locked-mode
|
|
|
|
- name: Build
|
|
run: |
|
|
dotnet build src/BinaryLane.Api/BinaryLane.Api.csproj --configuration Release --no-restore /p:ContinuousIntegrationBuild=true -p:BuildInParallel=false
|
|
dotnet build tests/BinaryLane.Api.Tests/BinaryLane.Api.Tests.csproj --configuration Release --no-restore /p:ContinuousIntegrationBuild=true -p:BuildInParallel=false
|
|
dotnet build examples/BinaryLane.Api.Demo/BinaryLane.Api.Demo.csproj --configuration Release --no-restore /p:ContinuousIntegrationBuild=true -p:BuildInParallel=false
|
|
|
|
- name: Test
|
|
run: >-
|
|
dotnet test tests/BinaryLane.Api.Tests/BinaryLane.Api.Tests.csproj --configuration Release --no-build
|
|
-m:1
|
|
--logger "trx;LogFileName=test-results.trx"
|
|
--results-directory TestResults
|
|
|
|
- name: Verify formatting
|
|
run: |
|
|
dotnet format src/BinaryLane.Api/BinaryLane.Api.csproj --verify-no-changes --no-restore
|
|
dotnet format tests/BinaryLane.Api.Tests/BinaryLane.Api.Tests.csproj --verify-no-changes --no-restore
|
|
dotnet format examples/BinaryLane.Api.Demo/BinaryLane.Api.Demo.csproj --verify-no-changes --no-restore
|
|
|
|
- name: Pack
|
|
run: >-
|
|
dotnet pack src/BinaryLane.Api/BinaryLane.Api.csproj
|
|
--configuration Release --no-build --output artifacts
|
|
-p:BuildInParallel=false
|
|
|
|
- name: Compile the demo against the packed package
|
|
run: ./eng/test-demo-package.sh artifacts
|
|
|
|
- name: Upload NuGet packages
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
with:
|
|
name: nuget-packages
|
|
path: artifacts/
|
|
if-no-files-found: error
|
|
retention-days: 14
|
|
|
|
- name: Upload test results
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
with:
|
|
name: test-results
|
|
path: TestResults/
|
|
if-no-files-found: ignore
|
|
retention-days: 14
|