-
Notifications
You must be signed in to change notification settings - Fork 0
Initial app + Cloud Run deploy #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
59bb046
d2cc48f
2efe39e
264101e
197df51
cd50e18
4530bdf
c29e2b1
6195a96
3f45425
117e21e
800fc12
3181f91
82e6dea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| **/.git | ||
| **/.github | ||
| **/.idea | ||
| **/.vs | ||
| **/.vscode | ||
| **/bin | ||
| **/obj | ||
| **/node_modules | ||
| **/*.user | ||
| **/*.suo | ||
| **/*.db | ||
| **/*.db-shm | ||
| **/*.db-wal | ||
| tests/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,195 @@ | ||
| # editorconfig.org | ||
|
|
||
| # top-most EditorConfig file | ||
| root = true | ||
|
|
||
| # Default settings: | ||
| # A newline ending every file | ||
| # Use 4 spaces as indentation | ||
| [*] | ||
| insert_final_newline = true | ||
| indent_style = space | ||
| indent_size = 4 | ||
| trim_trailing_whitespace = true | ||
|
|
||
| # Specify UTF-8 without byte-order mark | ||
| [*.{csproj,locproj,nativeproj,proj,resx,slnx,vbproj}] | ||
| charset = utf-8 | ||
|
|
||
| # Generated code | ||
| [*{_AssemblyInfo.cs,.notsupported.cs,AsmOffsets.cs}] | ||
| generated_code = true | ||
|
|
||
| # C# files | ||
| [*.cs] | ||
| charset = utf-8 | ||
| # New line preferences | ||
| csharp_new_line_before_open_brace = all | ||
| csharp_new_line_before_else = true | ||
| csharp_new_line_before_catch = true | ||
| csharp_new_line_before_finally = true | ||
| csharp_new_line_before_members_in_object_initializers = true | ||
| csharp_new_line_before_members_in_anonymous_types = true | ||
| csharp_new_line_between_query_expression_clauses = true | ||
|
|
||
| # Indentation preferences | ||
| csharp_indent_block_contents = true | ||
| csharp_indent_braces = false | ||
| csharp_indent_case_contents = true | ||
| csharp_indent_case_contents_when_block = false | ||
| csharp_indent_switch_labels = true | ||
| csharp_indent_labels = one_less_than_current | ||
|
|
||
| # Modifier preferences | ||
| csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion | ||
|
|
||
| # avoid this. unless absolutely necessary | ||
| dotnet_style_qualification_for_field = false:suggestion | ||
| dotnet_style_qualification_for_property = false:suggestion | ||
| dotnet_style_qualification_for_method = false:suggestion | ||
| dotnet_style_qualification_for_event = false:suggestion | ||
|
|
||
| # Types: use keywords instead of BCL types, and permit var only when the type is clear | ||
| csharp_style_var_for_built_in_types = false:suggestion | ||
| csharp_style_var_when_type_is_apparent = false:none | ||
| csharp_style_var_elsewhere = false:suggestion | ||
| dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion | ||
| dotnet_style_predefined_type_for_member_access = true:suggestion | ||
|
|
||
| # name all constant fields using PascalCase | ||
| dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion | ||
| dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields | ||
| dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style | ||
| dotnet_naming_symbols.constant_fields.applicable_kinds = field | ||
| dotnet_naming_symbols.constant_fields.required_modifiers = const | ||
| dotnet_naming_style.pascal_case_style.capitalization = pascal_case | ||
|
|
||
| # static fields should have s_ prefix | ||
| dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion | ||
| dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields | ||
| dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style | ||
| dotnet_naming_symbols.static_fields.applicable_kinds = field | ||
| dotnet_naming_symbols.static_fields.required_modifiers = static | ||
| dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected | ||
| dotnet_naming_style.static_prefix_style.required_prefix = s_ | ||
| dotnet_naming_style.static_prefix_style.capitalization = camel_case | ||
|
|
||
| # internal and private fields should be _camelCase | ||
| dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion | ||
| dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields | ||
| dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style | ||
| dotnet_naming_symbols.private_internal_fields.applicable_kinds = field | ||
| dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal | ||
| dotnet_naming_style.camel_case_underscore_style.required_prefix = _ | ||
| dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case | ||
|
|
||
| # Code style defaults | ||
| csharp_using_directive_placement = outside_namespace:suggestion | ||
| dotnet_sort_system_directives_first = true | ||
| csharp_prefer_braces = true:silent | ||
| csharp_preserve_single_line_blocks = true:none | ||
| csharp_preserve_single_line_statements = false:none | ||
| csharp_prefer_static_local_function = true:suggestion | ||
| csharp_prefer_simple_using_statement = false:none | ||
| csharp_style_prefer_switch_expression = true:suggestion | ||
| dotnet_style_readonly_field = true:suggestion | ||
|
|
||
| # Expression-level preferences | ||
| dotnet_style_object_initializer = true:suggestion | ||
| dotnet_style_collection_initializer = true:suggestion | ||
| dotnet_style_prefer_collection_expression = when_types_exactly_match | ||
| dotnet_style_explicit_tuple_names = true:suggestion | ||
| dotnet_style_coalesce_expression = true:suggestion | ||
| dotnet_style_null_propagation = true | ||
| dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion | ||
| dotnet_style_prefer_inferred_tuple_names = true:suggestion | ||
| dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion | ||
| dotnet_style_prefer_auto_properties = true:suggestion | ||
| dotnet_style_prefer_conditional_expression_over_assignment = true:silent | ||
| dotnet_style_prefer_conditional_expression_over_return = true:silent | ||
| csharp_prefer_simple_default_expression = true:suggestion | ||
|
|
||
| # Expression-bodied members | ||
| csharp_style_expression_bodied_methods = true:silent | ||
| csharp_style_expression_bodied_constructors = true:silent | ||
| csharp_style_expression_bodied_operators = true:silent | ||
| csharp_style_expression_bodied_properties = true:silent | ||
| csharp_style_expression_bodied_indexers = true:silent | ||
| csharp_style_expression_bodied_accessors = true:silent | ||
| csharp_style_expression_bodied_lambdas = true:silent | ||
| csharp_style_expression_bodied_local_functions = true:silent | ||
|
|
||
| # Pattern matching | ||
| csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion | ||
| csharp_style_pattern_matching_over_as_with_null_check = true:suggestion | ||
| csharp_style_inlined_variable_declaration = true:suggestion | ||
|
|
||
| # Null checking preferences | ||
| csharp_style_throw_expression = true:suggestion | ||
| csharp_style_conditional_delegate_call = true:suggestion | ||
|
|
||
| # Other features | ||
| csharp_style_prefer_index_operator = false:none | ||
| csharp_style_prefer_range_operator = false:none | ||
| csharp_style_pattern_local_over_anonymous_function = false:none | ||
|
|
||
| # Space preferences | ||
| csharp_space_after_cast = false | ||
| csharp_space_after_colon_in_inheritance_clause = true | ||
| csharp_space_after_comma = true | ||
| csharp_space_after_dot = false | ||
| csharp_space_after_keywords_in_control_flow_statements = true | ||
| csharp_space_after_semicolon_in_for_statement = true | ||
| csharp_space_around_binary_operators = before_and_after | ||
| csharp_space_around_declaration_statements = do_not_ignore | ||
| csharp_space_before_colon_in_inheritance_clause = true | ||
| csharp_space_before_comma = false | ||
| csharp_space_before_dot = false | ||
| csharp_space_before_open_square_brackets = false | ||
| csharp_space_before_semicolon_in_for_statement = false | ||
| csharp_space_between_empty_square_brackets = false | ||
| csharp_space_between_method_call_empty_parameter_list_parentheses = false | ||
| csharp_space_between_method_call_name_and_opening_parenthesis = false | ||
| csharp_space_between_method_call_parameter_list_parentheses = false | ||
| csharp_space_between_method_declaration_empty_parameter_list_parentheses = false | ||
| csharp_space_between_method_declaration_name_and_open_parenthesis = false | ||
| csharp_space_between_method_declaration_parameter_list_parentheses = false | ||
| csharp_space_between_parentheses = false | ||
| csharp_space_between_square_brackets = false | ||
|
|
||
| # C++ Files | ||
| [*.{cpp,h,in}] | ||
| curly_bracket_next_line = true | ||
| indent_brace_style = Allman | ||
|
|
||
| # Xml project files | ||
| [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}] | ||
| indent_size = 2 | ||
|
|
||
| # Xml build files | ||
| [*.builds] | ||
| indent_size = 2 | ||
|
|
||
| # Xml files | ||
| [*.{resx,ruleset,slnx,stylecop,xml}] | ||
| indent_size = 2 | ||
|
|
||
| # Xml resource files | ||
| [*.resx] | ||
| # match Visual Studio behavior | ||
| insert_final_newline = false | ||
| trim_trailing_whitespace = false | ||
|
|
||
| # Xml config files | ||
| [*.{props,targets,config,nuspec}] | ||
| indent_size = 2 | ||
|
|
||
| # Data serialization | ||
| [*.{json,yaml,yml}] | ||
| indent_size = 2 | ||
|
|
||
| # Shell scripts | ||
| [*.sh] | ||
| end_of_line = lf | ||
| [*.{cmd,bat}] | ||
| end_of_line = crlf |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: ["main"] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20.x | ||
| cache: npm | ||
| - name: Build Tailwind CSS | ||
| run: | | ||
| npm ci | ||
| npm run build:css | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: 10.0.x | ||
| - name: Test | ||
| run: dotnet test tests/AudioSharp.App.Tests/AudioSharp.App.Tests.csproj --configuration Release |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| name: Deploy to Cloud Run | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| env: | ||
| PROJECT_ID: audio-sharp-interop | ||
| REGION: us-central1 | ||
| SERVICE_NAME: audiosharp | ||
| AR_REPO: audiosharp | ||
| IMAGE_NAME: audiosharp | ||
| OPENROUTER_API_KEY_SECRET: openrouter-api-key | ||
|
|
||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20.x | ||
| cache: npm | ||
| - name: Build Tailwind CSS | ||
| run: | | ||
| npm ci | ||
| npm run build:css | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: 10.0.x | ||
| - name: Test | ||
| run: dotnet test tests/AudioSharp.App.Tests/AudioSharp.App.Tests.csproj --configuration Release | ||
| - name: Auth to Google Cloud | ||
| uses: google-github-actions/auth@v2 | ||
| with: | ||
| workload_identity_provider: ${{ secrets.GCP_WIF_PROVIDER }} | ||
| service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | ||
| - name: Setup gcloud | ||
| uses: google-github-actions/setup-gcloud@v2 | ||
| - name: Set image tag | ||
| run: echo "IMAGE=${REGION}-docker.pkg.dev/${PROJECT_ID}/${AR_REPO}/${IMAGE_NAME}:${GITHUB_SHA}" >> $GITHUB_ENV | ||
| - name: Configure Docker | ||
| run: gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet | ||
| - name: Build image | ||
| run: docker build -t ${{ env.IMAGE }} . | ||
| - name: Push image | ||
| run: docker push ${{ env.IMAGE }} | ||
| - name: Deploy | ||
| run: | | ||
| gcloud run deploy ${{ env.SERVICE_NAME }} \ | ||
| --image ${{ env.IMAGE }} \ | ||
| --region ${{ env.REGION }} \ | ||
| --allow-unauthenticated \ | ||
| --set-env-vars LlmProvider__TextProvider=OpenRouter,OPENROUTER_TEXT_MODEL=google/gemini-2.5-flash-lite,OPENROUTER_AUDIO_MODEL=google/gemini-2.5-flash-lite \ | ||
| --set-secrets OPENROUTER_API_KEY=$OPENROUTER_API_KEY_SECRET:latest | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| .env | ||
| .gcloud/ | ||
| **/bin/ | ||
| **/obj/ | ||
| .DS_Store | ||
| node_modules/ | ||
| npm-debug.log | ||
| *.db-wal | ||
| *.db-shm | ||
| src/AudioSharp.App/wwwroot/lib/recordrtc/ | ||
|
|
||
| # Visual Studio / Rider | ||
| .vs/ | ||
| .idea/ | ||
| *.user | ||
| *.suo | ||
| *.log | ||
|
|
||
| # Test results | ||
| TestResults/ | ||
| coverage/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <Solution> | ||
| <Folder Name="/src/"> | ||
| <Project Path="src/AudioSharp.App/AudioSharp.App.csproj" /> | ||
| </Folder> | ||
| <Folder Name="/tests/"> | ||
| <Project Path="tests/AudioSharp.App.Tests/AudioSharp.App.Tests.csproj" /> | ||
| </Folder> | ||
| </Solution> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # syntax=docker/dockerfile:1 | ||
| ARG DOTNET_VERSION=10.0 | ||
|
|
||
| FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS build | ||
| WORKDIR /src | ||
|
|
||
| RUN apt-get update \ | ||
| && apt-get install -y --no-install-recommends nodejs npm \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| COPY ["AudioSharp.slnx", "./"] | ||
| COPY ["src/AudioSharp.App/AudioSharp.App.csproj", "src/AudioSharp.App/"] | ||
| COPY ["tests/AudioSharp.App.Tests/AudioSharp.App.Tests.csproj", "tests/AudioSharp.App.Tests/"] | ||
| RUN dotnet restore "AudioSharp.slnx" | ||
|
|
||
| COPY . . | ||
| WORKDIR /src/src/AudioSharp.App | ||
|
Comment on lines
+12
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current Dockerfile structure doesn't fully leverage Docker's layer caching. The |
||
| RUN dotnet publish "AudioSharp.App.csproj" -c Release -o /app/publish --no-restore | ||
|
|
||
| FROM mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION} AS final | ||
| WORKDIR /app | ||
| ENV ASPNETCORE_URLS=http://+:8080 | ||
| EXPOSE 8080 | ||
| COPY --from=build /app/publish . | ||
| ENTRYPOINT ["dotnet", "AudioSharp.App.dll"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,8 @@ | ||
| # audio-interop-sharp | ||
| # audio-interop-sharp | ||
|
|
||
| ## Frontend styling | ||
|
|
||
| - Build Tailwind CSS: `npm run build:css` | ||
| - Watch Tailwind CSS: `npm run watch:css` | ||
| - `dotnet publish` runs `npm run build:css`, so Node + npm are required. | ||
| - Skip Tailwind during publish: `dotnet publish -p:SkipTailwindCss=true` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the
--set-secretsshell variable expansion.The secret reference
$OPENROUTER_API_KEY_SECRETlacks curly braces and may not expand correctly in the shell context. Use${OPENROUTER_API_KEY_SECRET}for proper expansion.🐛 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents