Skip to content

Commit

Permalink
CI: switch to using Linux for testing
Browse files Browse the repository at this point in the history
As the GitHub virtual environment now has the swift toolchain, use
that to build swift-lint and run the tests.
  • Loading branch information
compnerd committed Apr 29, 2020
1 parent 5082c37 commit b596a9e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,21 @@ jobs:
cd ./test/linters/projects/rubocop/
bundle install
# Swift (only on Linux)

- name: install swift-format
if: startsWith(matrix.os, 'ubuntu')
run: |
git clone -b swift-5.2-branch git://github.com/apple/swift-format
cd swift-format
swift build -c release
echo "::add-path::${PWD}/.build/release"
# Swift (only on macOS)

- name: Install Swift dependencies
if: startsWith(matrix.os, 'macos')
run: |
# Because swift-format requires a matching toolchain, use the OSS
# toolchain to ensure that we are using a known revision of the
# toolchain which should enable the use of swift-format for testing.
curl -OL https://swift.org/builds/swift-5.2.1-release/xcode/swift-5.2.1-RELEASE/swift-5.2.1-RELEASE-osx.pkg
sudo installer -verbose -pkg "${PWD}/swift-5.2.1-RELEASE-osx.pkg" -target /
export TOOLCHAINS=swift
brew update
brew install mint
Expand All @@ -102,9 +105,6 @@ jobs:
cd ../swiftlint/
mint bootstrap --link
cd ../swift-format
brew install swift-format
# Tests

- name: Run tests
Expand Down
8 changes: 6 additions & 2 deletions test/linters/linters.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ const linterParams = [
xoParams,
];

// Only run Swift tests on macOS
if (process.platform === "linux") {
linterParams.push(AppleSwiftFormatParams);
}

// Only run some Swift tests on macOS
if (process.platform === "darwin") {
linterParams.push(AppleSwiftFormatParams, swiftformatParams, swiftlintParams);
linterParams.push(swiftformatParams, swiftlintParams);
}

// Copy linter test projects into temporary directory
Expand Down

0 comments on commit b596a9e

Please sign in to comment.