bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.23k stars 4.07k forks source link

[Mirror] #19571

Closed ken4ward closed 1 year ago

ken4ward commented 1 year ago

Please list the URLs of the archives you'd like to mirror:

I have a test project, it is configured with maven and TestNG, it works perfectly fine with it. I want to use Bazel to run the same project. I have created WORKSPACE and BUILD files for each directory, which builds perfectly fine. I want to run the test using the 'testng_regressions.xml' in this direcotry: src/test/resources/testrunners/testng_regressions.xml

This is the BUILD file for 'testng_regressions.xml',

load("@rules_java//java:defs.bzl", "java_test")

java_library(
    name = "main_project_files",
    srcs = glob(['src/main/java/**/*.java']),
    runtime_deps = [
        "//Web/src/main/java/io/package/com/constants:app_constants",
        "//Web/src/main/java/io/package/com/factory:playwright_factory",
        "//Web/src/main/java/io/package/com/listeners:extent_report_listener",
        "//Web/src/main/java/io/package/com/pages:login_page",
        "//Web/src/main/java/io/package/com/steps:login_steps",
    ],
)

java_library(
    name = "test_project_files",
    srcs = glob(['src/test/java/**/*.java']),
    runtime_deps = [":main_project_files",
            "//Web/src/test/java/io/package/com/base:base_test",
            "//Web/src/test/java/io/package/com/tests:project_test_files"],
)
#
java_test(
    name = "testng_regressions",
    size = "small",
    timeout = "short",
    tags = ["regression"],
    runtime_deps = [
        ":main_project_files",
        ":test_project_files"
    ],
    use_testrunner = False,
    main_class='org.testng.TestNG',
    args=['-testjar','libtest_project_files.jar','-verbose','2'],
)

This is the content of the testNG file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Open Cart Test Regression PW Suite" thread-count="5"
       parallel="tests" verbose="4">
    <listeners>
        <listener class-name="io.christdoes.com.listeners.ExtentReportListener" />
    </listeners>
    <test name="Open Cart Home Page Test_chrome">
        <parameter name="browser" value="chrome" />
        <parameter name="language" value="en" />
        <classes>
            <class name="io.christdoes.com.tests.HomePageTest" />
        </classes>
    </test>
    <test name="Open Cart Login Page Test_safari">
        <parameter name="browser" value="safari" />
        <parameter name="language" value="nl" />
        <classes>
            <class name="io.christdoes.com.tests.HomePageTest" />
        </classes>
    </test>
</suite>

When I run the test, it always give a non-detailed error

FAIL: //Web/src/test/resources/testrunners:testng_regressions (see /private/var/tmp/_bazel_christdoes/44565daf5d57f20e3e02fd7160ffadab/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/Web/src/test/resources/testrunners/testng_regressions/test.log)
INFO: Elapsed time: 91.557s, Critical Path: 31.65s
INFO: 17 processes: 3 internal, 6 darwin-sandbox, 8 worker.
INFO: Build completed, 1 test FAILED, 17 total actions
//Web/src/test/resources/testrunners:testng_regressions                  FAILED in 2.1s
  /private/var/tmp/_bazel_user/44565daf5d57f20e3e02fd7160ffadab/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/Web/src/test/resources/testrunners/testng_regressions/test.log

Executed 1 out of 1 test: 1 fails locally.

Pavank1992 commented 1 year ago

Hi @ken4ward, Could you please list the URLs of the archives you'd like to mirror? Sample : https://github.com/bazelbuild/bazel/issues/19566

ken4ward commented 1 year ago

Thanks @Pavank1992 , this is my WORKSPACE.

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_xcodeproj",
    sha256 = "bc8b1ae066b7333a151fd3a9ebee0d51d7779886bfb8cf9fc6e0f9d6c110fc83",
    url = "https://github.com/MobileNativeFoundation/rules_xcodeproj/releases/download/1.10.1/release.tar.gz",
)

load(
    "@rules_xcodeproj//xcodeproj:repositories.bzl",
    "xcodeproj_rules_dependencies",
)

xcodeproj_rules_dependencies()

load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

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()

load(
    "@build_bazel_apple_support//lib:repositories.bzl",
    "apple_support_dependencies",
)

apple_support_dependencies()

#Java
RULES_JVM_EXTERNAL_TAG = "5.3"
RULES_JVM_EXTERNAL_SHA ="d31e369b854322ca5098ea12c69d7175ded971435e55c18dd9dd5f29cc5249ac"

http_archive(
    name = "rules_jvm_external",
    strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
    sha256 = RULES_JVM_EXTERNAL_SHA,
    url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (RULES_JVM_EXTERNAL_TAG, RULES_JVM_EXTERNAL_TAG)
)

load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")

rules_jvm_external_deps()

load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")

rules_jvm_external_setup()

load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
    artifacts = [
        "com.microsoft.playwright:playwright:1.36.0",
        "org.testng:testng:7.8.0",
        "io.qameta.allure:allure-testng:2.23.0",
        "io.cucumber:cucumber-java:7.13.0",
        "io.cucumber:cucumber-core:7.13.0",
        "io.cucumber:cucumber-picocontainer:7.13.0",
        "io.cucumber:cucumber-testng:7.13.0",
        "io.cucumber:cucumber-jvm:7.13.0",
        "org.projectlombok:lombok:1.18.28",
        "org.apache.logging.log4j:log4j-core:3.0.0-alpha1",
        "org.apache.logging.log4j:log4j-api:3.0.0-alpha1",
        "com.aventstack:extentreports:5.0.8",
        "com.google.code.gson:gson:2.10.1",
        "org.apache.commons:commons-io:1.3.2",
    ],
    repositories = [
        "https://maven.google.com",
        "https://repo1.maven.org/maven2",
    ],
    maven_install_json = "//:maven_install.json",
)

load("@maven//:defs.bzl", "pinned_maven_install")
pinned_maven_install()
Pavank1992 commented 1 year ago

Please find the mirror artifact below: https://mirror.bazel.build/github.com/MobileNativeFoundation/rules_xcodeproj/releases/download/1.10.1/release.tar.gz

For URL : https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz I am getting bad request, could you please recheck the url.

ken4ward commented 1 year ago

I only copy and pasted from the repo. The latest update to the rules_jvm_external - https://github.com/bazelbuild/rules_jvm_external/releases/tag/5.3

The mirror is okay. It's only parameterised, and the needed variables are appended. If reconstructed removing the variables, it'll return this

http_archive(
    name = "rules_jvm_external",
    strip_prefix = "rules_jvm_external-5.3",
    sha256 = "d31e369b854322ca5098ea12c69d7175ded971435e55c18dd9dd5f29cc5249ac",
    url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/5.3/rules_jvm_external-5.3.tar.gz"
)

If the url is clicked, it'll automatically download the archive. https://github.com/bazelbuild/rules_jvm_external/releases/download/5.3/rules_jvm_external-5.3.tar.gz I really do not know what is making it return the error.

Pavank1992 commented 1 year ago

Thanks, please find the mirror artifact below

https://mirror.bazel.build/github.com/bazelbuild/rules_jvm_external/releases/download/5.3/rules_jvm_external-5.3.tar.gz