Skip to content

#585 #2319 Load Balancer global configuration #250

#585 #2319 Load Balancer global configuration

#585 #2319 Load Balancer global configuration #250

Workflow file for this run

# 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: PR
on: pull_request
jobs:
build:
runs-on: ubuntu-latest
env:
# https://github.com/actions/setup-dotnet/blob/main/README.md#environment-variables
DOTNET_INSTALL_DIR: "/usr/share/dotnet" # don't override by /usr/lib/dotnet
steps:
- name: .NET Info
run: |
dotnet --version
echo ------------------------
dotnet --info
- name: Check .NET 8
id: check-dotnet8
run: |
DOTNET8_INFO=$(dotnet --info)
echo "Checking for .NET 8 SDK in dotnet info output..."
echo "-----------------------------------------------"
# Print matching lines
echo "$DOTNET8_INFO" | grep -E '^\s*8\.0\.[0-9]+\s+\[/usr/share/dotnet/sdk\]'
# Set environment variable based on match
if echo "$DOTNET8_INFO" | grep -qE '^\s*8\.0\.[0-9]+\s+\[/usr/share/dotnet/sdk\]'; then
echo "dotnet8_installed=true" >> $GITHUB_ENV
else
echo "dotnet8_installed=false" >> $GITHUB_ENV
fi
- name: Setup .NET 8
if: env.dotnet8_installed == 'false'
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: .NET Info
run: dotnet --info
- name: Checkout
uses: actions/checkout@v4
- name: Add threemammals.com DNS-record
run: |
hosts='/etc/hosts'
echo Content of $hosts
echo ------------------------
cat $hosts
sudo sed -i '$a 127.0.0.1 threemammals.com' $hosts
echo New content of $hosts
echo ------------------------
cat $hosts
echo ------------------------
ping -c 1 threemammals.com
- name: Install mycert.pfx certificate
run: |
pfx='./test/Ocelot.AcceptanceTests/mycert.pfx'
if [ -f "$pfx" ]; then
echo mycert.pfx file found
fi
echo Converting PFX to PEM format...
openssl version
openssl pkcs12 -in $pfx -out mycert.pem -nodes -legacy -passin pass:password # This extracts the certificate and private key
echo Moving the certificate to the trusted CA store...
cert='/usr/local/share/ca-certificates/mycert.crt'
sudo cp mycert.pem $cert # Copy the certificate to the system's trusted CA directory
echo Updating the trusted certificates...
sudo update-ca-certificates # This will add mycert.crt to the trusted root storage
echo Verifying installation by listing in /etc/ssl/certs/ folder...
sudo ls /etc/ssl/certs/ | grep mycert
echo Verifying installation by openssl for $cert file...
sudo chmod 644 $cert # adjusting the permissions
ls -l $cert # verify ownership
openssl x509 -in $cert -text -noout
echo Installation is DONE
- name: Restore
run: dotnet restore ./Ocelot.sln -p:TargetFramework=net8.0
- name: Build
run: dotnet build --no-restore ./Ocelot.sln --framework net8.0
- name: Unit Tests
run: dotnet test --no-restore --no-build --verbosity normal --framework net8.0 ./test/Ocelot.UnitTests/Ocelot.UnitTests.csproj
- name: Acceptance Tests
run: dotnet test --no-restore --no-build --verbosity normal --framework net8.0 ./test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj
build-cake:
needs: build
runs-on: ubuntu-latest
# environment: Pull-Request
# env:
# COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
# GITHUB_SHA: ${{ github.sha }}
# GITHUB_REF: ${{ github.ref }}
# GITHUB_REF_NAME: ${{ github.ref_name }}
steps:
- name: .NET Info
run: |
dotnet --version
echo ------------------------
dotnet --info
- name: Check .NET 9
id: check-dotnet9
run: |
DOTNET9_INFO=$(dotnet --info)
echo "Checking for .NET 9 SDK in dotnet info output..."
echo "-----------------------------------------------"
echo "$DOTNET9_INFO" | grep -E '^\s*9\.0\.[0-9]+\s+\[/usr/share/dotnet/sdk\]'
if echo "$DOTNET9_INFO" | grep -qE '^\s*9\.0\.[0-9]+\s+\[/usr/share/dotnet/sdk\]'; then
echo "dotnet9_installed=true" >> $GITHUB_ENV
else
echo "dotnet9_installed=false" >> $GITHUB_ENV
fi
- name: Setup .NET 9
if: env.dotnet9_installed == 'false'
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: .NET Info
run: dotnet --info
- name: Branch Name
run: echo "Branch name is ${{ github.ref_name }}"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Add threemammals.com DNS-record
run: |
sudo sed -i '$a 127.0.0.1 threemammals.com' /etc/hosts
ping -c 1 threemammals.com
- name: Install mycert.pfx certificate
run: |
pfx='./test/Ocelot.AcceptanceTests/mycert.pfx'
openssl pkcs12 -in $pfx -out mycert.pem -nodes -legacy -passin pass:password # This extracts the certificate and private key
cert='/usr/local/share/ca-certificates/mycert.crt'
sudo cp mycert.pem $cert # Copy the certificate to the system's trusted CA directory
sudo update-ca-certificates # This will add mycert.crt to the trusted root storage
sudo ls /etc/ssl/certs/ | grep mycert
sudo chmod 644 $cert # adjusting the permissions
ls -l $cert # verify ownership
openssl x509 -in $cert -text -noout
echo Installation is DONE
- name: Cake Build
uses: cake-build/cake-action@v3
with:
target: PullRequest
- name: Prepare Coveralls
run: |
echo "Listing environment variables:"
env | sort
echo ------------ Detect coverage file ------------
coverage_1st_folder=$(ls -d /home/runner/work/Ocelot/Ocelot/artifacts/UnitTests/*/ | head -1)
echo "Detected first folder : $coverage_1st_folder"
coverage_file="${coverage_1st_folder%/}/coverage.cobertura.xml"
echo "Detecting file $coverage_file ..."
if [ -f "$coverage_file" ]; then
echo "Coverage file exists."
echo "COVERALLS_coverage_file_exists=true" >> $GITHUB_ENV
echo "COVERALLS_coverage_file=$coverage_file" >> $GITHUB_ENV
else
echo "Coverage file DOES NOT exist!"
echo "COVERALLS_coverage_file_exists=false" >> $GITHUB_ENV
fi
- name: Coveralls
if: env.COVERALLS_coverage_file_exists == 'true'
uses: coverallsapp/github-action@v2
with:
file: ${{ env.COVERALLS_coverage_file }}