Repository navigation
73 lines (63 loc) · 2.54 KB
/
Copy pathci.yml
File metadata and controls
73 lines (63 loc) · 2.54 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
69
70
71
72
73
name: CI
on:
push:
branches: [ main ]
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Restore
run: dotnet restore
# Build also runs the Roslyn analyzers (latest-recommended); warnings are
# errors, so a static-analysis finding fails the build.
- name: Build (static analysis)
run: dotnet build -c Release --no-restore
# The xUnit suite runs against Moq-mocked DotPulsar IProducer/IConsumer/IMessage —
# no Pulsar, no network.
# The conformance runner also writes results.json (ADR-0032) to BQ_CONFORMANCE_RESULTS.
- name: Test with coverage gate (>=90% line)
env:
BQ_CONFORMANCE_RESULTS: ${{ runner.temp }}/results.json
run: dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:Threshold=90 /p:ThresholdType=line /p:ThresholdStat=total
- name: Upload conformance results
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: conformance-results
path: ${{ runner.temp }}/results.json
if-no-files-found: warn
conformance:
name: Conformance suite in sync
runs-on: ubuntu-latest
env:
BQ_CONFORMANCE_VERSION: 1.8.0
# sha256 of that release's fetch.sh: the script runs on the runner, so it is pinned rather
# than trusted from a mutable tag. Bump together with BQ_CONFORMANCE_VERSION.
BQ_FETCH_SH_SHA256: 8bb6ba567b288fb0ac71a70fd17041b2503df119e01998d76fdad372570bf849
steps:
- uses: actions/checkout@v5
- name: Verify vendored conformance matches the pinned release asset
run: |
curl --fail --silent --show-error --location --output "$RUNNER_TEMP/fetch.sh" \
"https://raw.githubusercontent.com/BabelQueue/conformance/v${BQ_CONFORMANCE_VERSION}/fetch.sh"
echo "${BQ_FETCH_SH_SHA256} $RUNNER_TEMP/fetch.sh" | sha256sum -c -
bash "$RUNNER_TEMP/fetch.sh" --check "$BQ_CONFORMANCE_VERSION" "tests/BabelQueue.Pulsar.Tests/conformance"
ci-green:
name: CI green
runs-on: ubuntu-latest
needs: [test, conformance]
if: ${{ always() }}
steps:
- name: Fail if any required job did not pass
run: |
if ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}; then
echo "A required job failed or was cancelled."
exit 1
fi