Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also add a GitHub action to ensure builds are working. Validated on all Apple platforms and Linux.
- Loading branch information
1 parent
938a037
commit 6780f31
Showing
10 changed files
with
227 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Force the tests to not run in sandboxed mode, since it can introduce | ||
# errors and flakes. | ||
test --spawn_strategy=local | ||
build --macos_minimum_os=10.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Bazel | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- 'Sources/**/*.[ch]' | ||
- 'Sources/**/*.swift' | ||
- 'Tests/**/*.swift' | ||
- 'Tests/**/*.ya?ml' | ||
- '**/BUILD' | ||
- 'WORKSPACE' | ||
pull_request: | ||
paths: | ||
- 'Sources/**/*.[ch]' | ||
- 'Sources/**/*.swift' | ||
- 'Tests/**/*.swift' | ||
- 'Tests/**/*.ya?ml' | ||
- '**/BUILD' | ||
- 'WORKSPACE' | ||
|
||
jobs: | ||
MacOS: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: MacOS build test | ||
if: always() | ||
run: bazelisk test //Tests:macOSBuildTest | ||
shell: bash | ||
- name: WatchOS build test | ||
if: always() | ||
run: bazelisk test //Tests:watchOSBuildTest | ||
shell: bash | ||
- name: iOS build test | ||
if: always() | ||
run: bazelisk test //Tests:iOSBuildTest | ||
shell: bash | ||
- name: tvOS build test | ||
if: always() | ||
run: bazelisk test //Tests:tvOSBuildTest | ||
shell: bash | ||
- name: Yams tests | ||
if: always() | ||
run: bazelisk test //Tests:YamsTests | ||
shell: bash | ||
Linux: | ||
strategy: | ||
matrix: | ||
tag: ['5.1', '5.2', '5.3'] | ||
runs-on: ubuntu-latest | ||
container: | ||
image: swift:${{ matrix.tag }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '^1.13.1' # The Go version to download (if necessary) and use. | ||
- name: Setup Bazel | ||
if: always() | ||
run: go get github.com/bazelbuild/bazelisk | ||
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 | ||
shell: bash | ||
- name: Yams tests logs | ||
if: always() | ||
run: cat bazel-out/k8-fastbuild/testlogs/Tests/YamsTests/test.log | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
load( | ||
"@rules_cc//cc:defs.bzl", | ||
"cc_library" | ||
) | ||
|
||
cc_library( | ||
name = "CYaml", | ||
srcs = glob(["src/*.c", "src/*.h"]), | ||
hdrs = ["include/yaml.h"], | ||
includes = ["include"], | ||
visibility = [ | ||
"//Sources/Yams:__pkg__", | ||
"//Tests:__subpackages__", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") | ||
|
||
swift_library( | ||
name = "Yams", | ||
module_name = "Yams", | ||
srcs = glob(["*.swift"]), | ||
copts = [ | ||
"-DSWIFT_PACKAGE", | ||
], | ||
visibility = ["//visibility:public"], | ||
deps = ["//Sources/CYaml:CYaml"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_build_test") | ||
load("@build_bazel_rules_apple//apple:watchos.bzl", "watchos_build_test") | ||
load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_build_test") | ||
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_build_test") | ||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_test") | ||
|
||
config_setting( | ||
name = "linux", | ||
constraint_values = ["@platforms//os:linux"], | ||
) | ||
|
||
genrule( | ||
name = "LinuxMain", | ||
srcs = ["LinuxMain.swift"], | ||
outs = ["main.swift"], | ||
cmd = "cp $< $@" | ||
) | ||
|
||
swift_test( | ||
name = "YamsTests", | ||
module_name = "YamsTests", | ||
srcs = glob(["YamsTests/*.swift"]) + select({ | ||
":linux": ["main.swift"], | ||
"//conditions:default": [], | ||
}), | ||
data = glob(["YamsTests/Fixtures/**/*.*"]), | ||
deps = [ | ||
"//Sources/Yams:Yams", | ||
], | ||
) | ||
|
||
macos_build_test( | ||
name = "macOSBuildTest", | ||
minimum_os_version = "10.9", | ||
targets = [ | ||
"//Sources/Yams:Yams", | ||
"//Sources/CYaml:CYaml", | ||
], | ||
) | ||
|
||
watchos_build_test( | ||
name = "watchOSBuildTest", | ||
minimum_os_version = "2.0", | ||
targets = [ | ||
"//Sources/Yams:Yams", | ||
"//Sources/CYaml:CYaml", | ||
], | ||
) | ||
|
||
tvos_build_test( | ||
name = "tvOSBuildTest", | ||
minimum_os_version = "9.0", | ||
targets = [ | ||
"//Sources/Yams:Yams", | ||
"//Sources/CYaml:CYaml", | ||
], | ||
) | ||
|
||
ios_build_test( | ||
name = "iOSBuildTest", | ||
minimum_os_version = "8.0", | ||
targets = [ | ||
"//Sources/Yams:Yams", | ||
"//Sources/CYaml:CYaml", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "build_bazel_rules_apple", | ||
sha256 = "09423d57ace0fca1b84e19326dc9aadd42f2be52f1b5a15bc652d18c2c1dee71", | ||
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.30.0/rules_apple.0.30.0.tar.gz", | ||
) | ||
|
||
load( | ||
"@build_bazel_rules_apple//apple:repositories.bzl", | ||
"apple_rules_dependencies", | ||
) | ||
|
||
apple_rules_dependencies() | ||
|
||
load( | ||
"@build_bazel_rules_swift//swift:repositories.bzl", | ||
"swift_rules_dependencies", | ||
) | ||
|
||
swift_rules_dependencies() | ||
|
||
load( | ||
"@build_bazel_rules_swift//swift:extras.bzl", | ||
"swift_rules_extra_dependencies", | ||
) | ||
|
||
swift_rules_extra_dependencies() |