-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (91 loc) · 3.15 KB
/
Master-Build.yml
File metadata and controls
101 lines (91 loc) · 3.15 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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: master-build
on:
push:
branches: [ "master" ]
paths-ignore:
- "**/*.md"
- "**/*.gitignore"
- "**/*.gitattributes"
jobs:
build:
runs-on: ubuntu-latest
services:
localstack:
image: localstack/localstack:latest
ports:
- 4566:4566
env:
SERVICES: sqs,sns,kms
DEBUG: 1
EAGER_SERVICE_LOADING: 1
SKIP_SSL_CERT_DOWNLOAD: 1
DOCKER_HOST: unix:///var/run/docker.sock
options: >-
--health-cmd "curl -f http://localhost:4566/_localstack/health || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 30
--health-start-period 30s
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: Verify LocalStack is Ready
run: |
echo "Waiting for LocalStack to be fully ready..."
echo "Testing connection to localhost:4566..."
max_attempts=30
attempt=0
while [ $attempt -lt $max_attempts ]; do
if curl -f http://localhost:4566/_localstack/health 2>/dev/null; then
echo ""
echo "LocalStack is ready!"
echo "Health endpoint response:"
curl -s http://localhost:4566/_localstack/health | jq '.'
break
fi
attempt=$((attempt + 1))
echo "Attempt $attempt/$max_attempts - LocalStack not ready yet, waiting..."
sleep 3
done
if [ $attempt -eq $max_attempts ]; then
echo "ERROR: LocalStack did not become ready in time"
docker logs $(docker ps -q --filter ancestor=localstack/localstack:latest) 2>/dev/null || echo "Could not get container logs"
exit 1
fi
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
# Run unit tests first (no external dependencies)
- name: Run Unit Tests
run: dotnet test --no-build --verbosity normal --filter "Category=Unit"
# Run integration tests against LocalStack
- name: Run Integration Tests with LocalStack
run: dotnet test --no-build --verbosity normal --filter "Category=Integration&Category=RequiresLocalStack" -- RunConfiguration.TestSessionTimeout=600000
env:
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: us-east-1
AWS_ENDPOINT_URL: http://localhost:4566
GITHUB_ACTIONS: true
run-Lint:
runs-on: ubuntu-latest
env:
github-token: '${{ secrets.GITHUB_TOKEN }}'
steps:
- name: Step-01 Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Step-02 Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
FILTER_REGEX_INCLUDE: .*src/.*
DEFAULT_BRANCH: master
GITHUB_TOKEN: '${{ env.github-token }}'