Skip to content

Commit 7313d9e

Browse files
Add Pr pipeline and remove build/test/deploy pipeline from PRs
1 parent 9131941 commit 7313d9e

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

.github/workflows/Build-Test-And-Deploy.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: Build, Test, and Deploy EssentialCSharp.Web
33
on:
44
push:
55
branches: ["main"]
6-
pull_request:
7-
branches: ["main"]
86
workflow_dispatch:
97

108
permissions:
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: PR Build and Test EssentialCSharp.Web
2+
3+
on:
4+
pull_request:
5+
branches: ["main"]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up .NET Core
15+
uses: actions/setup-dotnet@v4
16+
with:
17+
global-json-file: global.json
18+
19+
- name: Set up dependency caching for faster builds
20+
uses: actions/cache@v4
21+
id: nuget-cache
22+
with:
23+
path: |
24+
~/.nuget/packages
25+
${{ github.workspace }}/**/obj/project.assets.json
26+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
27+
restore-keys: |
28+
${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
29+
${{ runner.os }}-nuget-
30+
31+
- name: Restore with dotnet
32+
run: dotnet restore /p:AccessToNugetFeed=false
33+
34+
- name: Build with dotnet
35+
run: dotnet build --configuration Release --no-restore /p:AccessToNugetFeed=false
36+
37+
- name: Run .NET Tests
38+
run: dotnet test --no-build --configuration Release /p:AccessToNugetFeed=false
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
43+
- name: Build Container Image
44+
uses: docker/build-push-action@v6
45+
with:
46+
file: ./EssentialCSharp.Web/Dockerfile
47+
context: .
48+
outputs: type=docker,dest=${{ github.workspace }}/essentialcsharpwebimage.tar
49+
cache-from: type=gha
50+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)