-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (64 loc) · 2.26 KB
/
Copy pathpull_request.yml
File metadata and controls
68 lines (64 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Pull Request
on:
pull_request:
branches: [main]
# Default to no permissions; the job widens only what it needs.
permissions: {}
env:
DOTNET_VERSION: '10.0.x'
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17@sha256:2203e6282d9e7de7c24d7da234e2a744fb325df366a3fd8ed940e8abbee39527
env:
POSTGRES_USER: trax
POSTGRES_PASSWORD: trax123
POSTGRES_DB: trax_data_tests
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U trax"
--health-interval=10s
--health-timeout=5s
--health-retries=5
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Harden runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Guard against local-dev lockfile versions
run: |
if grep -rln '"resolved": "1.99.99"' --include=packages.lock.json . ; then
echo "::error::A packages.lock.json contains the local-dev version 1.99.99. Regenerate lockfiles in CI mode (remove trax-local.props) before committing."
exit 1
fi
- name: Setup .NET
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
dotnet-quality: preview
- name: Restore tools
run: dotnet tool restore
- name: Check formatting
run: dotnet csharpier check .
- name: Restore (locked)
run: dotnet restore --locked-mode
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --collect:"XPlat Code Coverage" --results-directory ./TestResults
- name: Upload coverage to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
directory: ./TestResults
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}