Skip to content

Commit b0f993b

Browse files
committed
OpenBSD
1 parent e193621 commit b0f993b

6 files changed

Lines changed: 116 additions & 3 deletions

File tree

.github/workflows/freebsd.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: FreeBSD/amd64 build (14.3)
2+
3+
on: [push]
4+
5+
jobs:
6+
build_and_test:
7+
name: Build and Test
8+
env:
9+
SWIFT_INSTALL_PATH: "/opt/swift-main"
10+
SWIFT_WEB_URL: "https://download.swift.org/tmp-ci-nightly/development/freebsd-14_ci_latest.tar.gz"
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v6
14+
- name: Build in FreeBSD
15+
id: build
16+
uses: vmactions/freebsd-vm@v1
17+
with:
18+
envs: 'SWIFT_INSTALL_PATH SWIFT_WEB_URL'
19+
release: "14.3"
20+
sync: rsync
21+
copyback: false
22+
usesh: true
23+
prepare: |
24+
fetch -o /tmp/swift.tar.gz "$SWIFT_WEB_URL"
25+
mkdir -p /opt/swift-main
26+
tar -xzf /tmp/swift.tar.gz -C /opt/swift-main
27+
pkg install -y \
28+
sqlite3 \
29+
python3 \
30+
libuuid \
31+
curl \
32+
brotli \
33+
git
34+
git config --global init.defaultBranch 'main'
35+
"$SWIFT_INSTALL_PATH/usr/bin/swift" --version
36+
run: |
37+
export PATH="$SWIFT_INSTALL_PATH/usr/bin:$PATH"
38+
swift build
39+
swift test --no-parallel

.github/workflows/openbsd.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: OpenBSD/amd64 build (7.8)
2+
3+
on: [push]
4+
5+
env:
6+
META_DATA_CONTENT: |
7+
{
8+
"instance-id": "iid-local01",
9+
"dsmode": "local"
10+
}
11+
USER_DATA_CONTENT: |
12+
#cloud-config
13+
timezone: UTC
14+
write_files:
15+
- content: |
16+
set -ex
17+
function atexit {
18+
echo 1 > /tmp/result
19+
tar cvf /dev/sd1c -C /tmp result
20+
halt -p;
21+
}
22+
trap atexit EXIT
23+
printf '\033\143'
24+
export PATH=/usr/local/bin:$PATH
25+
mount /dev/sd3c /mnt
26+
cp -r /mnt/repo /home/repo/
27+
cd /home/repo/
28+
cp /usr/lib/clang/19/include/stdatomic.h /usr/include/stdatomic.h
29+
swift test
30+
echo $? > /tmp/result
31+
tar cvf /dev/sd1c -C /tmp result
32+
halt -p
33+
path: /etc/rc.local
34+
permissions: '0755'
35+
36+
jobs:
37+
openbsd:
38+
name: OpenBSD
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 30
41+
container:
42+
image: ghcr.io/3405691582/openbsd-swift-amd64:7.8
43+
env:
44+
CPU: "4"
45+
MEM: "16G"
46+
KVM: "-enable-kvm"
47+
options: --device /dev/kvm
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v6
51+
52+
- name: Write cloud-init files
53+
run: |
54+
echo "$META_DATA_CONTENT" > /usr/local/share/cidata/meta-data
55+
echo "$USER_DATA_CONTENT" > /usr/local/share/cidata/user-data
56+
57+
- name: Prepare cloud-init
58+
run: |
59+
cp -r $GITHUB_WORKSPACE /usr/local/share/cidata/repo/ && \
60+
cat /usr/local/share/cidata/meta-data && \
61+
cat /usr/local/share/cidata/user-data && \
62+
ls /usr/local/share/cidata
63+
64+
- name: Run
65+
run: /usr/local/bin/cmd.sh
66+
67+
- name: Report
68+
run: |
69+
ls -l /usr/local/share/tape && \
70+
exit $(cat /usr/local/share/tape/result)

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ let package = Package(
328328
resources: [
329329
.copy("TestData")
330330
],
331-
swiftSettings: swiftSettings(languageMode: .v5)), // Temporarily downgraded from Swift 6 mode due to a source break in 1/31/26 nightly snapshot (rdar://169461269)
331+
swiftSettings: swiftSettings(languageMode: .v5), // Temporarily downgraded from Swift 6 mode due to a source break in 1/31/26 nightly snapshot (rdar://169461269)
332+
linkerSettings: [.linkedLibrary("util", .when(platforms: [.openbsd]))]), // for openpty),
332333
.testTarget(
333334
name: "SWBProjectModelTests",
334335
dependencies: ["SWBProjectModel"],

Sources/SWBUtil/Architecture.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public struct Architecture: Sendable {
9999
return withUnsafeBytes(of: &buf.machine) { buf in
100100
let data = Data(buf)
101101
let value = String(decoding: data[0...(data.lastIndex(where: { $0 != 0 }) ?? 0)], as: UTF8.self)
102-
#if os(FreeBSD)
102+
#if os(FreeBSD) || os(OpenBSD)
103103
switch value {
104104
case "amd64":
105105
return "x86_64"

Tests/SWBAndroidPlatformTests/AndroidSDKTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ fileprivate struct AndroidSDKTests {
2626
#expect(installation.host == host)
2727
}
2828
}
29+
}
2930

31+
@Suite(.requireHostOS(.windows, .macOS, .linux)) // only supported host OSes for the NDK
32+
fileprivate struct AndroidNDKTests {
3033
@Test(.skipHostOS(.windows, "This test inherently relies on Unix-style paths"))
3134
func debian() async throws {
3235
let fs = PseudoFS()

Tests/SWBUtilTests/FSProxyTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ import SystemPackage
591591
}
592592
}
593593

594-
@Test(.skipHostOS(.windows), .skipHostOS(.freebsd, "Blocked on https://github.com/swiftlang/swift/pull/77836"))
594+
@Test(.skipHostOS(.windows), .skipHostOS(.freebsd, "Blocked on https://github.com/swiftlang/swift/pull/77836"), .skipHostOS(.openbsd, "OpenBSD no longer supports extended attributes"))
595595
func extendedAttributesSupport() throws {
596596
try withTemporaryDirectory { (tmpDir: Path) in
597597
// Many filesystems on other platforms (e.g. various non-ext4 temporary filesystems on Linux) don't support xattrs and will return ENOTSUP.

0 commit comments

Comments
 (0)