From ce22fc51fafb41fc5014debe47fa0ec43cb58ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Mon, 28 Nov 2022 17:50:19 -0500 Subject: [PATCH 01/24] Initial steps for swift support --- WORKSPACE | 34 +++++++++++++++++++++++++++++++++- swift/BUILD | 6 ++++++ swift/main.swift | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 swift/BUILD create mode 100644 swift/main.swift diff --git a/WORKSPACE b/WORKSPACE index c2fc972d..71b9684a 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -2,7 +2,6 @@ workspace(name = "example") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") # Some file dependencies http_file( @@ -81,6 +80,19 @@ http_archive( ], ) +http_archive( + name = "io_bazel_stardoc", + sha256 = "3fd8fec4ddec3c670bd810904e2e33170bedfe12f90adf943508184be458c8bb", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz", + "https://github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz", + ], +) + +load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories") + +stardoc_repositories() + load("@rules_proto_grpc//java:repositories.bzl", rules_proto_grpc_java_repos = "java_repos") rules_proto_grpc_java_repos() @@ -229,3 +241,23 @@ load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "dotnet_register_toolchains", "d dotnet_register_toolchains() dotnet_repositories_nugets() + +http_archive( + name = "build_bazel_rules_swift", + sha256 = "51efdaf85e04e51174de76ef563f255451d5a5cd24c61ad902feeadafc7046d9", + url = "https://github.com/bazelbuild/rules_swift/releases/download/1.2.0/rules_swift.1.2.0.tar.gz", +) + +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() \ No newline at end of file diff --git a/swift/BUILD b/swift/BUILD new file mode 100644 index 00000000..ca9031a3 --- /dev/null +++ b/swift/BUILD @@ -0,0 +1,6 @@ +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary", "swift_library") + +swift_binary( + name = "swift", + srcs = ["main.swift"], +) \ No newline at end of file diff --git a/swift/main.swift b/swift/main.swift new file mode 100644 index 00000000..4648e701 --- /dev/null +++ b/swift/main.swift @@ -0,0 +1 @@ +print("Hello, World!") \ No newline at end of file From 74aa7b584d9b142899a24d7c77cf74ff71913b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Fri, 23 Dec 2022 11:36:26 -0500 Subject: [PATCH 02/24] Updated to rules_swift 1.5.0 --- WORKSPACE | 4 ++-- swift/BUILD | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 71b9684a..ed211b19 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -244,8 +244,8 @@ dotnet_repositories_nugets() http_archive( name = "build_bazel_rules_swift", - sha256 = "51efdaf85e04e51174de76ef563f255451d5a5cd24c61ad902feeadafc7046d9", - url = "https://github.com/bazelbuild/rules_swift/releases/download/1.2.0/rules_swift.1.2.0.tar.gz", + sha256 = "32f95dbe6a88eb298aaa790f05065434f32a662c65ec0a6aabdaf6881e4f169f", + url = "https://github.com/bazelbuild/rules_swift/releases/download/1.5.0/rules_swift.1.5.0.tar.gz", ) load( diff --git a/swift/BUILD b/swift/BUILD index ca9031a3..da892da2 100644 --- a/swift/BUILD +++ b/swift/BUILD @@ -1,4 +1,4 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary", "swift_library") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary") swift_binary( name = "swift", From 08b6319c8aa6b603b421a1472681a230df78b40a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Fri, 23 Dec 2022 11:53:27 -0500 Subject: [PATCH 03/24] Swift example as new workspace so to use bazel 6.0.0 --- WORKSPACE | 20 -------------------- swift/.bazelversion | 1 + swift/WORKSPACE | 21 +++++++++++++++++++++ 3 files changed, 22 insertions(+), 20 deletions(-) create mode 100644 swift/.bazelversion create mode 100644 swift/WORKSPACE diff --git a/WORKSPACE b/WORKSPACE index ed211b19..7d4ec4c2 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -241,23 +241,3 @@ load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "dotnet_register_toolchains", "d dotnet_register_toolchains() dotnet_repositories_nugets() - -http_archive( - name = "build_bazel_rules_swift", - sha256 = "32f95dbe6a88eb298aaa790f05065434f32a662c65ec0a6aabdaf6881e4f169f", - url = "https://github.com/bazelbuild/rules_swift/releases/download/1.5.0/rules_swift.1.5.0.tar.gz", -) - -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() \ No newline at end of file diff --git a/swift/.bazelversion b/swift/.bazelversion new file mode 100644 index 00000000..09b254e9 --- /dev/null +++ b/swift/.bazelversion @@ -0,0 +1 @@ +6.0.0 diff --git a/swift/WORKSPACE b/swift/WORKSPACE new file mode 100644 index 00000000..0f65309b --- /dev/null +++ b/swift/WORKSPACE @@ -0,0 +1,21 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "build_bazel_rules_swift", + sha256 = "32f95dbe6a88eb298aaa790f05065434f32a662c65ec0a6aabdaf6881e4f169f", + url = "https://github.com/bazelbuild/rules_swift/releases/download/1.5.0/rules_swift.1.5.0.tar.gz", +) + +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() \ No newline at end of file From 313549c10153714aeb7864a18b9c5cf0f159f136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Fri, 23 Dec 2022 12:00:40 -0500 Subject: [PATCH 04/24] Addeing swift worlflow --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 30233bbc..296cfc20 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,3 +51,8 @@ jobs: - name: Building //csharp directory run: bazel build //csharp/... + + - name: Building //swift directory + run: | + cd swift + bazel build //... From f95625d6f062322e8c76915c91fc859abb08e9a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Fri, 23 Dec 2022 12:11:02 -0500 Subject: [PATCH 05/24] Adding new lines and removinf stardoc --- WORKSPACE | 13 ------------- swift/BUILD | 2 +- swift/WORKSPACE | 2 +- swift/main.swift | 2 +- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 5cca5476..df813f36 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -82,19 +82,6 @@ http_archive( ], ) -http_archive( - name = "io_bazel_stardoc", - sha256 = "3fd8fec4ddec3c670bd810904e2e33170bedfe12f90adf943508184be458c8bb", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz", - "https://github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz", - ], -) - -load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories") - -stardoc_repositories() - load("@rules_proto_grpc//java:repositories.bzl", rules_proto_grpc_java_repos = "java_repos") rules_proto_grpc_java_repos() diff --git a/swift/BUILD b/swift/BUILD index da892da2..949e33f3 100644 --- a/swift/BUILD +++ b/swift/BUILD @@ -3,4 +3,4 @@ load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary") swift_binary( name = "swift", srcs = ["main.swift"], -) \ No newline at end of file +) diff --git a/swift/WORKSPACE b/swift/WORKSPACE index 0f65309b..59a56e06 100644 --- a/swift/WORKSPACE +++ b/swift/WORKSPACE @@ -18,4 +18,4 @@ load( "swift_rules_extra_dependencies", ) -swift_rules_extra_dependencies() \ No newline at end of file +swift_rules_extra_dependencies() diff --git a/swift/main.swift b/swift/main.swift index 4648e701..7df869a1 100644 --- a/swift/main.swift +++ b/swift/main.swift @@ -1 +1 @@ -print("Hello, World!") \ No newline at end of file +print("Hello, World!") From 724d5011d640b1e5982f2817c2bbe81da8853221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Fri, 23 Dec 2022 12:17:13 -0500 Subject: [PATCH 06/24] Cheking is CC=clang works out of the box --- .github/workflows/main.yml | 72 +++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e632f958..9294f011 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,43 +22,43 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Building //cpp directory - run: bazel build //cpp/... - - - name: Building //docker directory - run: bazel build //docker/... - - - name: Building //genrules directory - run: bazel build //genrules/... - - - name: Building //go directory - run: bazel build //go/... - - - name: Building //java directory - run: | - bazel test //java/... - - - name: Building //kotlin directory - run: bazel build //kotlin/... - - - name: Building //scala directory - run: | - bazel test //scala/... - - - name: Building //typescript directory - run: | - bazel test //typescript/... - - - name: Building //csharp directory - run: bazel build //csharp/... - - - name: Building //perl directory - run: bazel build //perl/... - - - name: Building //python directory - run: bazel build //python/... +# - name: Building //cpp directory +# run: bazel build //cpp/... +# +# - name: Building //docker directory +# run: bazel build //docker/... +# +# - name: Building //genrules directory +# run: bazel build //genrules/... +# +# - name: Building //go directory +# run: bazel build //go/... +# +# - name: Building //java directory +# run: | +# bazel test //java/... +# +# - name: Building //kotlin directory +# run: bazel build //kotlin/... +# +# - name: Building //scala directory +# run: | +# bazel test //scala/... +# +# - name: Building //typescript directory +# run: | +# bazel test //typescript/... +# +# - name: Building //csharp directory +# run: bazel build //csharp/... +# +# - name: Building //perl directory +# run: bazel build //perl/... +# +# - name: Building //python directory +# run: bazel build //python/... - name: Building //swift directory run: | cd swift - bazel build //... + CC=clang bazel build //... From 12defcbef12a54ee828d5648247910b095e53d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Fri, 23 Dec 2022 13:03:03 -0500 Subject: [PATCH 07/24] Testing with dotnet toolchains --- swift/.bazelrc | 26 ++++++++++++++++++++++++++ swift/WORKSPACE | 20 ++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 swift/.bazelrc diff --git a/swift/.bazelrc b/swift/.bazelrc new file mode 100644 index 00000000..8ef5af9a --- /dev/null +++ b/swift/.bazelrc @@ -0,0 +1,26 @@ +build --enable_platform_specific_config +# Options common for all EngFlow remote configurations. +build:engflow_common --jobs=8 +build:engflow_common --define=EXECUTOR=remote +build:engflow_common --disk_cache= +build:engflow_common --experimental_inmemory_dotd_files +build:engflow_common --experimental_inmemory_jdeps_files +build:engflow_common --incompatible_strict_action_env=true +build:engflow_common --remote_timeout=3600 + +build:engflow_common --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 +build:engflow_common --crosstool_top=//remote_config/cc:toolchain +build:engflow_common --cpu=k8 +build:engflow_common --extra_execution_platforms=//remote_config/config:platform +build:engflow_common --extra_toolchains=//remote_config/config:cc-toolchain +build:engflow_common --host_platform=//remote_config/config:platform +build:engflow_common --platforms=//remote_config/config:platform +build:engflow_common --java_runtime_version=remotejdk_11 +build:engflow_common --java_language_version=11 + +build:macos --host_platform @io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_3.1.100 +build:macos --platforms @io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_3.1.100 +build:linux --host_platform @io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_3.1.100 +build:linux --platforms @io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_3.1.100 + +build:without_bytes --experimental_remote_download_outputs=minimal diff --git a/swift/WORKSPACE b/swift/WORKSPACE index 59a56e06..c1406ce9 100644 --- a/swift/WORKSPACE +++ b/swift/WORKSPACE @@ -19,3 +19,23 @@ load( ) swift_rules_extra_dependencies() + +http_archive( + name = "io_bazel_rules_dotnet", + sha256 = "5098268d2950d658a0ab5558fa9faa590866be7ff1b20a97964b37720f8af2c6", + strip_prefix = "rules_dotnet-0b7ae93fa81b7327a655118da0581db5ebbe0b8d", + urls = [ + "https://storage.googleapis.com/engflow-tools-public/rules_dotnet-0b7ae93fa81b7327a655118da0581db5ebbe0b8d.zip", + "https://github.com/bazelbuild/rules_dotnet/archive/0b7ae93fa81b7327a655118da0581db5ebbe0b8d.zip", + ], +) + +load("@io_bazel_rules_dotnet//dotnet:deps.bzl", "dotnet_repositories") + +dotnet_repositories() + +load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "dotnet_register_toolchains", "dotnet_repositories_nugets") + +dotnet_register_toolchains() + +dotnet_repositories_nugets() From 9a9c0f9fa0d0ed6b7e17cb7aa0decd459ceafccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Fri, 23 Dec 2022 13:08:22 -0500 Subject: [PATCH 08/24] Adding swift envionment to runner --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9294f011..0f4c96c5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,6 +22,11 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: swift-actions/setup-swift@v1 + + - name: Get swift version + run: swift --version # Swift 5.7.2 + # - name: Building //cpp directory # run: bazel build //cpp/... # From 7d2bacd02af1fa7f0086471de130a8252e60b375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Fri, 23 Dec 2022 13:16:06 -0500 Subject: [PATCH 09/24] Removing dotnet toolchains from swift --- .github/workflows/main.yml | 10 +++------- swift/.bazelrc | 26 -------------------------- swift/WORKSPACE | 20 -------------------- 3 files changed, 3 insertions(+), 53 deletions(-) delete mode 100644 swift/.bazelrc diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0f4c96c5..e4e23fb5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,14 +22,9 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: swift-actions/setup-swift@v1 - - - name: Get swift version - run: swift --version # Swift 5.7.2 + - name: Building //cpp directory + run: bazel build //cpp/... -# - name: Building //cpp directory -# run: bazel build //cpp/... -# # - name: Building //docker directory # run: bazel build //docker/... # @@ -62,6 +57,7 @@ jobs: # # - name: Building //python directory # run: bazel build //python/... + - uses: swift-actions/setup-swift@v1 - name: Building //swift directory run: | diff --git a/swift/.bazelrc b/swift/.bazelrc deleted file mode 100644 index 8ef5af9a..00000000 --- a/swift/.bazelrc +++ /dev/null @@ -1,26 +0,0 @@ -build --enable_platform_specific_config -# Options common for all EngFlow remote configurations. -build:engflow_common --jobs=8 -build:engflow_common --define=EXECUTOR=remote -build:engflow_common --disk_cache= -build:engflow_common --experimental_inmemory_dotd_files -build:engflow_common --experimental_inmemory_jdeps_files -build:engflow_common --incompatible_strict_action_env=true -build:engflow_common --remote_timeout=3600 - -build:engflow_common --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 -build:engflow_common --crosstool_top=//remote_config/cc:toolchain -build:engflow_common --cpu=k8 -build:engflow_common --extra_execution_platforms=//remote_config/config:platform -build:engflow_common --extra_toolchains=//remote_config/config:cc-toolchain -build:engflow_common --host_platform=//remote_config/config:platform -build:engflow_common --platforms=//remote_config/config:platform -build:engflow_common --java_runtime_version=remotejdk_11 -build:engflow_common --java_language_version=11 - -build:macos --host_platform @io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_3.1.100 -build:macos --platforms @io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_3.1.100 -build:linux --host_platform @io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_3.1.100 -build:linux --platforms @io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_3.1.100 - -build:without_bytes --experimental_remote_download_outputs=minimal diff --git a/swift/WORKSPACE b/swift/WORKSPACE index c1406ce9..59a56e06 100644 --- a/swift/WORKSPACE +++ b/swift/WORKSPACE @@ -19,23 +19,3 @@ load( ) swift_rules_extra_dependencies() - -http_archive( - name = "io_bazel_rules_dotnet", - sha256 = "5098268d2950d658a0ab5558fa9faa590866be7ff1b20a97964b37720f8af2c6", - strip_prefix = "rules_dotnet-0b7ae93fa81b7327a655118da0581db5ebbe0b8d", - urls = [ - "https://storage.googleapis.com/engflow-tools-public/rules_dotnet-0b7ae93fa81b7327a655118da0581db5ebbe0b8d.zip", - "https://github.com/bazelbuild/rules_dotnet/archive/0b7ae93fa81b7327a655118da0581db5ebbe0b8d.zip", - ], -) - -load("@io_bazel_rules_dotnet//dotnet:deps.bzl", "dotnet_repositories") - -dotnet_repositories() - -load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "dotnet_register_toolchains", "dotnet_repositories_nugets") - -dotnet_register_toolchains() - -dotnet_repositories_nugets() From 77f8f469244cd2e73add35b86396b197e7abdc3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Fri, 23 Dec 2022 13:29:12 -0500 Subject: [PATCH 10/24] Conditionally using swift-actions/setup-swift@v1; only linux --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4e23fb5..bea6fc7b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,7 +57,9 @@ jobs: # # - name: Building //python directory # run: bazel build //python/... + - uses: swift-actions/setup-swift@v1 + if: matrix.os == 'ubuntu-20.04' - name: Building //swift directory run: | From 8fb3ea8557f1f7107982db7d5d5fd7ebacfbd58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Fri, 23 Dec 2022 13:34:36 -0500 Subject: [PATCH 11/24] Adding back remaining tests --- .github/workflows/main.yml | 64 +++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bea6fc7b..f4b89b23 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,38 +25,38 @@ jobs: - name: Building //cpp directory run: bazel build //cpp/... -# - name: Building //docker directory -# run: bazel build //docker/... -# -# - name: Building //genrules directory -# run: bazel build //genrules/... -# -# - name: Building //go directory -# run: bazel build //go/... -# -# - name: Building //java directory -# run: | -# bazel test //java/... -# -# - name: Building //kotlin directory -# run: bazel build //kotlin/... -# -# - name: Building //scala directory -# run: | -# bazel test //scala/... -# -# - name: Building //typescript directory -# run: | -# bazel test //typescript/... -# -# - name: Building //csharp directory -# run: bazel build //csharp/... -# -# - name: Building //perl directory -# run: bazel build //perl/... -# -# - name: Building //python directory -# run: bazel build //python/... + - name: Building //docker directory + run: bazel build //docker/... + + - name: Building //genrules directory + run: bazel build //genrules/... + + - name: Building //go directory + run: bazel build //go/... + + - name: Building //java directory + run: | + bazel test //java/... + + - name: Building //kotlin directory + run: bazel build //kotlin/... + + - name: Building //scala directory + run: | + bazel test //scala/... + + - name: Building //typescript directory + run: | + bazel test //typescript/... + + - name: Building //csharp directory + run: bazel build //csharp/... + + - name: Building //perl directory + run: bazel build //perl/... + + - name: Building //python directory + run: bazel build //python/... - uses: swift-actions/setup-swift@v1 if: matrix.os == 'ubuntu-20.04' From d970d56162904eb7a86c833c52e55c7da1239953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Fri, 23 Dec 2022 16:11:22 -0500 Subject: [PATCH 12/24] Added config for clang in swift --- swift/.bazelrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 swift/.bazelrc diff --git a/swift/.bazelrc b/swift/.bazelrc new file mode 100644 index 00000000..9e47f2f5 --- /dev/null +++ b/swift/.bazelrc @@ -0,0 +1 @@ +build:clang --client_env=CC=clang \ No newline at end of file From c6ef29fdbde854cff6712901d0a2412640181c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Fri, 23 Dec 2022 16:58:09 -0500 Subject: [PATCH 13/24] Trying to run on CI to execute on macos --- .github/workflows/main.yml | 2 +- swift/BUILD | 8 +++++++- swift/swfit_test.swift | 8 ++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 swift/swfit_test.swift diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f4b89b23..cbb78196 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -64,4 +64,4 @@ jobs: - name: Building //swift directory run: | cd swift - CC=clang bazel build //... + bazel test --config=clang //... diff --git a/swift/BUILD b/swift/BUILD index 949e33f3..15b0b677 100644 --- a/swift/BUILD +++ b/swift/BUILD @@ -1,6 +1,12 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary", "swift_test") swift_binary( name = "swift", srcs = ["main.swift"], ) + +swift_test( + name = "MyTests", + srcs = ["swfit_test.swift"], + # features = ["-swift.bundled_xctests"], +) \ No newline at end of file diff --git a/swift/swfit_test.swift b/swift/swfit_test.swift new file mode 100644 index 00000000..46fbf4ae --- /dev/null +++ b/swift/swfit_test.swift @@ -0,0 +1,8 @@ +import XCTest + +class SwiftTest { + func testEquality() { + let student = 4 + XCTAssertEqual(student, 4) + } +} From 9ba54ae154c774026640a5b08b28bf8e8ad5d955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Mon, 26 Dec 2022 11:04:48 -0500 Subject: [PATCH 14/24] Testing on linux and macos --- .github/workflows/main.yml | 70 +++++++++++++++++++------------------- swift/BUILD | 12 ++----- swift/main.swift | 34 +++++++++++++++++- swift/swfit_test.swift | 8 ----- 4 files changed, 71 insertions(+), 53 deletions(-) delete mode 100644 swift/swfit_test.swift diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cbb78196..7e22bbfb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,41 +22,41 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Building //cpp directory - run: bazel build //cpp/... - - - name: Building //docker directory - run: bazel build //docker/... - - - name: Building //genrules directory - run: bazel build //genrules/... - - - name: Building //go directory - run: bazel build //go/... - - - name: Building //java directory - run: | - bazel test //java/... - - - name: Building //kotlin directory - run: bazel build //kotlin/... - - - name: Building //scala directory - run: | - bazel test //scala/... - - - name: Building //typescript directory - run: | - bazel test //typescript/... - - - name: Building //csharp directory - run: bazel build //csharp/... - - - name: Building //perl directory - run: bazel build //perl/... - - - name: Building //python directory - run: bazel build //python/... +# - name: Building //cpp directory +# run: bazel build //cpp/... +# +# - name: Building //docker directory +# run: bazel build //docker/... +# +# - name: Building //genrules directory +# run: bazel build //genrules/... +# +# - name: Building //go directory +# run: bazel build //go/... +# +# - name: Building //java directory +# run: | +# bazel test //java/... +# +# - name: Building //kotlin directory +# run: bazel build //kotlin/... +# +# - name: Building //scala directory +# run: | +# bazel test //scala/... +# +# - name: Building //typescript directory +# run: | +# bazel test //typescript/... +# +# - name: Building //csharp directory +# run: bazel build //csharp/... +# +# - name: Building //perl directory +# run: bazel build //perl/... +# +# - name: Building //python directory +# run: bazel build //python/... - uses: swift-actions/setup-swift@v1 if: matrix.os == 'ubuntu-20.04' diff --git a/swift/BUILD b/swift/BUILD index 15b0b677..8ea8e7e0 100644 --- a/swift/BUILD +++ b/swift/BUILD @@ -1,12 +1,6 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary", "swift_test") - -swift_binary( - name = "swift", - srcs = ["main.swift"], -) +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_test") swift_test( - name = "MyTests", - srcs = ["swfit_test.swift"], - # features = ["-swift.bundled_xctests"], + name = "tests", + srcs = [ "main.swift"], ) \ No newline at end of file diff --git a/swift/main.swift b/swift/main.swift index 7df869a1..22a5a88b 100644 --- a/swift/main.swift +++ b/swift/main.swift @@ -1 +1,33 @@ -print("Hello, World!") +import XCTest + +class SwiftTests: XCTestCase { + func fizzbuzz(i: Int) -> String { + if (i % 3 == 0) { + if (i % 5 == 0) { + return "FizzBuzz"; + } + return "Fizz"; + } else if (i % 5 == 0) { + return "Buzz"; + } else { + return String(i); + } + } + + func test() { + XCTAssertEqual(fizzbuzz(i: 1), "1") + XCTAssertEqual(fizzbuzz(i: 2), "2") + XCTAssertEqual(fizzbuzz(i: 3), "Fizz") + XCTAssertEqual(fizzbuzz(i: 4), "4") + XCTAssertEqual(fizzbuzz(i: 5), "Buzz") + XCTAssertEqual(fizzbuzz(i: 15), "FizzBuzz") + } + + static var allTests = [ + ("test", test), + ] +} + +XCTMain([ + testCase(SwiftTests.allTests), +]) \ No newline at end of file diff --git a/swift/swfit_test.swift b/swift/swfit_test.swift deleted file mode 100644 index 46fbf4ae..00000000 --- a/swift/swfit_test.swift +++ /dev/null @@ -1,8 +0,0 @@ -import XCTest - -class SwiftTest { - func testEquality() { - let student = 4 - XCTAssertEqual(student, 4) - } -} From b04fae8feb8b684be513e75127567db0973a339d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Mon, 26 Dec 2022 11:07:49 -0500 Subject: [PATCH 15/24] Testing again with visual aid --- .github/workflows/main.yml | 2 +- swift/main.swift | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7e22bbfb..0423f053 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -64,4 +64,4 @@ jobs: - name: Building //swift directory run: | cd swift - bazel test --config=clang //... + bazel test --config=clang //... --test_output=all diff --git a/swift/main.swift b/swift/main.swift index 22a5a88b..dec5fde6 100644 --- a/swift/main.swift +++ b/swift/main.swift @@ -21,6 +21,7 @@ class SwiftTests: XCTestCase { XCTAssertEqual(fizzbuzz(i: 4), "4") XCTAssertEqual(fizzbuzz(i: 5), "Buzz") XCTAssertEqual(fizzbuzz(i: 15), "FizzBuzz") + print(fizzbuzz(i: 5)) } static var allTests = [ From 075a0ee9da22d84cded3231d031789c8e1876b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Mon, 26 Dec 2022 11:23:58 -0500 Subject: [PATCH 16/24] Testing new file organization --- swift/BUILD | 2 +- swift/example.swift | 30 ++++++++++++++++++++++++++++++ swift/main.swift | 29 ----------------------------- 3 files changed, 31 insertions(+), 30 deletions(-) create mode 100644 swift/example.swift diff --git a/swift/BUILD b/swift/BUILD index 8ea8e7e0..a4f384f2 100644 --- a/swift/BUILD +++ b/swift/BUILD @@ -2,5 +2,5 @@ load("@build_bazel_rules_swift//swift:swift.bzl", "swift_test") swift_test( name = "tests", - srcs = [ "main.swift"], + srcs = [ "main.swift", "example.swift"], ) \ No newline at end of file diff --git a/swift/example.swift b/swift/example.swift new file mode 100644 index 00000000..f9face57 --- /dev/null +++ b/swift/example.swift @@ -0,0 +1,30 @@ +import XCTest + +class SwiftTests: XCTestCase { + func fizzbuzz(i: Int) -> String { + if (i % 3 == 0) { + if (i % 5 == 0) { + return "FizzBuzz"; + } + return "Fizz"; + } else if (i % 5 == 0) { + return "Buzz"; + } else { + return String(i); + } + } + + func test() { + XCTAssertEqual(fizzbuzz(i: 1), "1") + XCTAssertEqual(fizzbuzz(i: 2), "2") + XCTAssertEqual(fizzbuzz(i: 3), "Fizz") + XCTAssertEqual(fizzbuzz(i: 4), "4") + XCTAssertEqual(fizzbuzz(i: 5), "Buzz") + XCTAssertEqual(fizzbuzz(i: 15), "FizzBuzz") + print(fizzbuzz(i: 5)) + } + + static var allTests = [ + ("test", test), + ] +} diff --git a/swift/main.swift b/swift/main.swift index dec5fde6..ffa88ac8 100644 --- a/swift/main.swift +++ b/swift/main.swift @@ -1,34 +1,5 @@ import XCTest -class SwiftTests: XCTestCase { - func fizzbuzz(i: Int) -> String { - if (i % 3 == 0) { - if (i % 5 == 0) { - return "FizzBuzz"; - } - return "Fizz"; - } else if (i % 5 == 0) { - return "Buzz"; - } else { - return String(i); - } - } - - func test() { - XCTAssertEqual(fizzbuzz(i: 1), "1") - XCTAssertEqual(fizzbuzz(i: 2), "2") - XCTAssertEqual(fizzbuzz(i: 3), "Fizz") - XCTAssertEqual(fizzbuzz(i: 4), "4") - XCTAssertEqual(fizzbuzz(i: 5), "Buzz") - XCTAssertEqual(fizzbuzz(i: 15), "FizzBuzz") - print(fizzbuzz(i: 5)) - } - - static var allTests = [ - ("test", test), - ] -} - XCTMain([ testCase(SwiftTests.allTests), ]) \ No newline at end of file From ec35625e3dba9524f3a9a83cb61038a727627af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Mon, 26 Dec 2022 11:28:08 -0500 Subject: [PATCH 17/24] Adding env to build as presented in rules_swift example --- swift/BUILD | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/swift/BUILD b/swift/BUILD index a4f384f2..9f2a4cfc 100644 --- a/swift/BUILD +++ b/swift/BUILD @@ -3,4 +3,8 @@ load("@build_bazel_rules_swift//swift:swift.bzl", "swift_test") swift_test( name = "tests", srcs = [ "main.swift", "example.swift"], + env = { + "XCTEST_ENV_VAR": "TRUE", + "XCTEST_BINDIR_ENV_VAR": "$(BINDIR)", + }, ) \ No newline at end of file From f42573f2b1f7008ec5f96e4ee9fcfef02faf84a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Mon, 26 Dec 2022 11:37:52 -0500 Subject: [PATCH 18/24] Something missing in the CI machine? using swift for macos as well --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0423f053..06ddfc50 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,7 +59,6 @@ jobs: # run: bazel build //python/... - uses: swift-actions/setup-swift@v1 - if: matrix.os == 'ubuntu-20.04' - name: Building //swift directory run: | From 8eb9286970fba49b7938c6a44d9d0e9069026f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Mon, 26 Dec 2022 11:53:06 -0500 Subject: [PATCH 19/24] Trying macos-12 --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 06ddfc50..25ad4327 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, macos-11] + os: [ubuntu-20.04, macos-12] steps: - uses: actions/checkout@v3 @@ -59,6 +59,7 @@ jobs: # run: bazel build //python/... - uses: swift-actions/setup-swift@v1 + if: matrix.os == 'ubuntu-20.04' - name: Building //swift directory run: | From 3311737c76e81cef8d4b3bb3a0c5d4360ded0943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Mon, 26 Dec 2022 11:58:24 -0500 Subject: [PATCH 20/24] Following example --- swift/main.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/swift/main.swift b/swift/main.swift index ffa88ac8..2a4a87f5 100644 --- a/swift/main.swift +++ b/swift/main.swift @@ -1,5 +1,7 @@ +#if os(Linux) import XCTest XCTMain([ testCase(SwiftTests.allTests), -]) \ No newline at end of file +]) +#endif From 938e72c04b97feef2e5fafa9cce871c3c86e5ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Mon, 26 Dec 2022 12:04:06 -0500 Subject: [PATCH 21/24] Again macos-11 and removing env from BUILD --- .github/workflows/main.yml | 2 +- swift/BUILD | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 25ad4327..0423f053 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, macos-12] + os: [ubuntu-20.04, macos-11] steps: - uses: actions/checkout@v3 diff --git a/swift/BUILD b/swift/BUILD index 9f2a4cfc..a4f384f2 100644 --- a/swift/BUILD +++ b/swift/BUILD @@ -3,8 +3,4 @@ load("@build_bazel_rules_swift//swift:swift.bzl", "swift_test") swift_test( name = "tests", srcs = [ "main.swift", "example.swift"], - env = { - "XCTEST_ENV_VAR": "TRUE", - "XCTEST_BINDIR_ENV_VAR": "$(BINDIR)", - }, ) \ No newline at end of file From 2e70aaaa9ee684592f0b54f27ffffb4ee483cfae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Mon, 26 Dec 2022 12:51:12 -0500 Subject: [PATCH 22/24] Adding back other tests --- .github/workflows/main.yml | 70 +++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0423f053..04959cb3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,41 +22,41 @@ jobs: steps: - uses: actions/checkout@v3 -# - name: Building //cpp directory -# run: bazel build //cpp/... -# -# - name: Building //docker directory -# run: bazel build //docker/... -# -# - name: Building //genrules directory -# run: bazel build //genrules/... -# -# - name: Building //go directory -# run: bazel build //go/... -# -# - name: Building //java directory -# run: | -# bazel test //java/... -# -# - name: Building //kotlin directory -# run: bazel build //kotlin/... -# -# - name: Building //scala directory -# run: | -# bazel test //scala/... -# -# - name: Building //typescript directory -# run: | -# bazel test //typescript/... -# -# - name: Building //csharp directory -# run: bazel build //csharp/... -# -# - name: Building //perl directory -# run: bazel build //perl/... -# -# - name: Building //python directory -# run: bazel build //python/... + - name: Building //cpp directory + run: bazel build //cpp/... + + - name: Building //docker directory + run: bazel build //docker/... + + - name: Building //genrules directory + run: bazel build //genrules/... + + - name: Building //go directory + run: bazel build //go/... + + - name: Building //java directory + run: | + bazel test //java/... + + - name: Building //kotlin directory + run: bazel build //kotlin/... + + - name: Building //scala directory + run: | + bazel test //scala/... + + - name: Building //typescript directory + run: | + bazel test //typescript/... + + - name: Building //csharp directory + run: bazel build //csharp/... + + - name: Building //perl directory + run: bazel build //perl/... + + - name: Building //python directory + run: bazel build //python/... - uses: swift-actions/setup-swift@v1 if: matrix.os == 'ubuntu-20.04' From fb10dea9c21b0e6daf718065646db294221d4780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Tue, 27 Dec 2022 15:23:23 -0500 Subject: [PATCH 23/24] Small changed from Ola's comments --- .github/workflows/main.yml | 2 +- swift/.bazelrc | 2 +- swift/example.swift | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 04959cb3..cbb78196 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -64,4 +64,4 @@ jobs: - name: Building //swift directory run: | cd swift - bazel test --config=clang //... --test_output=all + bazel test --config=clang //... diff --git a/swift/.bazelrc b/swift/.bazelrc index 9e47f2f5..03d86a2b 100644 --- a/swift/.bazelrc +++ b/swift/.bazelrc @@ -1 +1 @@ -build:clang --client_env=CC=clang \ No newline at end of file +build:clang --client_env=CC=clang diff --git a/swift/example.swift b/swift/example.swift index f9face57..a5537266 100644 --- a/swift/example.swift +++ b/swift/example.swift @@ -7,11 +7,11 @@ class SwiftTests: XCTestCase { return "FizzBuzz"; } return "Fizz"; - } else if (i % 5 == 0) { + } + if (i % 5 == 0) { return "Buzz"; - } else { - return String(i); } + return String(i); } func test() { @@ -21,7 +21,6 @@ class SwiftTests: XCTestCase { XCTAssertEqual(fizzbuzz(i: 4), "4") XCTAssertEqual(fizzbuzz(i: 5), "Buzz") XCTAssertEqual(fizzbuzz(i: 15), "FizzBuzz") - print(fizzbuzz(i: 5)) } static var allTests = [ From 531bcd467f8a9066faf79c61b3237f69bb58f4a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Tue, 27 Dec 2022 18:47:07 -0500 Subject: [PATCH 24/24] Added new line to BUILD file --- swift/BUILD | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/swift/BUILD b/swift/BUILD index a4f384f2..1b91faa8 100644 --- a/swift/BUILD +++ b/swift/BUILD @@ -2,5 +2,8 @@ load("@build_bazel_rules_swift//swift:swift.bzl", "swift_test") swift_test( name = "tests", - srcs = [ "main.swift", "example.swift"], -) \ No newline at end of file + srcs = [ + "example.swift", + "main.swift", + ], +)