This repository was archived by the owner on May 26, 2026. It is now read-only.
Repository navigation
148 lines (120 loc) · 4.88 KB
/
Copy pathMergeToMain.yml
File metadata and controls
148 lines (120 loc) · 4.88 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Merge Pull Requests into 'main'
on:
push:
branches: [main]
paths-ignore:
- '.editorconfig'
- 'README.md'
- 'ChangeLog.md'
- '.github/CODE_OF_CONDUCT.md'
- '.github/CONTRIBUTING.md'
- '.github/FUNDING.yml'
- '.github/workflows/PullRequest.yml'
- '.github/workflows/Release.yml'
permissions:
packages: write
env:
DOTNET_NOLOGO: true
jobs:
pull_docker_images:
name: 🐳 Pull Docker images
runs-on: ubuntu-latest
outputs:
mssql-image: ${{ steps.pull-images.outputs.mssql-image }}
postgres-image: ${{ steps.pull-images.outputs.postgres-image }}
ryuk-image: ${{ steps.pull-images.outputs.ryuk-image }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
- name: Pull and cache Docker images
id: pull-images
uses: ./.github/actions/pull-and-cache-docker-images
build_and_create_a_nuget:
name: 📦 Build and publish a NuGet (to GPR only) (RELEASE)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Build version prefix/suffix
run: |
echo "VERSION_PREFIX=$(( ${{ github.run_number }} )).0.0" >> $GITHUB_ENV
echo "VERSION_SUFFIX=beta" >> $GITHUB_ENV
- name: Setup .NET
uses: actions/setup-dotnet@v5
- run: dotnet restore --verbosity minimal --locked-mode
- run: dotnet build --configuration Release -p:ContinuousIntegrationBuild=true -p:DebugType=Embedded -p:VersionPrefix=$VERSION_PREFIX --version-suffix $VERSION_SUFFIX
- run: dotnet pack --configuration Release --no-build --output ./artifacts -p:DebugType=Embedded -p:VersionPrefix=$VERSION_PREFIX --version-suffix $VERSION_SUFFIX
- name: Publish artifacts
uses: actions/upload-artifact@v7
with:
name: NuGetPackage.${{ env.VERSION_PREFIX }}-${{ env.VERSION_SUFFIX }}
path: ./artifacts/
- name: Publish to GPR
run: |
dotnet nuget push "./artifacts/*.nupkg" \
--no-symbols \
--api-key ${{ secrets.GITHUB_TOKEN }} \
--source https://nuget.pkg.github.com/${{ github.repository_owner }}
build_debug:
name: 🏗️ Build (DEBUG)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
- name: Restore NuGet packages
run: dotnet restore --verbosity minimal --locked-mode
- name: Build solution
run: dotnet build --configuration Debug --no-restore
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: build-debug
path: |
**/bin/Debug/**
**/obj/**
test:
name: 🧪 Test ${{ matrix.target.name }} (DEBUG)
runs-on: ubuntu-latest
needs: [pull_docker_images, build_debug]
env:
CODECOVERAGE_DIR: ${{ github.workspace }}/.codecoverage
strategy:
fail-fast: false
matrix:
target:
- name: MsSql
project: src/SimpleTestcontainers.xUnit.v3.MsSql.Tests/SimpleTestcontainers.xUnit.v3.MsSql.Tests.csproj
cache-file: mssql.tar
- name: PostgreSQL
project: src/SimpleTestcontainers.xUnit.v3.PostgreSQL.Tests/SimpleTestcontainers.xUnit.v3.PostgreSQL.Tests.csproj
cache-file: postgres.tar
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Download build artifacts
uses: actions/download-artifact@v8
with:
name: build-debug
- name: Restore executable permissions
run: find . -type f -path '*/bin/Debug/*' -exec chmod +x {} \;
- name: Load cached Docker image
uses: ./.github/actions/load-cached-docker-image
with:
cache-file: ${{ matrix.target.cache-file }}
mssql-image: ${{ needs.pull_docker_images.outputs.mssql-image }}
postgres-image: ${{ needs.pull_docker_images.outputs.postgres-image }}
ryuk-image: ${{ needs.pull_docker_images.outputs.ryuk-image }}
- name: Setup .NET
uses: actions/setup-dotnet@v5
- name: Test - ${{ matrix.target.name }}
run: dotnet run --project ${{ matrix.target.project }} --configuration Debug --verbosity minimal --no-build -- --coverage --coverage-output-format cobertura --coverage-output ${{ env.CODECOVERAGE_DIR }}/coverage.cobertura-${{ matrix.target.name }}.xml
- name: Code coverage
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ${{ env.CODECOVERAGE_DIR }}
fail_ci_if_error: true