Make Mfa setup modal not ugly #1100
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: .NET | |
on: | |
push: | |
branches: "**" | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
build: | |
runs-on: self-hosted | |
#services: | |
# postgres: | |
# image: postgres:latest | |
# ports: | |
# - 5432:5432 | |
# env: | |
# POSTGRES_USER: test_user | |
# POSTGRES_PASSWORD: test_password_123 | |
# POSTGRES_DB: valour_test | |
# options: >- | |
# --health-cmd="pg_isready -U test_user" | |
# --health-interval=10s | |
# --health-timeout=5s | |
# --health-retries=5 | |
#redis: | |
# image: redis:latest | |
# ports: | |
# - 6379:6379 | |
# options: >- | |
# --health-cmd="redis-cli ping || exit 1" | |
# --health-interval=10s | |
# --health-timeout=5s | |
# --health-retries=5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache NuGet packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: Check Disk Space and Clean Docker Artifacts | |
run: | | |
THRESHOLD=10 # Disk space threshold in GB | |
AVAILABLE_SPACE=$(df --output=avail / | tail -n 1 | awk '{print int($1/1024/1024)}') | |
echo "Available disk space: ${AVAILABLE_SPACE} GB" | |
if (( AVAILABLE_SPACE < THRESHOLD )); then | |
echo "Low disk space detected! Cleaning up Docker artifacts..." | |
docker system prune -af --volumes | |
echo "Docker cleanup complete." | |
else | |
echo "Sufficient disk space available: ${AVAILABLE_SPACE} GB" | |
fi | |
- name: Sanitize branch name | |
run: | | |
TAG_NAME=$(echo "${GITHUB_REF_NAME}" | tr '/:' '-_') | |
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV | |
- name: Get Short SHA | |
id: short-sha | |
run: echo "short_sha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT | |
- name: Set Lowercase Variables | |
id: vars | |
shell: bash | |
run: | | |
echo "IMAGE_NAME=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
echo "BRANCH_NAME=$(echo ${GITHUB_REF_NAME} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Modify asset versions | |
uses: mingjun97/file-regex-replace@v1 | |
with: | |
regex: '\$\(SHORTHASH\)' | |
replacement: '${{ steps.short-sha.outputs.short_sha }}' | |
flags: "g" | |
include: '.*' | |
exclude: '.^' | |
encoding: 'utf8' | |
path: '.' | |
- name: Delete .js files if corresponding .ts files exist | |
run: | | |
#!/bin/bash | |
SEARCH_DIR="./" | |
find "$SEARCH_DIR" -name "*.ts" | while read tsfile; do | |
jsfile="${tsfile%.ts}.js" | |
if [ -f "$jsfile" ]; then | |
echo "Deleting $jsfile because $tsfile exists" | |
rm "$jsfile" | |
fi | |
done | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 9.0.100 | |
- name: Restore workload | |
run: dotnet workload restore | |
- name: Clean | |
run: dotnet clean | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Clean | |
run: dotnet clean | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Test | |
env: | |
TEST_DB: "valour_test" | |
TEST_DB_HOST: "localhost:5432" | |
TEST_DB_USER: "test_user" | |
TEST_DB_PASS: "test_password_123" | |
TEST_REDIS: "localhost:6379,abortConnect=False" | |
NODE_NAME: "emma" | |
APPLY_MIGRATIONS: true | |
run: dotnet test --no-build --verbosity normal | |
#continue-on-error: true | |
- name: Publish Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Test Results | |
path: "**/test_results.trx" | |
- name: Publish Shared Nuget Package | |
uses: alirezanet/[email protected] | |
with: | |
PROJECT_FILE_PATH: Valour/Shared/Valour.Shared.csproj | |
VERSION_FILE_PATH: Valour/Shared/Valour.Shared.csproj | |
NUGET_KEY: ${{ secrets.NUGET_API_KEY }} | |
- name: Publish API Nuget Package | |
uses: alirezanet/[email protected] | |
with: | |
PROJECT_FILE_PATH: Valour/Sdk/Valour.Sdk.csproj | |
VERSION_FILE_PATH: Valour/Sdk/Valour.Sdk.csproj | |
NUGET_KEY: ${{ secrets.NUGET_API_KEY }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }}-${{ steps.short-sha.outputs.short_sha }} | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }}-latest | |
labels: | | |
org.opencontainers.image.source=${{ github.repository }} | |
org.opencontainers.image.revision=${{ github.sha }} |