Skip to content

Commit 2c392ee

Browse files
committed
Enable FreeBSD/OpenBSD CI
1 parent d0d4b9e commit 2c392ee

File tree

2 files changed

+81
-2
lines changed

2 files changed

+81
-2
lines changed

.github/workflows/pull_request.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,36 @@ on:
77
pull_request:
88
types: [opened, reopened, synchronize, ready_for_review]
99

10+
env:
11+
OPENBSD_META_DATA_CONTENT: |
12+
{
13+
"instance-id": "iid-local01",
14+
"dsmode": "local"
15+
}
16+
OPENBSD_USER_DATA_CONTENT: |
17+
#cloud-config
18+
timezone: UTC
19+
write_files:
20+
- content: |
21+
set -ex
22+
function atexit {
23+
echo 1 > /tmp/result
24+
tar cvf /dev/sd1c -C /tmp result
25+
halt -p;
26+
}
27+
trap atexit EXIT
28+
printf '\033\143'
29+
export PATH=/usr/local/bin:$PATH
30+
mount /dev/sd3c /mnt
31+
cp -r /mnt/repo /home/repo/
32+
cd /home/repo/
33+
swift build
34+
echo $? > /tmp/result
35+
tar cvf /dev/sd1c -C /tmp result
36+
halt -p
37+
path: /etc/rc.local
38+
permissions: '0755'
39+
1040
jobs:
1141
tests:
1242
name: Test
@@ -19,13 +49,50 @@ jobs:
1949
windows_exclude_swift_versions: '[{"swift_version": "5.9"}]'
2050
macos_build_command: "xcrun swift build"
2151
macos_exclude_xcode_versions: '[{"xcode_version": "16.0"}, {"xcode_version": "16.1"}]'
52+
freebsd_build_command: "swift build"
2253
enable_macos_checks: true
2354
enable_ios_checks: true
55+
enable_freebsd_checks: true
2456
enable_linux_static_sdk_build: true
2557
enable_wasm_sdk_build: true
2658
enable_embedded_wasm_sdk_build: true
2759
enable_android_sdk_build: true
2860

61+
openbsd:
62+
name: OpenBSD (7.8 - amd64)
63+
runs-on: ubuntu-latest
64+
timeout-minutes: 30
65+
container:
66+
image: ghcr.io/3405691582/openbsd-swift-amd64:7.8
67+
env:
68+
CPU: "4"
69+
MEM: "16G"
70+
KVM: "-enable-kvm"
71+
options: --device /dev/kvm
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v6
75+
76+
- name: Write cloud-init files
77+
run: |
78+
echo "$OPENBSD_META_DATA_CONTENT" > /usr/local/share/cidata/meta-data
79+
echo "$OPENBSD_USER_DATA_CONTENT" > /usr/local/share/cidata/user-data
80+
81+
- name: Prepare cloud-init
82+
run: |
83+
cp -r $GITHUB_WORKSPACE /usr/local/share/cidata/repo/ && \
84+
cat /usr/local/share/cidata/meta-data && \
85+
cat /usr/local/share/cidata/user-data && \
86+
ls /usr/local/share/cidata
87+
88+
- name: Run
89+
run: /usr/local/bin/cmd.sh
90+
91+
- name: Report
92+
run: |
93+
ls -l /usr/local/share/tape && \
94+
exit $(cat /usr/local/share/tape/result)
95+
2996
source-integrity:
3097
name: Source integrity check
3198
runs-on: ubuntu-latest

Package.swift

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ let package = Package(
3030
.linkedLibrary("wasi-emulated-process-clocks", .when(platforms: [.wasi])),
3131
.linkedLibrary("wasi-emulated-getpid", .when(platforms: [.wasi])),
3232
.linkedLibrary("dl", .when(platforms: [.linux])),
33-
.linkedLibrary("m", .when(platforms: [.linux, .android])),
34-
.linkedLibrary("pthread", .when(platforms: [.linux, .custom("freebsd")])),
33+
.linkedLibrary("m", .when(platforms: [.linux, .android, .custom("freebsd"), .openbsd])),
34+
.linkedLibrary("pthread", .when(platforms: [.linux, .custom("freebsd"), .openbsd])),
3535
]
3636
),
3737
.target(
@@ -53,3 +53,15 @@ if Context.environment["GITHUB_JOB"] != "embedded-wasm-sdk-build" {
5353
}
5454
}
5555
}
56+
57+
// Build the library as a dylib in CI to ensure it specifies all necessary linkages
58+
if Context.environment["CI"] == "true"
59+
&& Context.environment["GITHUB_JOB"] != "wasm-sdk-build"
60+
&& Context.environment["GITHUB_JOB"] != "embedded-wasm-sdk-build" {
61+
package.products += [
62+
.library(
63+
name: "SwiftToolchainCSQLiteDynamic",
64+
type: .dynamic,
65+
targets: ["SwiftToolchainCSQLite"])
66+
]
67+
}

0 commit comments

Comments
 (0)