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: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ jobs:
- run: ./build.sh smokeaot -s
name: Run the native-AOT binary against GitHub
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }} # read-only; hosted runners share IPs, so the anonymous limit runs out

# Container image, linux-x64 only for now — the platform every GitHub-hosted Linux runner
# already matches. No --push here and no registry login on this leg, so this only proves the
Expand Down
17 changes: 12 additions & 5 deletions build/scripts/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -117,28 +117,35 @@ let main argv =

// The framework-dependent build cannot catch what trimming breaks: #47 broke only the native-AOT binary, where
// Octokit's reflection-based JSON returned nothing or threw. So this publishes that binary and reads releases
// and issues that no longer change: elastic/apm-agent-dotnet's 1.11.0 and the line around it. It runs
// anonymously, as the issue's reproduction did, which costs about 15 of the 60 requests an hour GitHub allows.
// and issues that no longer change: elastic/apm-agent-dotnet's 1.11.0 and the line around it. It costs about 15
// requests. Locally it runs anonymously (60 an hour); in CI the job's read-only GITHUB_TOKEN is passed, because
// hosted runners share IPs and the anonymous limit ran out mid-run on macOS.
| Smokeaot -> target [] {
let rid = RuntimeInformation.RuntimeIdentifier
let publishDirectory = Path.Combine(Paths.Output.FullName, "aot-smoke")
let publish = Paths.RootRelative publishDirectory
sh $"dotnet publish {toolProject} -c Release -f net10.0 -r {rid} -o {publish}"
let executable = if OperatingSystem.IsWindows() then $"{Paths.ToolName}.exe" else Paths.ToolName
let binary = Paths.RootRelative <| Path.Combine(publishDirectory, executable)
// Make.Fs quotes each interpolated hole as one argument, so --token stays in the command text
let token = Environment.GetEnvironmentVariable "GITHUB_TOKEN"
let run (args: string list) =
match token with
| null | "" -> text $"{binary} {args}"
| t -> text $"{binary} {args} --token {t}"
// checked one command at a time and stopping at the first failure, so a broken binary spends few requests
let check (command: string) (result: string) (expected: string list) =
printfn "%s %s:\n%s" Paths.ToolName command result
for line in expected do
if not (result.Contains line) then failwithf "the native-AOT binary's %s did not print '%s'" command line
// the latest release, then every page of releases: one object, then lists
let! previous = text $"{binary} find-previous elastic apm-agent-dotnet --version 1.11.0"
let! previous = run [ "find-previous"; "elastic"; "apm-agent-dotnet"; "--version"; "1.11.0" ]
check "find-previous" previous [ "1.10.0" ]
// every page of releases again, then one release by its tag
let! current = text $"{binary} current-version elastic apm-agent-dotnet --query 1.11 --version 1.11.0"
let! current = run [ "current-version"; "elastic"; "apm-agent-dotnet"; "--query"; "1.11"; "--version"; "1.11.0" ]
check "current-version" current [ "1.11.1"; "1.11.2" ]
// issues and pull requests, with their labels and pull request links
let! notes = text $"{binary} generate elastic apm-agent-dotnet --version 1.11.0"
let! notes = run [ "generate"; "elastic"; "apm-agent-dotnet"; "--version"; "1.11.0" ]
check "generate" notes [ "- #1239 Add Cosmos DB support (issue: #1154)"; "- #1302 Prefer W3C traceparent" ] }

app.RunAsync(argv).GetAwaiter().GetResult()
Loading