Skip to content

Commit 42a5d05

Browse files
committed
ci: bump actions.
1 parent f10bcdf commit 42a5d05

5 files changed

Lines changed: 288 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "nuget"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"
12+
open-pull-requests-limit: 5

.github/workflows/build.yml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
env:
10+
DOTNET_VERSION: '10.0.x'
11+
12+
jobs:
13+
build:
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest, windows-latest, macos-latest]
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Setup .NET
26+
uses: actions/setup-dotnet@v4
27+
with:
28+
dotnet-version: ${{ env.DOTNET_VERSION }}
29+
30+
- name: Cache NuGet packages
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.nuget/packages
34+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
35+
restore-keys: |
36+
${{ runner.os }}-nuget-
37+
38+
- name: Restore dependencies
39+
run: dotnet restore
40+
41+
- name: Build (Release)
42+
run: dotnet build -c Release --no-restore
43+
44+
- name: Run tests
45+
run: dotnet test -c Release --no-build --verbosity normal
46+
47+
- name: Create artifact
48+
if: matrix.os == 'ubuntu-latest'
49+
run: dotnet publish -c Release -o ./publish
50+
51+
- name: Upload artifact
52+
if: matrix.os == 'ubuntu-latest'
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: ef-migration-diff-release
56+
path: ./publish
57+
58+
code-quality:
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@v4
64+
65+
- name: Setup .NET
66+
uses: actions/setup-dotnet@v4
67+
with:
68+
dotnet-version: ${{ env.DOTNET_VERSION }}
69+
70+
- name: Restore dependencies
71+
run: dotnet restore
72+
73+
- name: Code analysis
74+
run: dotnet build --no-restore /p:TreatWarningsAsErrors=true
75+
76+
- name: Format check
77+
run: dotnet format --verify-no-changes --verbosity diagnostic
78+
79+
docker:
80+
runs-on: ubuntu-latest
81+
needs: build
82+
83+
steps:
84+
- name: Checkout
85+
uses: actions/checkout@v4
86+
87+
- name: Build Docker image
88+
run: docker build -t ef-migration-diff:latest .
89+
90+
- name: Test Docker image
91+
run: docker run --rm ef-migration-diff:latest --version
92+
93+
- name: Login to Docker Hub
94+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
95+
uses: docker/login-action@v2
96+
with:
97+
username: ${{ secrets.DOCKER_USERNAME }}
98+
password: ${{ secrets.DOCKER_PASSWORD }}
99+
100+
- name: Push Docker image
101+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
102+
run: |
103+
docker tag ef-migration-diff:latest sarmkadan/ef-migration-diff:latest
104+
docker tag ef-migration-diff:latest sarmkadan/ef-migration-diff:1.2.0
105+
docker push sarmkadan/ef-migration-diff:latest
106+
docker push sarmkadan/ef-migration-diff:1.2.0
107+
108+
security:
109+
runs-on: ubuntu-latest
110+
111+
steps:
112+
- name: Checkout
113+
uses: actions/checkout@v4
114+
115+
- name: Setup .NET
116+
uses: actions/setup-dotnet@v4
117+
with:
118+
dotnet-version: ${{ env.DOTNET_VERSION }}
119+
120+
- name: Restore dependencies
121+
run: dotnet restore
122+
123+
- name: Check for vulnerabilities
124+
run: dotnet list package --vulnerable
125+
126+
release:
127+
runs-on: ubuntu-latest
128+
needs: [build, code-quality, docker, security]
129+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'release:')
130+
131+
steps:
132+
- name: Checkout
133+
uses: actions/checkout@v4
134+
135+
- name: Download artifact
136+
uses: actions/download-artifact@v4
137+
with:
138+
name: ef-migration-diff-release
139+
path: ./publish
140+
141+
- name: Create Release
142+
uses: softprops/action-gh-release@v1
143+
with:
144+
files: ./publish/**
145+
draft: false
146+
prerelease: false
147+
env:
148+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/codeql.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: '0 6 * * 1'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
strategy:
20+
matrix:
21+
language: [ 'csharp' ]
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
- name: Initialize CodeQL
26+
uses: github/codeql-action/init@v3
27+
with:
28+
languages: ${{ matrix.language }}
29+
- name: Build
30+
uses: github/codeql-action/autobuild@v3
31+
- name: Perform Analysis
32+
uses: github/codeql-action/analyze@v3
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: NuGet Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-dotnet@v4
13+
with:
14+
dotnet-version: '10.0.x'
15+
- run: dotnet pack -c Release
16+
- run: dotnet nuget push **/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate

docker-compose.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
version: '3.8'
2+
3+
services:
4+
# ef-migration-diff CLI tool
5+
ef-migration-diff:
6+
build:
7+
context: .
8+
dockerfile: Dockerfile
9+
container_name: ef-migration-diff
10+
volumes:
11+
- .:/workspace
12+
- /workspace/.cache
13+
environment:
14+
- EFMIGDIFF_CACHE_ENABLED=true
15+
- EFMIGDIFF_CACHE_TTL=3600
16+
- EFMIGDIFF_LOG_LEVEL=Information
17+
working_dir: /workspace
18+
command: --help
19+
20+
# SQL Server for testing migrations
21+
sqlserver:
22+
image: mcr.microsoft.com/mssql/server:2022-latest
23+
container_name: sqlserver-test
24+
environment:
25+
SA_PASSWORD: "TestPassword123!"
26+
ACCEPT_EULA: "Y"
27+
MSSQL_PID: Developer
28+
ports:
29+
- "1433:1433"
30+
volumes:
31+
- sqlserver-data:/var/opt/mssql
32+
healthcheck:
33+
test: ["CMD", "/opt/mssql-tools/bin/sqlcmd", "-S", "localhost", "-U", "SA", "-P", "TestPassword123!", "-Q", "SELECT 1"]
34+
interval: 10s
35+
timeout: 3s
36+
retries: 10
37+
38+
# PostgreSQL for testing migrations
39+
postgres:
40+
image: postgres:16-alpine
41+
container_name: postgres-test
42+
environment:
43+
POSTGRES_DB: testdb
44+
POSTGRES_USER: postgres
45+
POSTGRES_PASSWORD: postgres
46+
ports:
47+
- "5432:5432"
48+
volumes:
49+
- postgres-data:/var/lib/postgresql/data
50+
healthcheck:
51+
test: ["CMD-SHELL", "pg_isready -U postgres"]
52+
interval: 10s
53+
timeout: 3s
54+
retries: 10
55+
56+
# MySQL for testing migrations
57+
mysql:
58+
image: mysql:8.0
59+
container_name: mysql-test
60+
environment:
61+
MYSQL_ROOT_PASSWORD: root
62+
MYSQL_DATABASE: testdb
63+
ports:
64+
- "3306:3306"
65+
volumes:
66+
- mysql-data:/var/lib/mysql
67+
healthcheck:
68+
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
69+
interval: 10s
70+
timeout: 3s
71+
retries: 10
72+
73+
volumes:
74+
sqlserver-data:
75+
postgres-data:
76+
mysql-data:
77+
78+
networks:
79+
default:
80+
name: ef-migration-diff-network

0 commit comments

Comments
 (0)