@Test void it_detects_github_actions() { HashMap<String, String> env = new HashMap<String, String>() {{ put("GITHUB_SERVER_URL", "https: put("GITHUB_REPOSITORY", "cucumber/cucumber-ruby"); put("GITHUB_RUN_ID", "140170388"); put("GITHUB_SHA", "the-revision"); put("GITHUB_REF", "refs/tags/the-tag"); }}; Messages.Meta meta = CreateMeta.createMeta("cucumber-jvm", "3.2.1", env); assertEquals(Messages.Meta.CI.newBuilder() .setName("GitHub Actions") .setUrl("https: .setGit(Messages.Meta.CI.Git.newBuilder() .setRemote("https: .setRevision("the-revision") .setTag("the-tag") ) .build(), meta.getCi()); }
public static Messages.Meta createMeta( String toolName, String toolVersion, Map<String, String> env ) { Messages.Meta.Builder metaBuilder = Messages.Meta.newBuilder() .setRuntime(Messages.Meta.Product.newBuilder() .setName(System.getProperty("java.vm.name")) .setVersion(System.getProperty("java.vm.version"))) .setImplementation(Messages.Meta.Product.newBuilder() .setName(toolName) .setVersion(toolVersion)) .setOs(Messages.Meta.Product.newBuilder() .setName(System.getProperty("os.name"))) .setCpu(Messages.Meta.Product.newBuilder() .setName(System.getProperty("os.arch"))); ProtocolVersion.getVersion() .ifPresent(metaBuilder::setProtocolVersion); Messages.Meta.CI ci = detectCI(env); if (ci != null) { metaBuilder.setCi(ci); } return metaBuilder .build(); }
CreateMeta { public static Messages.Meta createMeta( String toolName, String toolVersion, Map<String, String> env ) { Messages.Meta.Builder metaBuilder = Messages.Meta.newBuilder() .setRuntime(Messages.Meta.Product.newBuilder() .setName(System.getProperty("java.vm.name")) .setVersion(System.getProperty("java.vm.version"))) .setImplementation(Messages.Meta.Product.newBuilder() .setName(toolName) .setVersion(toolVersion)) .setOs(Messages.Meta.Product.newBuilder() .setName(System.getProperty("os.name"))) .setCpu(Messages.Meta.Product.newBuilder() .setName(System.getProperty("os.arch"))); ProtocolVersion.getVersion() .ifPresent(metaBuilder::setProtocolVersion); Messages.Meta.CI ci = detectCI(env); if (ci != null) { metaBuilder.setCi(ci); } return metaBuilder .build(); } }
CreateMeta { public static Messages.Meta createMeta( String toolName, String toolVersion, Map<String, String> env ) { Messages.Meta.Builder metaBuilder = Messages.Meta.newBuilder() .setRuntime(Messages.Meta.Product.newBuilder() .setName(System.getProperty("java.vm.name")) .setVersion(System.getProperty("java.vm.version"))) .setImplementation(Messages.Meta.Product.newBuilder() .setName(toolName) .setVersion(toolVersion)) .setOs(Messages.Meta.Product.newBuilder() .setName(System.getProperty("os.name"))) .setCpu(Messages.Meta.Product.newBuilder() .setName(System.getProperty("os.arch"))); ProtocolVersion.getVersion() .ifPresent(metaBuilder::setProtocolVersion); Messages.Meta.CI ci = detectCI(env); if (ci != null) { metaBuilder.setCi(ci); } return metaBuilder .build(); }  }
CreateMeta { public static Messages.Meta createMeta( String toolName, String toolVersion, Map<String, String> env ) { Messages.Meta.Builder metaBuilder = Messages.Meta.newBuilder() .setRuntime(Messages.Meta.Product.newBuilder() .setName(System.getProperty("java.vm.name")) .setVersion(System.getProperty("java.vm.version"))) .setImplementation(Messages.Meta.Product.newBuilder() .setName(toolName) .setVersion(toolVersion)) .setOs(Messages.Meta.Product.newBuilder() .setName(System.getProperty("os.name"))) .setCpu(Messages.Meta.Product.newBuilder() .setName(System.getProperty("os.arch"))); ProtocolVersion.getVersion() .ifPresent(metaBuilder::setProtocolVersion); Messages.Meta.CI ci = detectCI(env); if (ci != null) { metaBuilder.setCi(ci); } return metaBuilder .build(); }  static Messages.Meta createMeta(
            String toolName,
            String toolVersion,
            Map<String, String> env
    ); static String removeUserInfoFromUrl(String value); }
CreateMeta { public static Messages.Meta createMeta( String toolName, String toolVersion, Map<String, String> env ) { Messages.Meta.Builder metaBuilder = Messages.Meta.newBuilder() .setRuntime(Messages.Meta.Product.newBuilder() .setName(System.getProperty("java.vm.name")) .setVersion(System.getProperty("java.vm.version"))) .setImplementation(Messages.Meta.Product.newBuilder() .setName(toolName) .setVersion(toolVersion)) .setOs(Messages.Meta.Product.newBuilder() .setName(System.getProperty("os.name"))) .setCpu(Messages.Meta.Product.newBuilder() .setName(System.getProperty("os.arch"))); ProtocolVersion.getVersion() .ifPresent(metaBuilder::setProtocolVersion); Messages.Meta.CI ci = detectCI(env); if (ci != null) { metaBuilder.setCi(ci); } return metaBuilder .build(); }  static Messages.Meta createMeta(
            String toolName,
            String toolVersion,
            Map<String, String> env
    ); static String removeUserInfoFromUrl(String value);  }