Continuous Integration (CI) means automatically building and testing your code whenever you make changes.
🚦 Why Use CI?
- Catch bugs early before they hit production
- Ensure every commit is tested and builds
- Make teamwork smoother
⚙️ How Does CI Work?
- You push code to GitHub
- A CI service (like GitHub Actions) runs your tests and builds your app
- You get feedback if something breaks
📝 Example: GitHub Actions Workflow
Create a file .github/workflows/dotnet.yml
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
name: .NET Build and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Build
run: dotnet build --configuration Release
- name: Test
run: dotnet test
💡 Try It!
Push your code to GitHub and see the Actions tab for automatic builds and tests!
Next: More GitHub Actions and CI/CD concepts!