Skip to content

Commit

Permalink
Merge pull request #363 from tayloraswift/frontend-accessible-logging
Browse files Browse the repository at this point in the history
Frontend accessible logging
  • Loading branch information
tayloraswift authored Nov 4, 2024
2 parents 3004446 + 513e7ce commit 721b923
Show file tree
Hide file tree
Showing 34 changed files with 654 additions and 362 deletions.
66 changes: 55 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
branches: [ master ]

jobs:
server:
linux-server:
runs-on: ubuntu-24.04
name: Linux
name: Linux (server)
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -34,8 +34,47 @@ jobs:
-v $PWD:/swift/swift-unidoc \
-w /swift/swift-unidoc \
-e SWIFT_INSTALLATION=/usr \
swift:6.0.1-noble \
/bin/bash Scripts/TestAll
swift:6.0.2-noble \
/bin/bash Scripts/Linux/TestAll
linux:
runs-on: ubuntu-24.04
name: Linux
env:
UNIDOC_ENABLE_INDEXSTORE: "1"

steps:
- name: Install Swift
uses: tayloraswift/swift-install-action@master
with:
swift-prefix: "swift-6.0.2-release/ubuntu2404/swift-6.0.2-RELEASE"
swift-id: "swift-6.0.2-RELEASE-ubuntu24.04"

- name: Checkout repository
uses: actions/checkout@v3

- name: Build release
run: |
swift --version
swift build -c release \
--build-tests \
--explicit-target-dependency-import-check=error \
-Xcxx -I$SWIFT_INSTALLATION/lib/swift \
-Xcxx -I$SWIFT_INSTALLATION/lib/swift/Block
mkdir $HOME/bin
mv .build/release/ssgc $HOME/bin
echo "$HOME/bin" >> $GITHUB_PATH
- name: Build packages
run: Scripts/Linux/GeneratePackageSymbolGraphs

- name: Validate packages
run: |
swift test -c release \
--skip-build \
--filter SymbolGraphValidationTests \
-Xcxx -I$SWIFT_INSTALLATION/lib/swift \
-Xcxx -I$SWIFT_INSTALLATION/lib/swift/Block
macos:
runs-on: macos-15
Expand All @@ -47,15 +86,20 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build debug
- name: Build release
run: |
swift --version
swift build
swift build -c release \
--product ssgc \
--explicit-target-dependency-import-check=error
mkdir $HOME/bin
mv .build/release/ssgc $HOME/bin
echo "$HOME/bin" >> $GITHUB_PATH
- name: Build release
run: |
swift build -c release
- name: Build packages
run: Scripts/macOS/GeneratePackageSymbolGraphs

- name: Test SymbolGraphBuilder
- name: Validate packages
run: |
swift run -c release SymbolGraphBuilderTests
swift test -c release \
--filter SymbolGraphValidationTests
6 changes: 6 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,12 @@ let package:Package = .init(
.product(name: "Testing_", package: "swift-grammar"),
]),

.testTarget(name: "SymbolGraphValidationTests",
dependencies: [
.target(name: "SymbolGraphTesting"),
.target(name: "System_"),
]),

.executableTarget(name: "SymbolGraphBuilderTests",
dependencies: [
.target(name: "SymbolGraphBuilder"),
Expand Down
16 changes: 0 additions & 16 deletions Scripts/GeneratePackageSymbolGraphs

This file was deleted.

55 changes: 55 additions & 0 deletions Scripts/Linux/GeneratePackageSymbolGraphs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
set -e

swift --version

ssgc -u $SWIFT_INSTALLATION \
-r https://github.com/apple/swift-atomics.git \
-t 1.2.0 \
-n swift-atomics \
-o TestPackages/swift-atomics.bson

ssgc -u $SWIFT_INSTALLATION \
-r https://github.com/apple/swift-nio.git \
-t 2.75.0 \
-n swift-nio \
-o TestPackages/swift-nio.bson

ssgc -u $SWIFT_INSTALLATION \
-r https://github.com/apple/swift-nio-ssl.git \
-t 2.29.0 \
-n swift-nio-ssl \
-o TestPackages/swift-nio-ssl.bson

ssgc -u $SWIFT_INSTALLATION \
-r https://github.com/apple/swift-async-dns-resolver.git \
-t 0.1.2 \
-n swift-async-dns-resolver \
-o TestPackages/swift-async-dns-resolver.bson

ssgc -u $SWIFT_INSTALLATION \
-r https://github.com/swiftlang/swift-syntax.git \
-t 600.0.1 \
-n swift-syntax \
-o TestPackages/swift-syntax.bson

ssgc -u $SWIFT_INSTALLATION \
-r https://github.com/pointfreeco/swift-snapshot-testing.git \
-t 1.17.5 \
-n swift-snapshot-testing \
-o TestPackages/swift-snapshot-testing.bson

ssgc -u $SWIFT_INSTALLATION \
-r https://github.com/swiftlang/indexstore-db.git \
-t swift-6.0-RELEASE \
-n indexstore-db \
-o TestPackages/indexstore-db.bson \
--Xcxx -I$SWIFT_INSTALLATION/lib/swift \
--Xcxx -I$SWIFT_INSTALLATION/lib/swift/Block

ssgc -u $SWIFT_INSTALLATION \
-r https://github.com/swiftlang/swift-book.git \
-t swift-5.10-fcs \
-b book \
-n swift-book \
-o TestPackages/swift-book.bson
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

set -e

swift --version
swift build \
--package-path TestModules \
-Xswiftc -emit-symbol-graph \
Expand Down Expand Up @@ -36,3 +37,15 @@ swift symbolgraph-extract \
-include-spi-symbols \
-pretty-print \
-module-name Swift


.build/release/ssgc -u $SWIFT_INSTALLATION \
-n swift \
-o TestPackages/swift.bson

for PACKAGE in swift-test swift-malibu swift-snippets swift-exportation
do
.build/release/ssgc -u $SWIFT_INSTALLATION \
-p TestPackages/$PACKAGE \
-o TestPackages/$PACKAGE.bson
done
12 changes: 6 additions & 6 deletions Scripts/TestAll → Scripts/Linux/TestAll
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ export UNIDOC_ENABLE_INDEXSTORE=1
swift --version
swift build -c release \
--explicit-target-dependency-import-check=error \
-Xcxx -I/usr/lib/swift \
-Xcxx -I/usr/lib/swift/Block \
-Xcxx -I$SWIFT_INSTALLATION/lib/swift \
-Xcxx -I$SWIFT_INSTALLATION/lib/swift/Block \
--build-tests

Scripts/GenerateTestSymbolGraphs
Scripts/GeneratePackageSymbolGraphs
Scripts/Linux/GenerateTestSymbolGraphs

swift test -c release \
--explicit-target-dependency-import-check=error \
-Xcxx -I/usr/lib/swift \
-Xcxx -I/usr/lib/swift/Block \
-Xcxx -I$SWIFT_INSTALLATION/lib/swift \
-Xcxx -I$SWIFT_INSTALLATION/lib/swift/Block \
--no-parallel \
--skip-build \
--skip SymbolGraphValidationTests \
--disable-testable-imports

for f in .build/release/*Tests; do
Expand Down
53 changes: 53 additions & 0 deletions Scripts/macOS/GeneratePackageSymbolGraphs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash
set -e

swift --version

ssgc \
-r https://github.com/apple/swift-atomics.git \
-t 1.2.0 \
-n swift-atomics \
-o TestPackages/swift-atomics.bson

ssgc \
-r https://github.com/apple/swift-nio.git \
-t 2.75.0 \
-n swift-nio \
-o TestPackages/swift-nio.bson

ssgc \
-r https://github.com/apple/swift-nio-ssl.git \
-t 2.29.0 \
-n swift-nio-ssl \
-o TestPackages/swift-nio-ssl.bson

ssgc \
-r https://github.com/apple/swift-async-dns-resolver.git \
-t 0.1.2 \
-n swift-async-dns-resolver \
-o TestPackages/swift-async-dns-resolver.bson

ssgc \
-r https://github.com/swiftlang/swift-syntax.git \
-t 600.0.1 \
-n swift-syntax \
-o TestPackages/swift-syntax.bson

ssgc \
-r https://github.com/pointfreeco/swift-snapshot-testing.git \
-t 1.17.5 \
-n swift-snapshot-testing \
-o TestPackages/swift-snapshot-testing.bson

ssgc \
-r https://github.com/swiftlang/indexstore-db.git \
-t swift-6.0-RELEASE \
-n indexstore-db \
-o TestPackages/indexstore-db.bson

ssgc \
-r https://github.com/swiftlang/swift-book.git \
-t swift-5.10-fcs \
-b book \
-n swift-book \
-o TestPackages/swift-book.bson
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
extension Log
extension HTTP
{
@frozen public
enum Level
enum LogLevel:Comparable, Equatable
{
case debug
case error
case warning
}
}
23 changes: 23 additions & 0 deletions Sources/HTTPServer/HTTP.ActivityTimeoutError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import HTTP

extension HTTP
{
@frozen public
enum ActivityTimeoutError:Error
{
case connection
case stream
}
}
extension HTTP.ActivityTimeoutError:CustomStringConvertible
{
public
var description:String
{
switch self
{
case .connection: "Connection timed out before peer initiated any streams"
case .stream: "Stream timed out before peer sent any headers"
}
}
}
Loading

0 comments on commit 721b923

Please sign in to comment.