Skip to content

Workflow file for this run

name: pull-request
on:
pull_request:
branches: [ main ]
permissions:
contents: read
issues: read
checks: write
pull-requests: write
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ["7", "8"]
steps:
- uses: actions/checkout@v4
- name: Setup dotnet ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Display dotnet version
run: dotnet --version
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build Postal.sln
- name: Test
run: dotnet test --logger "trx;LogFileName=TestResults-${{ matrix.dotnet-version }}.trx"
- name: Upload dotnet test results
uses: actions/upload-artifact@v3
if: always()
with:
name: dotnet-results-${{ matrix.dotnet-version }}
path: "./**/TestResults/TestResults-${{ matrix.dotnet-version }}.trx"
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: "./**/TestResults/TestResults-${{ matrix.dotnet-version }}.trx"
test-pack:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
7
8
- name: Display dotnet version
run: dotnet --version
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Add SHORT_SHA env property with commit short sha
run: |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
echo "GITHUB_RELEASE=true" >> $GITHUB_ENV
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release Postal.sln
- name: Create the package
run: dotnet pack src/Postal.AspNetCore/Postal.AspNetCore.csproj -c Release
- name: List src/Postal.AspNetCore/bin/Release/
run: ls -la src/Postal.AspNetCore/bin/Release/