Skip to content

Commit 4bac29f

Browse files
committed
Enable FreeBSD CI
1 parent d0d4b9e commit 4bac29f

File tree

3 files changed

+87
-1
lines changed

3 files changed

+87
-1
lines changed

.github/workflows/openbsd.yml

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

.github/workflows/pull_request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ jobs:
1919
windows_exclude_swift_versions: '[{"swift_version": "5.9"}]'
2020
macos_build_command: "xcrun swift build"
2121
macos_exclude_xcode_versions: '[{"xcode_version": "16.0"}, {"xcode_version": "16.1"}]'
22+
freebsd_build_command: "swift build"
2223
enable_macos_checks: true
2324
enable_ios_checks: true
25+
enable_freebsd_checks: true
2426
enable_linux_static_sdk_build: true
2527
enable_wasm_sdk_build: true
2628
enable_embedded_wasm_sdk_build: true

Package.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ 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])),
33+
.linkedLibrary("m", .when(platforms: [.linux, .android, .custom("freebsd")])),
3434
.linkedLibrary("pthread", .when(platforms: [.linux, .custom("freebsd")])),
3535
]
3636
),
@@ -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)