diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..94ddb90 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..10f29d1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: Build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Java + uses: actions/setup-java@v1 + with: + java-version: 8 + + - name: Build and test + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} + run: ./mvnw -B clean verify sonar:sonar -Dsonar.login=${{ secrets.SONAR_TOKEN }} + - run: mkdir staging && cp target/*.zip staging + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: Connectors + path: staging diff --git a/.github/workflows/commit-message-check.yml b/.github/workflows/commit-message-check.yml new file mode 100644 index 0000000..148fd99 --- /dev/null +++ b/.github/workflows/commit-message-check.yml @@ -0,0 +1,19 @@ +name: 'Commit Message Check' +on: + pull_request: + types: + - opened + - edited + - reopened + - synchronize +jobs: + check-commit-message: + name: Check Commit Message + runs-on: ubuntu-latest + steps: + - name: Check Commit Type + uses: gsactions/commit-message-checker@v1 + with: + pattern: '^\S+\((.+)\):\s(.+)$' + flags: 'gm' + error: 'Your first line has to matches the following pattern: type(category): description [flags], where flags is an optional coma separated list. Check the contributing guidlines for more details.' diff --git a/.github/workflows/createRelease.yml b/.github/workflows/createRelease.yml new file mode 100644 index 0000000..a292716 --- /dev/null +++ b/.github/workflows/createRelease.yml @@ -0,0 +1,65 @@ +name: Create release + +on: + push: + branches: + - release-* + +jobs: + build: + name: Release pipeline + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Java + uses: actions/setup-java@v1 + with: + java-version: 8 + + - name: Extract version + shell: bash + run: echo "##[set-output name=version;]$(echo ${GITHUB_REF#refs/heads/} | sed 's/release-//g')" + id: extract_version + + - name: changelog + uses: scottbrenner/generate-changelog-action@master + id: Changelog + env: + REPO: ${{ github.repository }} + + - name: Create Release + id: create_release + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ steps.extract_version.outputs.version }} + release_name: Release ${{ steps.extract_version.outputs.version }} + body: | + ${{ steps.Changelog.outputs.changelog }} + draft: false + prerelease: false + + - name: Release Connector + uses: samuelmeuli/action-maven-publish@v1 + with: + gpg_private_key: ${{ secrets.gpg_private_key }} + gpg_passphrase: ${{ secrets.gpg_passphrase }} + nexus_username: ${{ secrets.ossrh_username }} + nexus_password: ${{ secrets.ossrh_password }} + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: target/bonita-connector-twitter-${{ steps.extract_version.outputs.version }}-all.zip + asset_name: bonita-connector-twitter-${{ steps.extract_version.outputs.version }}-all.zip + asset_content_type: application/zip + \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 705bde6..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,22 +0,0 @@ -timestamps { - ansiColor('xterm') { - node { - stage('Setup') { - checkout scm - } - - stage('Build') { - try { - if(env.BRANCH_NAME.equals('master')){ - sh "./mvnw -B clean deploy -DaltDeploymentRepository=${env.ALT_DEPLOYMENT_REPOSITORY_SNAPSHOTS} -Djvm=${env.JAVA_HOME_11}/bin/java" - }else{ - sh "./mvnw -B clean verify -Djvm=${env.JAVA_HOME_11}/bin/java" - } - archiveArtifacts 'target/bonita-connector-twitter-*.zip' - } finally { - junit '**/target/*-reports/*.xml' - } - } - } - } -} \ No newline at end of file diff --git a/README.md b/README.md index 9033372..55d981c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,26 @@ -bonita-connector-twitter -======================== -Twitter connector. +# Twitter Connector -Please use development branch +[![Actions Status](https://github.com/bonitasoft/bonita-connector-twitter/workflows/Build/badge.svg)](https://github.com/bonitasoft/bonita-connector-twitter/actions?query=workflow%3ABuild) +[![Sonarcloud Status](https://sonarcloud.io/api/project_badges/measure?project=bonitasoft_bonita-connector-twitter&metric=alert_status)](https://sonarcloud.io/dashboard?id=bonitasoft_bonita-connector-twitter) +[![GitHub release](https://img.shields.io/github/v/release/bonitasoft/bonita-connector-twitter?color=blue&label=Release)](https://github.com/bonitasoft/bonita-connector-twitter/releases) +[![Maven Central](https://img.shields.io/maven-central/v/org.bonitasoft.connectors/bonita-connector-twitter.svg?label=Maven%20Central&color=orange)](https://search.maven.org/search?q=g:%22org.bonitasoft.connectors%22%20AND%20a:%22bonita-connector-twitter%22) +[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-yellow.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) + +## Build + +__Clone__ or __fork__ this repository, then at the root of the project run: + +`./mvnw` + +## Release + +In order to create a new release push a `release-` branch with the desired version in pom.xml. +Update the `master` with the next SNAPSHOT version. + +## Contributing + +We would love you to contribute, pull requests are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) for more information. + +## License + +The sources and documentation in this project are released under the [GPLv2 License](LICENSE) diff --git a/infrastructure/release.groovy b/infrastructure/release.groovy deleted file mode 100644 index dc52589..0000000 --- a/infrastructure/release.groovy +++ /dev/null @@ -1,18 +0,0 @@ -timestamps { - node { - stage('Setup') { - checkout scm - } - - stage('Release') { - withCredentials([usernamePassword( - credentialsId: 'github', - passwordVariable: 'GIT_PASSWORD', - usernameVariable: 'GIT_USERNAME')]) { - sh """ - ./mvnw -B release:prepare release:perform -Darguments="-DaltDeploymentRepository=${env.ALT_DEPLOYMENT_REPOSITORY_TAG} -Djvm=${env.JAVA_HOME_11}/bin/java" - """ - } - } - } -} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..9620126 --- /dev/null +++ b/package.json @@ -0,0 +1,4 @@ +{ + "name": "bonita-connector-twitter", + "version": "1.2.1" +} diff --git a/pom.xml b/pom.xml index 1f80d9b..84b8392 100644 --- a/pom.xml +++ b/pom.xml @@ -2,123 +2,328 @@ 4.0.0 - - bonita-connectors - org.bonitasoft.connectors - 1.0.0 - - + org.bonitasoft.connectors bonita-connector-twitter 1.2.1-SNAPSHOT + + Bonita Twitter Connector + Connector to interact with Twitter API's from Bonita + https://www.bonitasoft.com + + + + bonitasoft + Bonitasoft + rd.user@bonitasoft.com + Bonitasoft + https://www.bonitasoft.com + + + + + + GPL-v2.0 + http://www.gnu.org/licenses/gpl-2.0.txt + + - 6.3.2 + + 1.8 + UTF-8 + UTF-8 + yyyy.MM.dd-hh.mm + + + twitter-direct + 1.0.0 + ${twitter-direct.def.id}-impl + ${project.version} + org.bonitasoft.connectors.twitter.TwitterDirectMessageConnector + + twitter-update-status + 1.0.0 + ${twitter-update-status.def.id}-impl + ${project.version} + org.bonitasoft.connectors.twitter.TwitterUpdateStatusConnector + + + 1.1 + 4.0.7 + + + 7.11.0 + + + 0.8.5 + 3.7.0.1746 + + + 3.8.1 + ${java.version} + ${java.version} + 3.1.1 + 2.1.1 + 2.4.16 + 3.0.0-M4 + 1.6.8 + 3.2.0 + 3.2.0 + + + bonitasoft_bonita-connector-twitter + bonitasoft + https://sonarcloud.io + + + + + org.bonitasoft.engine + bonita-engine + ${bonita.engine.version} + pom + import + + + javax.activation + activation + ${javax.activation.version} + provided + + + - - - - bonita-common - org.bonitasoft.engine - ${bonita.engine.version} - provided - + + + bonita-common + org.bonitasoft.engine + ${bonita.engine.version} + provided + + + org.twitter4j twitter4j-core - 4.0.7 - - - junit - junit - test + ${twitter4j.version} + + + + junit + junit + test + - + + verify + + + src/main/resources-filtered + true + + + src/main/resources + false + + + + maven-assembly-plugin + ${maven-assembly-plugin.version} + + ${project.basedir}/src/assembly + + + + package-connectors + package + + single + + + true + + + + + + org.codehaus.gmaven + groovy-maven-plugin + ${groovy-maven-plugin.version} + + + org.codehaus.groovy + groovy-all + ${groovy-all.version} + + + org.apache.maven.plugins - maven-release-plugin - 2.5.3 + maven-surefire-plugin + ${maven-surefire-plugin.version} - @{project.version} + true + 1 + true - maven-assembly-plugin - 2.5 + org.jacoco + jacoco-maven-plugin + ${jacoco-maven-plugin.version} + + true + - assemble - none + prepare-agent + + prepare-agent + + + + prepare-agent-integration + + prepare-agent-integration + + + + jacoco-site + verify + + report + + + org.sonarsource.scanner.maven + sonar-maven-plugin + ${sonar-maven-plugin.version} + + + org.sonatype.plugins + nexus-staging-maven-plugin + ${nexus-staging-maven-plugin.version} + true + + ossrh + https://oss.sonatype.org/ + false + + - org.apache.maven.plugins - maven-release-plugin - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.0 - - 1.8 - 1.8 - - - - maven-assembly-plugin + org.codehaus.gmaven + groovy-maven-plugin - all - package + generate-resources - single + execute - ${basedir}/connector-assembly.xml - true + ${project.basedir}/src/script/dependencies-as-var.groovy + + + + org.apache.maven.plugins + maven-assembly-plugin + + + org.jacoco + jacoco-maven-plugin + + + org.apache.maven.plugins + maven-source-plugin + ${maven-source-plugin.version} + - twitter-direct-message - package + attach-sources - single + jar-no-fork - - ${basedir}/twitter-direct-message-assembly.xml - + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + - twitter-update-status - package + attach-javadocs - single + jar - - ${basedir}/twitter-update-status-assembly.xml - - - scm:git:https://${env.GIT_USERNAME}:${env.GIT_PASSWORD}@github.com/bonitasoft/bonita-connector-twitter.git - scm:git:https://${env.GIT_USERNAME}:${env.GIT_PASSWORD}@github.com/bonitasoft/bonita-connector-twitter.git - https://github.com/bonitasoft/bonita-connector-twitter - HEAD - + + + + deploy + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + --pinentry-mode + loopback + + + + + + + + + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + scm:git:git@github.com:bonitasoft/bonita-connector-twitter.git + scm:git:git@github.com:bonitasoft/bonita-connector-twitter.git + https://github.com/bonitasoft/bonita-connector-twitter + HEAD + diff --git a/src/assembly/all-assembly.xml b/src/assembly/all-assembly.xml new file mode 100644 index 0000000..08d969a --- /dev/null +++ b/src/assembly/all-assembly.xml @@ -0,0 +1,34 @@ + + all + + zip + + false + + + + target/classes + + + *.* + + + + classpath + ${basedir}/target + + *:jar + + + + + + false + runtime + classpath + + + \ No newline at end of file diff --git a/twitter-direct-message-assembly.xml b/src/assembly/twitter-direct-assembly.xml similarity index 81% rename from twitter-direct-message-assembly.xml rename to src/assembly/twitter-direct-assembly.xml index 9ff572a..c78ea21 100644 --- a/twitter-direct-message-assembly.xml +++ b/src/assembly/twitter-direct-assembly.xml @@ -9,22 +9,22 @@ false - / + target/classes twitter-direct.impl - /classpath + classpath - /classpath + classpath ${basedir}/target *-sources.jar - /classpath + classpath ${basedir}/target *:jar @@ -35,7 +35,7 @@ false runtime - /classpath + classpath \ No newline at end of file diff --git a/twitter-update-status-assembly.xml b/src/assembly/twitter-update-status.xml similarity index 81% rename from twitter-update-status-assembly.xml rename to src/assembly/twitter-update-status.xml index a8762c1..633737a 100644 --- a/twitter-update-status-assembly.xml +++ b/src/assembly/twitter-update-status.xml @@ -9,22 +9,22 @@ false - / + target/classes twitter-update-status.impl - /classpath + classpath - /classpath + classpath ${basedir}/target *-sources.jar - /classpath + classpath ${basedir}/target *:jar @@ -35,7 +35,7 @@ false runtime - /classpath + classpath \ No newline at end of file diff --git a/src/main/resources/twitter-direct.def b/src/main/resources-filtered/twitter-direct.def similarity index 94% rename from src/main/resources/twitter-direct.def rename to src/main/resources-filtered/twitter-direct.def index 36a8ac2..20d3f98 100644 --- a/src/main/resources/twitter-direct.def +++ b/src/main/resources-filtered/twitter-direct.def @@ -1,7 +1,7 @@ - twitter-direct - 1.0.0 + ${twitter-direct.def.id} + ${twitter-direct.def.version} twitter.png diff --git a/src/main/resources-filtered/twitter-direct.impl b/src/main/resources-filtered/twitter-direct.impl new file mode 100644 index 0000000..24a60f6 --- /dev/null +++ b/src/main/resources-filtered/twitter-direct.impl @@ -0,0 +1,15 @@ + + + + ${twitter-direct.def.id} + ${twitter-direct.def.version} + ${twitter-direct.impl.id} + ${twitter-direct.impl.version} + Implementation based on twitter4j-core 4.0.7 + false + ${twitter-direct.main-class} + + + ${connector-dependencies} + + diff --git a/src/main/resources/twitter-update-status.def b/src/main/resources-filtered/twitter-update-status.def similarity index 93% rename from src/main/resources/twitter-update-status.def rename to src/main/resources-filtered/twitter-update-status.def index c9ed43e..2c11c3d 100644 --- a/src/main/resources/twitter-update-status.def +++ b/src/main/resources-filtered/twitter-update-status.def @@ -1,7 +1,7 @@ - twitter-update-status - 1.0.0 + ${twitter-update-status.def.id} + ${twitter-update-status.def.version} twitter.png diff --git a/src/main/resources-filtered/twitter-update-status.impl b/src/main/resources-filtered/twitter-update-status.impl new file mode 100644 index 0000000..ec4f433 --- /dev/null +++ b/src/main/resources-filtered/twitter-update-status.impl @@ -0,0 +1,15 @@ + + + + ${twitter-update-status.def.id} + ${twitter-update-status.def.version} + ${twitter-update-status.impl.id} + ${twitter-update-status.impl.version} + Implementation based on twitter4j-core 4.0.7 + false + ${twitter-update-status.main-class} + + + ${connector-dependencies} + + \ No newline at end of file diff --git a/src/main/resources/twitter-direct.impl b/src/main/resources/twitter-direct.impl deleted file mode 100644 index 19a6d6c..0000000 --- a/src/main/resources/twitter-direct.impl +++ /dev/null @@ -1,13 +0,0 @@ - - - - twitter-direct - 1.0.0 - Implementation based on twitter4j-core 4.0.7 - org.bonitasoft.connectors.twitter.TwitterDirectMessageConnector - twitter-direct - $implementation.version$ - - $Dependencies$ - - diff --git a/src/main/resources/twitter-update-status.impl b/src/main/resources/twitter-update-status.impl deleted file mode 100644 index 66a790f..0000000 --- a/src/main/resources/twitter-update-status.impl +++ /dev/null @@ -1,13 +0,0 @@ - - - - twitter-update-status - 1.0.0 - Implementation based on twitter4j-core 4.0.7 - org.bonitasoft.connectors.twitter.TwitterUpdateStatusConnector - twitter-update-status - $implementation.version$ - - $Dependencies$ - - \ No newline at end of file diff --git a/src/script/dependencies-as-var.groovy b/src/script/dependencies-as-var.groovy new file mode 100644 index 0000000..5b08e4b --- /dev/null +++ b/src/script/dependencies-as-var.groovy @@ -0,0 +1,15 @@ +import groovy.xml.MarkupBuilder + +def xml = new StringWriter() +def builder = new MarkupBuilder(xml) +builder.jarDependencies { + jarDependency("${project.artifactId}-${project.version}.${project.packaging}") + project.artifacts + .findAll { artifact -> artifact.scope == "compile" || artifact.scope == "runtime" } + .sort { artifact -> artifact.artifactId } + .each { artifact -> + jarDependency("${artifact.artifactId}-${artifact.version}.${artifact.type}") + } +} +def deps = xml.toString() +project.properties.setProperty("connector-dependencies", deps) \ No newline at end of file