diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c7543f6..4f650af 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -7,10 +7,40 @@ on: pull_request: types: [opened, reopened, synchronize, ready_for_review] +env: + OPENBSD_META_DATA_CONTENT: | + { + "instance-id": "iid-local01", + "dsmode": "local" + } + OPENBSD_USER_DATA_CONTENT: | + #cloud-config + timezone: UTC + write_files: + - content: | + set -ex + function atexit { + echo 1 > /tmp/result + tar cvf /dev/sd1c -C /tmp result + halt -p; + } + trap atexit EXIT + printf '\033\143' + export PATH=/usr/local/bin:$PATH + mount /dev/sd3c /mnt + cp -r /mnt/repo /home/repo/ + cd /home/repo/ + swift build + echo $? > /tmp/result + tar cvf /dev/sd1c -C /tmp result + halt -p + path: /etc/rc.local + permissions: '0755' + jobs: tests: name: Test - uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main + uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.10 with: linux_os_versions: '["amazonlinux2", "bookworm", "noble", "jammy", "rhel-ubi9"]' linux_build_command: "swift build" @@ -19,13 +49,50 @@ jobs: windows_exclude_swift_versions: '[{"swift_version": "5.9"}]' macos_build_command: "xcrun swift build" macos_exclude_xcode_versions: '[{"xcode_version": "16.0"}, {"xcode_version": "16.1"}]' + freebsd_build_command: "swift build" enable_macos_checks: true enable_ios_checks: true + enable_freebsd_checks: true enable_linux_static_sdk_build: true enable_wasm_sdk_build: true enable_embedded_wasm_sdk_build: true enable_android_sdk_build: true + openbsd: + name: OpenBSD (7.8 - amd64) + runs-on: ubuntu-latest + timeout-minutes: 30 + container: + image: ghcr.io/3405691582/openbsd-swift-amd64:7.8 + env: + CPU: "4" + MEM: "16G" + KVM: "-enable-kvm" + options: --device /dev/kvm + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Write cloud-init files + run: | + echo "$OPENBSD_META_DATA_CONTENT" > /usr/local/share/cidata/meta-data + echo "$OPENBSD_USER_DATA_CONTENT" > /usr/local/share/cidata/user-data + + - name: Prepare cloud-init + run: | + cp -r $GITHUB_WORKSPACE /usr/local/share/cidata/repo/ && \ + cat /usr/local/share/cidata/meta-data && \ + cat /usr/local/share/cidata/user-data && \ + ls /usr/local/share/cidata + + - name: Run + run: /usr/local/bin/cmd.sh + + - name: Report + run: | + ls -l /usr/local/share/tape && \ + exit $(cat /usr/local/share/tape/result) + source-integrity: name: Source integrity check runs-on: ubuntu-latest diff --git a/Package.swift b/Package.swift index 5202278..d702e65 100644 --- a/Package.swift +++ b/Package.swift @@ -30,8 +30,8 @@ let package = Package( .linkedLibrary("wasi-emulated-process-clocks", .when(platforms: [.wasi])), .linkedLibrary("wasi-emulated-getpid", .when(platforms: [.wasi])), .linkedLibrary("dl", .when(platforms: [.linux])), - .linkedLibrary("m", .when(platforms: [.linux, .android])), - .linkedLibrary("pthread", .when(platforms: [.linux, .custom("freebsd")])), + .linkedLibrary("m", .when(platforms: [.linux, .android, .custom("freebsd"), .openbsd])), + .linkedLibrary("pthread", .when(platforms: [.linux, .custom("freebsd"), .openbsd])), ] ), .target( @@ -53,3 +53,16 @@ if Context.environment["GITHUB_JOB"] != "embedded-wasm-sdk-build" { } } } + +// Build the library as a dylib in CI to ensure it specifies all necessary linkages +if Context.environment["CI"] == "true" + && Context.environment["GITHUB_JOB"] != "wasm-sdk-build" + && Context.environment["GITHUB_JOB"] != "embedded-wasm-sdk-build" +{ + package.products += [ + .library( + name: "SwiftToolchainCSQLiteDynamic", + type: .dynamic, + targets: ["SwiftToolchainCSQLite"]) + ] +}