refactor: adopt same code conventions as kafkaflow (#145) #313
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '**/README.md' | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ACCEPT_EULA: Y | |
SQLSERVER_SA_PASSWORD: SqlSever123123 | |
SQLSERVER_INTEGRATED_SECURITY: 'False' | |
POSTGRES_SA_USER: postgres | |
POSTGRES_SA_PASSWORD: Postgres123123 | |
steps: | |
- name: Determine Git Checkout information | |
id: checkout-info | |
run: | | |
if [ $GITHUB_EVENT_NAME == 'pull_request' ]; then | |
BRANCH_NAME=$(echo ${{ github.event.pull_request.head.ref }}) | |
REPOSITORY_NAME=$(echo ${{ github.event.pull_request.head.repo.full_name }}) | |
else | |
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/}) | |
REPOSITORY_NAME=$(echo ${{ github.repository }}) | |
fi | |
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV | |
echo "Git checkout information:" | |
echo "Branch name: $BRANCH_NAME" | |
echo "Repository name: $REPOSITORY_NAME" | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{github.event.pull_request.head.ref}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore dependencies | |
run: dotnet restore KafkaFlow.Retry.sln | |
- name: Build | |
run: dotnet build --no-restore -c Release KafkaFlow.Retry.sln | |
- name: Start SqlServer | |
run: docker run -d -p 1433:1433 -e ACCEPT_EULA=${{ env.ACCEPT_EULA }} -e SA_PASSWORD=${{ env.SQLSERVER_SA_PASSWORD }} -e MSSQL_PID=Developer mcr.microsoft.com/mssql/server:2017-latest | |
- name: Start Postgres | |
run: docker run -d -p 5432:5432 -e POSTGRES_USER=${{ env.POSTGRES_SA_USER }} -e POSTGRES_PASSWORD=${{ env.POSTGRES_SA_PASSWORD }} postgres:latest | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: '4.4' | |
#mongodb-port: 27017 (default) | |
- name: Start Kafka | |
uses: 280780363/[email protected] | |
with: | |
kafka version: "3.4.0-debian-11-r15" # Optional, kafka version | |
zookeeper version: "3.8.1-debian-11-r18" # Optional, zookeeper version | |
kafka port: 9092 # Optional, kafka port. Connect using localhost:9092 | |
zookeeper port: 2181 # Optional, zookeeper port | |
auto create topic: "true" # Optional, auto create kafka topic | |
- name: Test | |
run: dotnet test --no-build -c Release --verbosity normal --collect:"XPlat Code Coverage" --results-directory:"../../coverage-outputs" -m:1 KafkaFlow.Retry.sln |