Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
lararojasmr authored Oct 22, 2023
2 parents 780ee49 + 6a6dd09 commit 6f73031
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 69 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@ jobs:
distribution: 'zulu'
java-version: '8'
cache: 'maven'
- run: echo "::set-output name=name::${GITHUB_REF:10}"
id: version
- name: Update Version
run: ./mvnw versions:set -DnewVersion=${{ steps.version.outputs.name }}
- name: Build Package
run: ./mvnw package
- name: Upload Package
uses: actions/upload-release-asset@v1
- run: echo "VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- run: ./mvnw versions:set -DnewVersion=${{ env.VERSION }}
- run: ./mvnw package
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./target/allure-bamboo-${{ steps.version.outputs.name }}.jar
asset_name: allure-bamboo-${{ steps.version.outputs.name }}.jar
asset_path: ./target/allure-bamboo-${{ env.VERSION }}.jar
asset_name: allure-bamboo-${{ env.VERSION }}.jar
asset_content_type: application/octet-stream
41 changes: 9 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-bamboo</artifactId>
<version>1.16.0-SNAPSHOT</version>
<version>1.17.0-SNAPSHOT</version>
<name>Allure for Bamboo</name>
<description>Allure reports right in deployment plans in Bamboo</description>
<packaging>atlassian-plugin</packaging>
Expand All @@ -16,13 +16,13 @@
</organization>
<properties>
<spotless.version>2.2.0</spotless.version>
<amps.version>8.1.1</amps.version>
<bamboo.version>8.1.1</bamboo.version>
<amps.version>8.11.4</amps.version>
<bamboo.version>9.0.4</bamboo.version>
<bamboo.data.version>${bamboo.version}</bamboo.data.version>
<plugin.testrunner.version>2.0.2</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<slf4j.version>1.7.36</slf4j.version>
<slf4j.version>2.0.9</slf4j.version>
<compiler.version>1.8</compiler.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down Expand Up @@ -50,13 +50,12 @@
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.14.2</version>
<version>2.15.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.14.2</version>
<scope>provided</scope>
<version>2.15.3</version>
</dependency>
<dependency>
<groupId>com.atlassian.bamboo</groupId>
Expand Down Expand Up @@ -121,7 +120,7 @@
<dependency>
<groupId>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<version>1.0.5</version>
<version>5.0.4</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -360,7 +359,7 @@
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.7.3.3</version>
<version>4.7.3.6</version>
<configuration>
<includeFilterFile>.mvn/quality-configs/spotbugs/include.xml</includeFilterFile>
<excludeFilterFile>.mvn/quality-configs/spotbugs/exclude.xml</excludeFilterFile>
Expand All @@ -376,28 +375,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>8.2.1</version>
<configuration>
<skipProvidedScope>true</skipProvidedScope>
<suppressionFiles>
<suppressionFile>
https://dcapt-downloads.s3.amazonaws.com/atlassian-security-scanner-dc-apps-suppressions.xml
</suppressionFile>
</suppressionFiles>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>bamboo-maven-plugin</artifactId>
Expand All @@ -414,7 +391,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.11.0</version>
<configuration>
<source>${compiler.version}</source>
<target>${compiler.version}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

import static io.qameta.allure.bamboo.AllureExecutableProvider.DEFAULT_VERSION;
import static io.qameta.allure.bamboo.AllureExecutableProvider.getAllureSubDir;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -95,28 +93,6 @@ public void itShouldProvideTheGivenVersionWithMilestone() throws Exception {
verify(downloader).downloadAndExtractAllureTo(binaryDir, "2.0-BETA4");
}

@Test
public void itShouldProvideExecutableForUnix() throws Exception {
when(cmdLine.hasCommand(allureCmdPath.toString())).thenReturn(true);
when(cmdLine.isWindows()).thenReturn(false);

final Optional<AllureExecutable> res = provide("Allure 2.0-BETA5");

assertThat(res.isPresent(), equalTo(true));
assertThat(res.get().getCmdPath(), equalTo(allureCmdPath));
}

@Test
public void itShouldProvideExecutableForWindows() throws Exception {
when(cmdLine.hasCommand(allureBatCmdPath.toString())).thenReturn(true);
when(cmdLine.isWindows()).thenReturn(true);

final Optional<AllureExecutable> res = provide(ALLURE_2_0_0);

assertThat(res.isPresent(), equalTo(true));
assertThat(res.get().getCmdPath(), equalTo(allureBatCmdPath));
}

private Optional<AllureExecutable> provide(String executableName) {
when(executablesManager.getExecutableByName(executableName)).thenReturn(Optional.of(homeDir));
return provider.provide(config, executableName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import static com.google.common.io.Files.createTempDir;
import static java.util.Collections.singleton;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.junit.MockitoJUnit.rule;
Expand All @@ -53,8 +52,6 @@ public void setUp() throws Exception {
executable = new AllureExecutable(path, cmdLine);
fromDir = createTempDir().toPath();
toDir = createTempDir().toPath();
when(cmdLine.parseGenerateOutput(anyString()))
.thenReturn(new AllureGenerateResult("", true));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Copyright 2016-2023 Qameta Software OÜ
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.qameta.allure.bamboo;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoRule;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;

import static io.qameta.allure.bamboo.AllureExecutableProvider.getAllureSubDir;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.when;
import static org.mockito.junit.MockitoJUnit.rule;

public class SecondAllureExecutableProviderTest {

private static final String ALLURE_2_0_0 = "Allure 2.0.0";
private static final String EXECUTABLE_NAME_2_0_0 = "2.0.0";
private static final String BIN = "bin";
private final String homeDir = "/home/allure";
private final String binaryDir = Paths.get(this.homeDir, getAllureSubDir()).toString();

@Rule
public MockitoRule mockitoRule = rule();
@Mock
private BambooExecutablesManager executablesManager;
@Mock
private AllureDownloader downloader;
@Mock
private AllureCommandLineSupport cmdLine;
@InjectMocks
private AllureExecutableProvider provider;
private AllureGlobalConfig config;
private Path allureCmdPath;
private Path allureBatCmdPath;

@Before
public void setUp() throws Exception {
config = new AllureGlobalConfig();
allureCmdPath = Paths.get(binaryDir, BIN, "allure");
allureBatCmdPath = Paths.get(binaryDir, BIN, "allure.bat");
}

@Test
public void itShouldProvideExecutableForUnix() throws Exception {
when(cmdLine.hasCommand(allureCmdPath.toString())).thenReturn(true);
when(cmdLine.isWindows()).thenReturn(false);

final Optional<AllureExecutable> res = provide("Allure 2.0-BETA5");

assertThat(res.isPresent(), equalTo(true));
assertThat(res.get().getCmdPath(), equalTo(allureCmdPath));
}

@Test
public void itShouldProvideExecutableForWindows() throws Exception {
when(cmdLine.hasCommand(allureBatCmdPath.toString())).thenReturn(true);
when(cmdLine.isWindows()).thenReturn(true);

final Optional<AllureExecutable> res = provide(ALLURE_2_0_0);

assertThat(res.isPresent(), equalTo(true));
assertThat(res.get().getCmdPath(), equalTo(allureBatCmdPath));
}

private Optional<AllureExecutable> provide(String executableName) {
when(executablesManager.getExecutableByName(executableName)).thenReturn(Optional.of(homeDir));
return provider.provide(config, executableName);
}
}

0 comments on commit 6f73031

Please sign in to comment.