Skip to content

CI

CI #104

Workflow file for this run

name: CI
# CI build for Brighter
# It creates a package on the github nuger feed for this project
# We run tests for transports as separate jobs to create greater visibility of failure, and to parallelize
# HINT: If you need to debug a config issue, tmate allows you to hop on to the server, check in the build
# logs for the SSH address to let you hop onto the box via tmate. It will timeout and not connect if left too long
# - name: Debugging with tmate
# uses: mxschmitt/[email protected]
on:
push:
branches: [ master, release/9 ]
tags:
- '*.*.*'
pull_request:
branches: [ master, release/9 ]
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Don't show a logo on first run of CLI
DOTNET_NOLOGO: true
# GitHub Packages Feed settings
GITHUB_FEED: https://nuget.pkg.github.com/
GITHUB_USER: iancooper
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Setup dotnet 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- run: dotnet --info
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: Linux-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
Linux-nuget-
- name: Build
run: dotnet build --configuration Release
- name: Core Tests
run: |
dotnet test tests/Paramore.Brighter.Core.Tests/Paramore.Brighter.Core.Tests.csproj --filter "Fragile!=CI" -c Release --no-restore --no-build --verbosity d
dotnet test tests/Paramore.Brighter.Extensions.Tests/Paramore.Brighter.Extensions.Tests.csproj -c Release --no-restore --no-build --verbosity d
- name: Upload packages as artifacts
uses: actions/upload-artifact@v3
with:
name: nuget packages
path: "**/*.nupkg"
- name: Push to GitHub Feed
if: ${{ github.event_name != 'pull_request' }}
run: dotnet nuget push **/*.nupkg --source https://nuget.pkg.github.com/${REPOSITORY_OWNER}/index.json --api-key ${GITHUB_TOKEN} --skip-duplicate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY_OWNER: ${{ github.repository_owner }}
release:
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [build]
steps:
- uses: actions/download-artifact@v3
with:
name: nuget packages
- name: Push generated package to NuGet
run: dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate
memory:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [build]
steps:
- uses: actions/checkout@v4
- name: Setup dotnet 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: In Memory Transport Tests
run: dotnet test ./tests/Paramore.Brighter.InMemory.Tests/Paramore.Brighter.InMemory.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --blame -v n
redis-ci:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [build]
services:
redis:
image: redis:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup dotnet 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: Redis Transport Tests
run: dotnet test ./tests/Paramore.Brighter.Redis.Tests/Paramore.Brighter.Redis.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --blame -v n
rabbitmq-ci:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [build]
services:
rabbitmq:
image: brightercommand/rabbitmq:3.8-management-delay
ports:
- 5672:5672
# needed because the rabbitmq container does not provide a healthcheck
options: >-
--health-cmd "rabbitmqctl node_health_check"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup dotnet 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: RMQ Transport Tests
run: dotnet test ./tests/Paramore.Brighter.RMQ.Tests/Paramore.Brighter.RMQ.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --blame -v n
kafka-ci:
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [build]
env:
CONFLUENT_BOOSTRAP_SERVER: ${{ secrets.CONFLUENT_BOOSTRAP_SERVER }}
CONFLUENT_SASL_PASSWORD: ${{ secrets.CONFLUENT_SASL_PASSWORD }}
CONFLUENT_SASL_USERNAME: ${{ secrets.CONFLUENT_SASL_USERNAME }}
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
ports:
- 2181:2181
env:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ALLOW_ANONYMOUS_LOGIN: yes
kafka:
image: confluentinc/cp-enterprise-kafka:latest
ports:
- 9092:9092
env:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_AUTO_CREATE_TOPICS_ENABLE: true
KAFKA_DELETE_TOPIC_ENABLE: "false"
schema-registry:
image: confluentinc/cp-schema-registry:latest
ports:
- 8081:8081
env:
SCHEMA_REGISTRY_HOST_NAME: schema-registry
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: 'kafka:29092'
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081
steps:
- name: Install KafkaCat
run: |
sudo apt-get install kafkacat
- name: Sleep to let Kafka spin up
uses: jakejarvis/wait-action@master
with:
time: '30s'
- name: docker check
run: docker ps -a
- name: Checkout code
uses: actions/checkout@v4
- name: Setup dotnet 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: Kafka Transport Tests
run: dotnet test ./tests/Paramore.Brighter.Kafka.Tests/Paramore.Brighter.Kafka.Tests.csproj --filter "Category=Kafka&Category!=Confluent&Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --blame -v n
postgres-ci:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [build]
services:
postgres:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup dotnet 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: Postgres Tests
run: dotnet test ./tests/Paramore.Brighter.PostgresSQL.Tests/Paramore.Brighter.PostgresSQL.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --blame -v n
eventstore-ci:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [build]
services:
evenstore:
image: eventstore/eventstore:release-5.0.9
ports:
- 1113:1113
- 2113:2113
env:
EVENTSTORE_RUN_PROJECTIONS: ALL
EVENTSTORE_START_STANDARD_PROJECTIONS: true
EVENTSTORE_CLUSTER_SIZE: 1
EVENTSTORE_EXT_TCP_PORT: 1113
EVENTSTORE_EXT_HTTP_PORT: 2113
EVENTSTORE_INSECURE: true
EVENTSTORE_ENABLE_EXTERNAL_TCP: true
EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP: true
steps:
- uses: actions/checkout@v4
- name: Setup dotnet 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: EventStore Tests
run: dotnet test ./tests/Paramore.Brighter.EventStore.Tests/Paramore.Brighter.EventStore.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --blame -v n
sqlserver-ci:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [build]
services:
sqlserver:
image: mcr.microsoft.com/mssql/server
ports:
- 11433:1433
env:
ACCEPT_EULA: Y
SA_PASSWORD: Password123!
steps:
- uses: actions/checkout@v4
- name: Setup dotnet 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: MSSQL Tests
run: dotnet test ./tests/Paramore.Brighter.MSSQL.Tests/Paramore.Brighter.MSSQL.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --blame -v n
mysql-ci:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [build]
services:
mariadb:
image: mariadb:latest
ports:
- 3306:3306
env:
MYSQL_DATABASE: BrighterTests
MYSQL_ROOT_PASSWORD: root
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v4
- name: Setup dotnet 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: Verify MariaDB connection
env:
PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do
sleep 1
done
- name: MySQL Tests
run: dotnet test ./tests/Paramore.Brighter.MySQL.Tests/Paramore.Brighter.MySQL.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --blame -v n
dynamo-ci:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [build]
services:
dynamo:
image: dwmkerr/dynamodb
ports:
- 8000:8000
steps:
- uses: actions/checkout@v4
- name: Setup dotnet 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: DynamoDB Tests
run: dotnet test ./tests/Paramore.Brighter.DynamoDB.Tests/Paramore.Brighter.DynamoDB.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --blame -v n
aws-ci:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [build]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
AWS_DEFAULT_OUTPUT: json
steps:
- uses: actions/checkout@v4
- name: Setup dotnet 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Copy files to the test website with the AWS CLI
run: |
aws sns list-topics
- name: SQS Tests
run: dotnet test ./tests/Paramore.Brighter.AWS.Tests/Paramore.Brighter.AWS.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --blame -v n
sqlite-ci:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [ build ]
steps:
- uses: actions/checkout@v4
- name: Setup dotnet 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: Sqlite Tests
run: dotnet test ./tests/Paramore.Brighter.Sqlite.Tests/Paramore.Brighter.Sqlite.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --blame -v n
azure-ci:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [build]
steps:
- uses: actions/checkout@v4
- name: Setup dotnet 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: Azure Tests
run: dotnet test ./tests/Paramore.Brighter.AzureServiceBus.Tests/Paramore.Brighter.AzureServiceBus.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --blame -v n