Simplify bazel CI configuration (#313)

This reduces the need to pass through some custom environment, and makes
it work locally on Linux without copying this command
This commit is contained in:
Keith Smiley 2021-03-25 04:57:48 -07:00 committed by GitHub
parent 2ceeb28a28
commit 67a1b1a4f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View File

@ -1 +1,3 @@
build --macos_minimum_os=10.9
build --repo_env=CC=clang
test --test_output=errors

View File

@ -42,7 +42,7 @@ jobs:
shell: bash
- name: Yams tests
if: always()
run: bazelisk test //Tests:YamsTests
run: bazelisk test //Tests:UnitTests
shell: bash
Linux:
strategy:
@ -62,11 +62,9 @@ jobs:
shell: bash
- name: Yams tests
if: always()
run: |
build_workspace_directory=$(bazelisk info workspace)
CC=clang bazelisk test //Tests:YamsTests --action_env=PATH --test_env=BUILD_WORKSPACE_DIRECTORY=$build_workspace_directory
run: bazelisk test //Tests:UnitTests
shell: bash
- name: Yams tests logs
if: always()
run: cat bazel-out/k8-fastbuild/testlogs/Tests/YamsTests/test.log
run: cat bazel-out/k8-fastbuild/testlogs/Tests/UnitTests/test.log
shell: bash

View File

@ -13,17 +13,17 @@ genrule(
name = "LinuxMain",
srcs = ["LinuxMain.swift"],
outs = ["main.swift"],
cmd = "cp $< $@"
cmd = "cp $< $@",
)
swift_test(
name = "YamsTests",
module_name = "YamsTests",
name = "UnitTests",
srcs = glob(["YamsTests/*.swift"]) + select({
":linux": ["main.swift"],
"//conditions:default": [],
}),
data = glob(["YamsTests/Fixtures/**/*.*"]),
module_name = "YamsTests",
deps = [
"//:Yams",
],

View File

@ -12,8 +12,8 @@ import Yams
class PerformanceTests: XCTestCase {
private let fixturesDirectory: String = {
if let buildWorkspace = ProcessInfo.processInfo.environment["BUILD_WORKSPACE_DIRECTORY"] {
return "\(buildWorkspace)/Tests/YamsTests/Fixtures/"
if ProcessInfo.processInfo.environment["TEST_WORKSPACE"] != nil {
return "Tests/YamsTests/Fixtures/"
}
return URL(fileURLWithPath: #file).deletingLastPathComponent().path + "/Fixtures/"
}()