<commit_before><commit_msg>Add Github Actions to build & deploy the webapp to Azure (#6)<commit_after>name: Build and deploy .NET Core app to WebApp franceconnect-data-provider-dotnet-webapi-aspnetcore
on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
        - master
        - develop
env:
  CONNECTIONSSTRINGS__DEFAULTCONNECTION: ${{ secrets.database_connection_string }}
  AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.webapp_publish_profile }}
  AZURE_WEBAPP_NAME: franceconnect-data-provider-dotnet-webapi-aspnetcore
  AZURE_WEBAPP_PACKAGE_PATH: Source/WebApi-Data-Provider-DotNet/publish
  WORKING_DIRECTORY: Source/WebApi-Data-Provider-DotNet/
  CONFIGURATION: Development
  DOTNET_CORE_VERSION: 3.1.x

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
    - name: Restore dotnet tools
      run: dotnet tool restore
      working-directory: ${{ env.WORKING_DIRECTORY }}
    - name: Restore
      run: dotnet restore "${{ env.WORKING_DIRECTORY }}"
    - name: Build
      run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore
    - name: Test
      run: dotnet test "${{ env.WORKING_DIRECTORY }}" --no-build
    - name: Publish
      run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} /p:UseAppHost=false --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}"
      
    - name: Publish Artifacts
      uses: actions/upload-artifact@v1.0.0
      with:
        name: webapp
        path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

    - name: Deploy to Azure WebApp
      id: deploy
      if: ${{ github.event_name != 'pull_request' }}
      uses: azure/webapps-deploy@v2
      with:
        app-name: ${{ env.AZURE_WEBAPP_NAME }}
        package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
        publish-profile: ${{ env.AZURE_WEBAPP_PUBLISH_PROFILE }}
        
    - name: Apply database migrations
      if: ${{ steps.deploy.conclusion == 'success' }}
      run: dotnet ef database update
      working-directory: ${{ env.WORKING_DIRECTORY }}
{'fraction_non_alphanumeric': 0.11799276672694395, 'fraction_numerical': 0.00406871609403255, 'mean_word_length': 3.1057513914656774, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3089750', 'n_tokens_mistral': 756, 'n_tokens_neox': 719, 'n_words': 144}