Skip to content
Closed
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
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ jobs:
env:
RID: ${{ matrix.rid }}

# Trimming breaks only the native-AOT binary (#47), so read real releases and issues with it
# Trimming breaks only the native-AOT binary (#47), so read real releases and issues with it. The token is for
# the rate limit: anonymous requests count against the runner's address, which other jobs share.
- run: ./build.sh smokeaot -s
name: Run the native-AOT binary against GitHub
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}

# 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
16 changes: 11 additions & 5 deletions build/scripts/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -117,28 +117,34 @@ 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. That costs about
// 15 requests. GitHub allows an address 60 anonymous requests an hour, and a hosted runner shares its address
// with other jobs, so the reads use GITHUB_TOKEN when it is set and are anonymous otherwise.
| 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)
let auth =
match Environment.GetEnvironmentVariable "GITHUB_TOKEN" with
| null
| "" -> []
| token -> [ "--token"; token ]
// 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 = text $"{binary} find-previous elastic apm-agent-dotnet --version 1.11.0 {auth}"
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 = text $"{binary} current-version elastic apm-agent-dotnet --query 1.11 --version 1.11.0 {auth}"
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 = text $"{binary} generate elastic apm-agent-dotnet --version 1.11.0 {auth}"
check "generate" notes [ "- #1239 Add Cosmos DB support (issue: #1154)"; "- #1302 Prefer W3C traceparent" ] }

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