Skip to content

Commit

Permalink
Merge pull request #121 from DevopsGroupC/feature/software-quality-tools
Browse files Browse the repository at this point in the history
Feature/software quality tools
  • Loading branch information
ebrvc authored Mar 24, 2024
2 parents 7ec7ad0 + 96b9a6e commit b02d908
Show file tree
Hide file tree
Showing 40 changed files with 1,153 additions and 754 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/preproduction.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Preproduction Deployment #shoutout to the exercises session

on:
push:
push:
branches:
- develop
workflow_dispatch:
Expand Down Expand Up @@ -35,11 +35,12 @@ jobs:
uses: docker/build-push-action@v2
with:
context: ./csharp-minitwit
file: ./csharp-minitwit/Dockerfile-staging
file: ./csharp-minitwit/Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/csharptwit-preproduction:latest
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/csharptwit-preproduction:webbuildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/csharptwit-preproduction:webbuildcache,mode=max
build-args: ENVIRONMENT=Preproduction

#TODO: Add / adjust tests from py api maybe?

Expand All @@ -58,7 +59,7 @@ jobs:
chmod 600 ~/.ssh/staging_key
env:
SSH_KEY: ${{ secrets.SSH_KEY_PRE }}

- name: Copy files to server
# Updating all files on remote server from the remote_files_preproduction
run: >
Expand All @@ -71,14 +72,13 @@ jobs:
- name: Deploy to server
# Calls deploy.sh to pull csharp-minitwit image from Docker Hub and spin container up.
run: |
ssh -i ~/.ssh/staging_key -o StrictHostKeyChecking=no $SSH_USER@$SSH_HOST << 'EOF'
export ConnectionStrings__DefaultConnection=${{ secrets.DB_CONNECTIONSTRING_STAGING }}
cd /csharp-minitwit
printenv
docker compose -f docker-compose.yml pull
docker compose -f docker-compose.yml up -d
EOF
ssh -i ~/.ssh/staging_key -o StrictHostKeyChecking=no $SSH_USER@$SSH_HOST << 'EOF'
export ConnectionStrings__DefaultConnection=${{ secrets.DB_CONNECTIONSTRING_STAGING }}
cd /csharp-minitwit
printenv
docker compose -f docker-compose.yml pull
docker compose -f docker-compose.yml up -d
EOF
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_HOST: ${{ secrets.SSH_HOST_PRE }}

17 changes: 9 additions & 8 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
tags: ${{ secrets.DOCKER_USERNAME }}/csharptwitimage:latest
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/csharptwitimage:webbuildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/csharptwitimage:webbuildcache,mode=max
build-args: ENVIRONMENT=Production

#TODO: Add / adjust tests from py api maybe?

Expand All @@ -59,7 +60,7 @@ jobs:
chmod 600 ~/.ssh/production_key
env:
SSH_KEY: ${{ secrets.SSH_KEY }}

- name: Copy files to server
# Updating all files on remote server from the remote_files
run: >
Expand All @@ -72,13 +73,13 @@ jobs:
- name: Deploy to server
# Calls deploy.sh to pull csharp-minitwit image from Docker Hub and spin container up.
run: |
ssh -i ~/.ssh/production_key -o StrictHostKeyChecking=no $SSH_USER@$SSH_HOST << 'EOF'
export ConnectionStrings__DefaultConnection=${{ secrets.DB_CONNECTIONSTRING_PRODUCTION }}
cd /csharp-minitwit
printenv
docker compose -f docker-compose.yml pull
docker compose -f docker-compose.yml up -d
EOF
ssh -i ~/.ssh/production_key -o StrictHostKeyChecking=no $SSH_USER@$SSH_HOST << 'EOF'
export ConnectionStrings__DefaultConnection=${{ secrets.DB_CONNECTIONSTRING_PRODUCTION }}
cd /csharp-minitwit
printenv
docker compose -f docker-compose.yml pull
docker compose -f docker-compose.yml up -d
EOF
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_HOST: ${{ secrets.SSH_HOST }}
34 changes: 34 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Format check on push
on:
pull_request:
- types: [opened, reopened, edited, synchronize, ready_for_review]
# branches:
# - feature/software-quality-tools
jobs:
dotnet-format:
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore ./csharp-minitwit/csharp-minitwit.sln

- name: Format
run: dotnet format ./csharp-minitwit/csharp-minitwit.sln --verbosity diagnostic

- name: Push changes
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git commit -am "Automated formatting"
git push
Loading

0 comments on commit b02d908

Please sign in to comment.