Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-runtimes-caching/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ runs:
- name: Install Aspire CLI
uses: timheuer/setup-aspire@v0.1.0
with:
quality: release # temp workaround until url is fixed
quality: release

- name: Set up Python
uses: actions/setup-python@v5
Expand Down
5 changes: 2 additions & 3 deletions eng/testing/validate-typescript-apphost.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ param(
[Parameter(Mandatory = $true)]
[string]$PackageName,

[Parameter(Mandatory = $true)]
[string[]]$WaitForResources,
[string[]]$WaitForResources = @(),

[string[]]$RequiredCommands = @(),

Expand Down Expand Up @@ -87,7 +86,7 @@ if ([string]::IsNullOrWhiteSpace($PackageVersion)) {
$PackageVersion = "$versionPrefix-polyglot.local"
}

if ($WaitForResources.Count -eq 1) {
if ($WaitForResources.Count -eq 1 -and -not [string]::IsNullOrWhiteSpace($WaitForResources[0])) {
$splitOptions = [System.StringSplitOptions]::RemoveEmptyEntries -bor [System.StringSplitOptions]::TrimEntries
$WaitForResources = $WaitForResources[0].Split(",", $splitOptions)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createBuilder } from './.modules/aspire.js';

const builder = await createBuilder();

const golangRoot = await builder.addGolangApp("golang-root", "./go-app", ".", {
args: ["--mode", "root"],
buildTags: ["validation"]
});
await golangRoot.withGoModTidy();

const golangCmd = await builder.addGolangApp("golang-cmd", "./go-app", "./cmd/server", {
args: ["--mode", "cmd-server"]
});
await golangCmd.withGoModDownload({ install: false });

await builder.build().run();
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"appHost": {
"path": "apphost.ts",
"language": "typescript/nodejs"
},
"profiles": {
"https": {
"applicationUrl": "https://localhost:29750;http://localhost:28931",
"environmentVariables": {
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10975",
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13319"
}
}
},
"packages": {
"CommunityToolkit.Aspire.Hosting.Golang": ""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// @ts-check

import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint';

export default defineConfig({
files: ['apphost.ts'],
extends: [tseslint.configs.base],
languageOptions: {
parserOptions: {
projectService: true,
},
},
rules: {
'@typescript-eslint/no-floating-promises': ['error', { checkThenables: true }],
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package app

import (
"fmt"
"log"
"net/http"
"os"
)

// Start runs the validation HTTP server.
func Start(defaultMode string) {
mode := defaultMode
args := os.Args[1:]
for i := 0; i < len(args)-1; i++ {
if args[i] == "--mode" {
mode = args[i+1]
break
}
}

port := os.Getenv("PORT")
if port == "" {
switch mode {
case "root":
port = "8081"
case "cmd-server":
port = "8082"
default:
port = "8080"
}
}

mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
_, _ = fmt.Fprintf(w, "hello from %s", mode)
})

log.Printf("starting %s on %s", mode, port)
if err := http.ListenAndServe(":"+port, mux); err != nil {
log.Fatal(err)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "validationapphost/app"

func main() {
app.Start("cmd-server")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module validationapphost

go 1.22
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "validationapphost/app"

func main() {
app.Start("root")
}
Loading
Loading