Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ env:
RUBY_VERSION: "3.4"
LUA_VERSION: "5.4"
LUAROCKS_VERSION: "3.12.2"
SWIFT_VERSION: "6.2"
# Cargo env vars
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
Expand Down Expand Up @@ -320,6 +321,11 @@ jobs:
with:
bun-version: ${{ env.BUN_VERSION }}

- name: "Install Swift"
uses: swift-actions/setup-swift@7ca6abe6b3b0e8b5421b88be48feee39cbf52c6a # v2.4.0
with:
swift-version: ${{ env.SWIFT_VERSION }}

- name: "Cargo test"
run: |
cargo llvm-cov nextest \
Expand Down Expand Up @@ -409,6 +415,20 @@ jobs:
with:
bun-version: ${{ env.BUN_VERSION }}

- name: "Install Swift"
uses: swift-actions/setup-swift@7ca6abe6b3b0e8b5421b88be48feee39cbf52c6a # v2.4.0
with:
swift-version: ${{ env.SWIFT_VERSION }}

# setup-swift sets TOOLCHAINS, which breaks native extensions using Xcode/clang.
- name: "Reset Xcode toolchain"
run: |
echo "TOOLCHAINS=" >> "$GITHUB_ENV"
echo "DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer" >> "$GITHUB_ENV"
echo "CC=/usr/bin/clang" >> "$GITHUB_ENV"
echo "CXX=/usr/bin/clang++" >> "$GITHUB_ENV"
echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> "$GITHUB_ENV"

- name: "Cargo test"
run: |
cargo nextest run \
Expand Down Expand Up @@ -544,6 +564,12 @@ jobs:
# A dummy dependency path to enable caching of go modules.
cache-dependency-path: LICENSE

- name: "Install Swift"
# `swift-actions/setup-swift` broken on Windows, so use `SwiftyLab/setup-swift`
uses: SwiftyLab/setup-swift@4bbb093f8c68d1dee1caa8b67c681a3f8fe70a91 # v1.12.0
with:
swift-version: ${{ env.SWIFT_VERSION }}

- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # windows only

- name: "Install Lua"
Expand Down
6 changes: 6 additions & 0 deletions crates/prek/src/languages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ mod python;
mod ruby;
mod rust;
mod script;
mod swift;
mod system;
pub mod version;

Expand All @@ -45,6 +46,7 @@ static PYTHON: python::Python = python::Python;
static RUBY: ruby::Ruby = ruby::Ruby;
static RUST: rust::Rust = rust::Rust;
static SCRIPT: script::Script = script::Script;
static SWIFT: swift::Swift = swift::Swift;
static SYSTEM: system::System = system::System;
static UNIMPLEMENTED: Unimplemented = Unimplemented;

Expand Down Expand Up @@ -137,6 +139,7 @@ impl Language {
| Self::Ruby
| Self::Rust
| Self::Script
| Self::Swift
| Self::System
)
}
Expand Down Expand Up @@ -216,6 +219,7 @@ impl Language {
Self::Ruby => RUBY.install(hook, store, reporter).await,
Self::Rust => RUST.install(hook, store, reporter).await,
Self::Script => SCRIPT.install(hook, store, reporter).await,
Self::Swift => SWIFT.install(hook, store, reporter).await,
Self::System => SYSTEM.install(hook, store, reporter).await,
_ => UNIMPLEMENTED.install(hook, store, reporter).await,
}
Expand All @@ -235,6 +239,7 @@ impl Language {
Self::Ruby => RUBY.check_health(info).await,
Self::Rust => RUST.check_health(info).await,
Self::Script => SCRIPT.check_health(info).await,
Self::Swift => SWIFT.check_health(info).await,
Self::System => SYSTEM.check_health(info).await,
_ => UNIMPLEMENTED.check_health(info).await,
}
Expand Down Expand Up @@ -283,6 +288,7 @@ impl Language {
Self::Ruby => RUBY.run(hook, filenames, store, reporter).await,
Self::Rust => RUST.run(hook, filenames, store, reporter).await,
Self::Script => SCRIPT.run(hook, filenames, store, reporter).await,
Self::Swift => SWIFT.run(hook, filenames, store, reporter).await,
Self::System => SYSTEM.run(hook, filenames, store, reporter).await,
_ => UNIMPLEMENTED.run(hook, filenames, store, reporter).await,
}
Expand Down
Loading
Loading