Merge branch 'setup' into template

This commit is contained in:
2026-08-15 11:39:26 +02:00
9 changed files with 232 additions and 54 deletions
+6 -5
View File
@@ -1,7 +1,7 @@
# ================================
# Asset image
# ================================
FROM node:22-alpine@sha256:c610fcdfb1d5b4740dd70c284ed3cb16bb857e0f7166196e36a5501df7a3aa32 AS assets
FROM node:22-alpine AS assets
ARG ESBUILD_VERSION=0.28.1
ARG OXIPNG_VERSION=9.1.5
@@ -30,7 +30,7 @@ COPY --from=assets /static /
# ================================
# Build image
# ================================
FROM swift:6.3-noble@sha256:69bf1f0281e13d82c9e49d67c2dd1dcc8c00bad738c860f4323d7078787ec8ea AS build
FROM swift:6.3-noble AS build
# Install OS updates
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
@@ -75,8 +75,9 @@ RUN mkdir -p ./Services/Website/Tests/App ./Services/Website/Tests/Library \
# Switch to the staging area
WORKDIR /staging
# Copy main executable to staging area
RUN cp "$(swift build --package-path /build/Services/Website -c release --show-bin-path)/Website" ./
# Copy main executable to staging area, without its debug sections
RUN cp "$(swift build --package-path /build/Services/Website -c release --show-bin-path)/Website" ./ \
&& strip --strip-debug ./Website
# Copy static swift backtracer binary to staging area
RUN cp "/usr/libexec/swift/linux/swift-backtrace-static" ./
@@ -94,7 +95,7 @@ RUN chmod -R a-w ./Resources
# ================================
# Run image
# ================================
FROM ubuntu:noble@sha256:561618e2c15bf2397621dd04f96926663a3b5616c189cf7e38db7e82f5c538ea
FROM ubuntu:noble
# Make sure all system packages are up to date, and install only essential packages.
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
+6 -1
View File
@@ -120,7 +120,12 @@ let package = Package(
package: "hummingbird"
),
],
path: "Tests/App"
path: "Tests/App",
resources: [
// `Static` links to the service's `Resources/Static`, copying it into the test bundle at build
// time the tests must not read the repository tree, which Xcode's test runner is denied.
.copy("Static")
]
),
.testTarget(
name: "WebsiteLibraryTests",
+12 -8
View File
@@ -20,14 +20,18 @@ struct AppTests {
.js
]
// Absolute path to the package's "Resources/Static" folder, derived from this
// file's location so the static files resolve regardless of the working directory.
private let staticFilesPath = URL(fileURLWithPath: #filePath)
.deletingLastPathComponent() // Tests/App
.deletingLastPathComponent() // Tests
.deletingLastPathComponent() // package root
.appendingPathComponent(.Path.staticResources)
.path
// Absolute path to the copy of the package's "Resources/Static" folder made into the test bundle
// at build time the repository tree itself is off limits to Xcode's test runner.
private let staticFilesPath: String = {
guard let url = Bundle.module.url(
forResource: "Static",
withExtension: nil
) else {
preconditionFailure("The static files are missing from the test bundle.")
}
return url.path
}()
// MARK: Functional tests
+1
View File
@@ -0,0 +1 @@
../../Resources/Static