-
-
Notifications
You must be signed in to change notification settings - Fork 82
94 lines (84 loc) · 2.33 KB
/
pullRequest.yml
File metadata and controls
94 lines (84 loc) · 2.33 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
name: Build Pull Requests
on:
pull_request:
branches: [ master ]
jobs:
detect-changes:
permissions:
contents: read
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.changes.outputs.backend }}
client: ${{ steps.changes.outputs.client }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Detect file changes
id: changes
run: |
# Fetch the base branch
git fetch origin ${{ github.base_ref }}
# Get changed files
CHANGED_FILES=$(git diff origin/${{ github.base_ref }}...HEAD --name-only)
# Initialize flags
HAS_BACKEND=false
HAS_CLIENT=false
# Check for changes in each directory
if echo "$CHANGED_FILES" | grep -q '^src/'; then
HAS_BACKEND=true
fi
if echo "$CHANGED_FILES" | grep -q '^client/'; then
HAS_CLIENT=true
fi
# Set outputs
echo "backend=$HAS_BACKEND" >> $GITHUB_OUTPUT
echo "client=$HAS_CLIENT" >> $GITHUB_OUTPUT
# Debug output
echo "Changed files:"
echo "$CHANGED_FILES"
echo "Backend changes: $HAS_BACKEND"
echo "Client changes: $HAS_CLIENT"
build-backend:
permissions:
contents: read
needs: detect-changes
if: needs.detect-changes.outputs.backend == 'true'
runs-on: ubuntu-latest
env:
HUSKY: 0
steps:
- uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Test
run: dotnet test -c Release --no-build --verbosity normal
build-client:
permissions:
contents: read
needs: detect-changes
if: needs.detect-changes.outputs.client == 'true'
runs-on: ubuntu-latest
env:
HUSKY: 0
steps:
- uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
working-directory: ./client
run: npm install
- name: Build
working-directory: ./client
run: npm run build
- name: Test
working-directory: ./client
run: npm test