Skip to content

Commit

Permalink
workflows refactoring (via #64)
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Eroshenko authored Sep 20, 2021
1 parent b6ccd62 commit e956a15
Show file tree
Hide file tree
Showing 42 changed files with 320 additions and 281 deletions.
25 changes: 25 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name-template: '$NEXT_MINOR_VERSION'
tag-template: '$NEXT_MINOR_VERSION'
categories:
- title: '🚀 New Features'
labels:
- 'type:new feature'
- title: '🔬 Improvements'
labels:
- 'type:improvement'
- title: '🐞 Bug Fixes'
labels:
- 'type:bug'
- title: '⬆️ Dependency Updates'
labels:
- 'type:dependencies'

change-template: '* $TITLE (via #$NUMBER) - @$AUTHOR'
exclude-labels:
- 'type:internal'
template: |
$CHANGES
## 👀 Links
[Commits since $PREVIOUS_TAG](https://github.com/allure-framework/allure-java/compare/$PREVIOUS_TAG...master)
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build

on:
workflow_dispatch:
pull_request:
branches:
- '*'
push:
branches:
- 'master'

jobs:
build:
name: 'Tests (JDK ${{ matrix.jdk }}, ${{ matrix.os }})'
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu', 'windows' ]
java-version: [ '8.0.x', '11.0.x' ]
steps:
- uses: actions/checkout@v2

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}

- name: Build
run: ./gradlew build
14 changes: 14 additions & 0 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Release Draft

on:
push:
branches:
- master

jobs:
update_draft_release:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 0 additions & 10 deletions .github/workflows/gradle-wrapper-validation.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/main.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build

on:
release:
types: [published]

jobs:
release:
name: 'Release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11.0.x'
- name: Build Plugins
run: ./gradlew build -Pversion=${GITHUB_REF:10}
- name: Copy gradle.properties
run: echo ${GRADLE_PUBLISH} > ~/.gradle/gradle.properties
- name: Publish Plugins
run: ./gradlew publishPlugins -Pversion=${GITHUB_REF:10}
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Gradle projects plugins for building [Allure](https://docs.qameta.io/allure/late

## Basic usage

`allure-gradle` plugin implements Allure data gathering (e.g. Test` tasks), and data reporting (both individual and aggregate reports).
`allure-gradle` plugin implements Allure data collecting (e.g. Test` tasks), and data reporting (both individual and aggregate reports).

Data gathering and reporting are split to different Gradle plugins, so you could apply the ones you need.
Data colecting and reporting are split to different Gradle plugins, so you could apply the ones you need.

Note: 2.9+ requires Gradle 5.0+

The minimal configuration is as follows.
It would configure test tasks to gather Allure results and add `allureReport` and `allureServe`
It would configure test tasks to collect Allure results and add `allureReport` and `allureServe`
tasks for report inspection.

Groovy DSL:
Expand Down Expand Up @@ -46,7 +46,7 @@ repositories {
}
```

`io.qameta.allure` is a shortcut for `io.qameta.allure-gather` + `io.qameta.allure-report`,
`io.qameta.allure` is a shortcut for `io.qameta.allure-adapter` + `io.qameta.allure-report`,
so you could apply the plugins you need.

### Configuring Allure version
Expand Down Expand Up @@ -86,19 +86,19 @@ use the following command:
If you need a report only, please use `allureReport` and `allureAggregateReport`.

By default, `allureAggregate*` aggregates data from the current `project` and its `subprojects`.
However, you need to apply `io.qameta.allure-gather` plugin to the relevant subprojects, so they
However, you need to apply `io.qameta.allure-adapter` plugin to the relevant subprojects, so they
provide Allure results.

## Customizing data gathering
## Customizing data collecting

Data gathering is implemented via `io.qameta.allure-gather` Gradle plugin.
Data collecting is implemented via `io.qameta.allure-adapter` Gradle plugin.

The values in the sample below are the defaults.
The sample uses Kotlin DSL. In Groovy DSL you could use `allureJavaVersion = "2.13.9"`, however, that is the only difference.

```kotlin
allure {
gather {
adapter {
// Configure version for io.qameta.allure:allure-* adapters
allureJavaVersion.set("2.13.9")
aspectjVersion.set("1.9.5")
Expand All @@ -110,7 +110,7 @@ allure {
// By default, categories.json is detected in src/test/resources/../categories.json,
// However, it would be better to put the file in a well-known location and configure it explicitly
categoriesFile.set(layout.projectDirectory.file("config/allure/categories.json"))
adapters {
frameworks {
junit5 {
// Defaults to allureJavaVersion
adapterVersion.set("...")
Expand Down Expand Up @@ -140,15 +140,15 @@ allure {
### What if I have both JUnit5, JUnit4, and CucumberJVM on the classpath?

By default, `allure-gradle` would detect all of them and apply all the listeners yielding 3 reports.
If you need only one or two, specify the required ones via `adapters {...}` block.
If you need only one or two, specify the required ones via `frameworks {...}` block.

### Adding custom results for reporting

You could add a folder with custom results via `allureRawResultElements` Gradle configuration.

```kotlin
plugins {
id("io.qameta.allure-gather-base")
id("io.qameta.allure-adapter-base")
}

dependencies {
Expand All @@ -172,15 +172,15 @@ However, you might want to disable them and use your own ones.
Here's how you disable default listeners:

```kotlin
allure.gather.adapters.junit5.autoconfigureListeners.set(false)
allure.adapter.frameworks.junit5.autoconfigureListeners.set(false)
```

An alternative syntax is as follows:

```kotlin
allure {
gather {
adapters {
adapter {
frameworks {
// Note: every time you mention an adapter, it is added to the classpath,
// so refrain from mentioning unused adapters here
junit5 {
Expand All @@ -201,18 +201,18 @@ allure {
### Aggregating results from multiple projects

Suppose you have a couple of modules `/module1/build.gradle.kts`,
`/module2/build.gradle.kts` that gather raw results for Allure:
`/module2/build.gradle.kts` that collect raw results for Allure:

```kotlin
// Each submodule
plugin {
`java-library`
id("io.qameta.allure-gather")
id("io.qameta.allure-adapter")
}

allure {
gather {
adapters {
adapter {
frameworks {
junit5
}
}
Expand Down Expand Up @@ -388,32 +388,32 @@ Extensions:

`allure` extension for `project`

### io.qameta.allure-gather-base plugin
### io.qameta.allure-adapter-base plugin

Extensions:
* io.qameta.allure.gradle.gather.AllureGatherExtension
* io.qameta.allure.gradle.adapter.AllureAdapterExtension

`gather` extension for `allure`
`adapter` extension for `allure`

Configurations:
* `allureRawResultElements`

A consumable configuration that exposes the gathered raw data for building the report
A consumable configuration that exposes the collect raw data for building the report

Tasks:
* `copyCategories: io.qameta.allure.gradle.gather.tasks.CopyCategories`
* `copyCategories: io.qameta.allure.gradle.adapter.tasks.CopyCategories`

Copies `categories.json` to the raw results folders.
See https://github.com/allure-framework/allure2/issues/1236

### io.qameta.allure-gather plugin
### io.qameta.allure-adapter plugin

Configures automatic gathering of raw data from test tasks, adds `allure-java` adapters to the classpath.
Configures automatic collectint of raw data from test tasks, adds `allure-java` adapters to the classpath.

Configurations:
* `allureAspectjWeaverAgent`

A configuration to declare AspectJ agent jar for data gathering
A configuration to declare AspectJ agent jar for data collecting

### io.qameta.allure-download plugin

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id("allure-gradle.kotlin-dsl-published-plugin")
}

group = "io.qameta.allure.gradle.gather"
group = "io.qameta.allure.gradle.adapter"

dependencies {
implementation(project(":allure-base-plugin"))
Expand All @@ -17,15 +17,15 @@ tasks.test {

gradlePlugin {
plugins {
create("allureCollectBasePlugin") {
id = "io.qameta.allure-gather-base"
create("allureAdapterBasePlugin") {
id = "io.qameta.allure-adapter-base"
description = "Declares common configurations for producing and consuming Allure results and reports"
implementationClass = "io.qameta.allure.gradle.gather.AllureGatherBasePlugin"
implementationClass = "io.qameta.allure.gradle.adapter.AllureAdapterBasePlugin"
}
create("allureCollectPlugin") {
id = "io.qameta.allure-gather"
description = "Implements autoconfiguration for gathering data for Allure"
implementationClass = "io.qameta.allure.gradle.gather.AllureGatherPlugin"
create("allureAdapterPlugin") {
id = "io.qameta.allure-adapter"
description = "Implements autoconfiguration for collecting data for Allure"
implementationClass = "io.qameta.allure.gradle.adapter.AllureAdapterPlugin"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("java")
id("io.qameta.allure-gather")
id("io.qameta.allure-adapter")
}

repositories {
Expand All @@ -11,7 +11,7 @@ tasks.register("printAdapters") {
doLast {
buildDir.mkdirs()
file("$buildDir/printAdapters.txt").write(
allure.gather.adapters.toList().collect { it.toString() }.sort().toString()
allure.adapter.frameworks.toList().collect { it.toString() }.sort().toString()
)
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
plugins {
id("io.qameta.allure-gather")
id("io.qameta.allure-adapter")
}

repositories {
mavenCentral()
}

allure {
gather {
adapters {
adapter {
frameworks {
junit5 {
adapterVersion.set("42.0")
}
Expand All @@ -21,7 +21,7 @@ val printAdapters by tasks.registering {
doLast {
buildDir.mkdirs()
file("$buildDir/printAdapters.txt").writeText(
allure.gather.adapters.toList().map { it.toString() }.sorted().toString()
allure.adapter.frameworks.toList().map { it.toString() }.sorted().toString()
)
}
}
Loading

0 comments on commit e956a15

Please sign in to comment.