diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 1540059..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,54 +0,0 @@ -version: 2.1 - -orbs: - maven-deploy: wasiqb/maven-deploy@2.1.0 - -branches: &all - only: - - master - - release - - /issue-.*/ - -workflows: - workflow: - jobs: - - maven-deploy/code-checkout - - maven-deploy/resolve-dependency: - requires: - - maven-deploy/code-checkout - filters: - branches: - <<: *all - - maven-deploy/build: - executor-version: 15-jdk-buster - requires: - - maven-deploy/resolve-dependency - filters: - branches: - <<: *all - - maven-deploy/test: - executor-version: 15-jdk-buster - requires: - - maven-deploy/build - filters: - branches: - <<: *all - - maven-deploy/sonar-analysis: - executor-version: 15-jdk-buster - requires: - - maven-deploy/test - filters: - branches: - <<: *all - context: RELEASE_PROFILE_WASIQB - - maven-deploy/deploy: - executor-version: 15-jdk-buster - fail_only: false - filters: - branches: - only: - - master - requires: - - maven-deploy/sonar-analysis - context: RELEASE_PROFILE_WASIQB - deploy-command: mvn deploy --settings settings/settings.xml -DskipTests -Dcheckstyle.skip -B -Prelease diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..78978b4 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,291 @@ +name: Deploy Release to GitHub and Maven Central + +on: + workflow_dispatch: + inputs: + release_type: + description: 'Release Type: major, minor, patch' + required: true + default: 'minor' + +env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + +jobs: + validate-input: + runs-on: ubuntu-latest + if: ${{ github.event.inputs.release_type == 'major' || + github.event.inputs.release_type == 'minor' || + github.event.inputs.release_type == 'patch' }} + steps: + - name: Release Type selected for making release + run: echo "[${{ github.event.inputs.release_type }}] release in progress." + + prepare-release-snapshot: + needs: + - validate-input + runs-on: ubuntu-latest + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Install Java and Maven + uses: actions/setup-java@v2 + with: + java-version: '15' + distribution: 'adopt' + + - name: Restore local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ github.sha }} + + - name: Maven command to update Major snapshot version + if: ${{ github.event.inputs.release_type == 'major' }} + run: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.nextMajorVersion}.0.0-SNAPSHOT versions:commit + + - name: Maven command to update Minor snapshot version + if: ${{ github.event.inputs.release_type == 'minor' }} + run: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0-SNAPSHOT versions:commit + + - name: Maven command to update Patch snapshot version + if: ${{ github.event.inputs.release_type == 'patch' }} + run: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT versions:commit + + - name: Build the artifacts + run: mvn clean install -DskipTests -Dcheckstyle.skip + + - name: Upload target folder + uses: actions/upload-artifact@v2 + with: + name: target + path: | + ${{ github.workspace }}/target + ${{ github.workspace }}/pom.xml + + release-snapshot: + runs-on: ubuntu-latest + needs: + - prepare-release-snapshot + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Install Java and Maven + uses: actions/setup-java@v2 + with: + java-version: '15' + distribution: 'adopt' + + - name: Restore local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ github.sha }} + + - name: Download target folder + uses: actions/download-artifact@v2 + with: + name: target + + - name: Release snapshot to Maven central + uses: samuelmeuli/action-maven-publish@v1 + with: + gpg_private_key: ${{ env.GPG_PRIVATE_KEY }} + gpg_passphrase: ${{ env.GPG_PASSPHRASE }} + nexus_username: ${{ env.NEXUS_USERNAME }} + nexus_password: ${{ env.NEXUS_PASSWORD }} + maven_profiles: release + server_id: ossrh + maven_args: --settings ${{ github.workspace }}/setting/settings.xml -DskipTests -Dcheckstyle.skip -B + + prepare-release: + needs: + - release-snapshot + runs-on: ubuntu-latest + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Install Java and Maven + uses: actions/setup-java@v2 + with: + java-version: '15' + distribution: 'adopt' + + - name: Restore local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ github.sha }} + + - name: Download target folder + uses: actions/download-artifact@v2 + with: + name: target + + - name: Maven command to update Major version + if: ${{ github.event.inputs.release_type == 'major' }} + run: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.0.0 versions:commit + + - name: Maven command to update Minor version + if: ${{ github.event.inputs.release_type == 'minor' }} + run: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.0 versions:commit + + - name: Maven command to update Patch version + if: ${{ github.event.inputs.release_type == 'patch' }} + run: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion} versions:commit + + - name: Build the project + run: mvn clean install -DskipTests -Dcheckstyle.skip + + - name: Upload target folder + uses: actions/upload-artifact@v2 + with: + name: target + path: | + ${{ github.workspace }}/target + ${{ github.workspace }}/pom.xml + + maven-release: + runs-on: ubuntu-latest + needs: + - prepare-release + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Install Java and Maven + uses: actions/setup-java@v2 + with: + java-version: '15' + distribution: 'adopt' + + - name: Restore local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ github.sha }} + + - name: Download target folder + uses: actions/download-artifact@v2 + with: + name: target + + - name: Release to Maven central + uses: samuelmeuli/action-maven-publish@v1 + with: + gpg_private_key: ${{ env.GPG_PRIVATE_KEY }} + gpg_passphrase: ${{ env.GPG_PASSPHRASE }} + nexus_username: ${{ env.NEXUS_USERNAME }} + nexus_password: ${{ env.NEXUS_PASSWORD }} + maven_profiles: release + server_id: ossrh + maven_args: --settings ${{ github.workspace }}/setting/settings.xml -DskipTests -Dcheckstyle.skip -B + + push-pom: + runs-on: ubuntu-latest + needs: + - maven-release + outputs: + release-version: ${{ steps.artifacts.outputs.version }} + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Install Java and Maven + uses: actions/setup-java@v2 + with: + java-version: '15' + distribution: 'adopt' + + - name: Download target folder + uses: actions/download-artifact@v2 + with: + name: target + + - name: Get the release version + id: artifacts + run: | + export MVN_VERSION=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec) + echo "::set-output name=version::$MVN_VERSION" + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v3 + with: + gpg-private-key: ${{ env.GPG_PRIVATE_KEY }} + passphrase: ${{ env.GPG_PASSPHRASE }} + git-user-signingkey: true + git-commit-gpgsign: true + + - name: Push updated pom.xml + uses: EndBug/add-and-commit@v7 + with: + add: pom.xml + message: Released latest version to Maven central + push: true + default_author: user_info + signoff: true + + push-tag: + runs-on: ubuntu-latest + needs: + - push-pom + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Download target folder + uses: actions/download-artifact@v2 + with: + name: target + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v3 + with: + gpg-private-key: ${{ env.GPG_PRIVATE_KEY }} + passphrase: ${{ env.GPG_PASSPHRASE }} + git-user-signingkey: true + git-commit-gpgsign: true + + - name: Create and Push Tag + uses: EndBug/add-and-commit@v7 + with: + tag: v${{ needs.push-pom.outputs.release-version }} + message: Released to Maven central + signoff: true + default_author: user_info + push: true + + github-release: + runs-on: ubuntu-latest + needs: + - push-pom + - push-tag + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Download target folder + uses: actions/download-artifact@v2 + with: + name: target + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + GITHUB_REPOSITORY: ${{ github.repository }} + with: + body_path: changelogs/latest.md + tag_name: v${{ needs.push-pom.outputs.release-version }} + name: Version ${{ needs.push-pom.outputs.release-version }} + prerelease: false + draft: false + files: | + target/*.jar + target/*.pom \ No newline at end of file diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index b671fc0..64592c0 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -2,18 +2,21 @@ name: Mark stale issues and pull requests on: schedule: - - cron: "30 1 * * *" + - cron: "0 0 * * *" jobs: stale: - runs-on: ubuntu-latest steps: - - uses: actions/stale@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Stale issue message' - stale-pr-message: 'Stale pull request message' - stale-issue-label: 'no-issue-activity' - stale-pr-label: 'no-pr-activity' + - uses: actions/stale@v3 + with: + repo-token: ${{ github.token }} + stale-issue-message: 'Ticket is stale since last 90 days.' + stale-pr-message: 'PR is stale since last 90 days' + stale-issue-label: 'no-issue-activity' + stale-pr-label: 'no-pr-activity' + days-before-stale: 90 + days-before-close: 120 + close-issue-message: 'Ticket is closed since no activity for last 120 days' + close-pr-message: 'PR is closed without merge since last 120 days.' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..980f129 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,122 @@ +name: Test coteafs-appium project + +on: + push: + branches: + - master + - main + - release + - issue-* + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Install Java and Maven + uses: actions/setup-java@v2 + with: + java-version: '15' + distribution: 'adopt' + + - name: Build the project + run: mvn install -DskipTests + + - name: Upload target folder + uses: actions/upload-artifact@v2 + with: + name: target + path: ${{ github.workspace }}/target + + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ github.sha }} + + test: + needs: + - build + runs-on: ubuntu-latest + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Install Java and Maven + uses: actions/setup-java@v2 + with: + java-version: '15' + distribution: 'adopt' + + - name: Restore local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ github.sha }} + + - name: Download target folder + uses: actions/download-artifact@v2 + with: + name: target + + - name: Test execution + env: + CLOUD_USER: ${{ secrets.CLOUD_USER }} + CLOUD_KEY: ${{ secrets.CLOUD_KEY }} + APP: ${{ secrets.APP }} + APP_IOS: ${{ secrets.APP_IOS }} + run: mvn org.jacoco:jacoco-maven-plugin:prepare-agent install -Pcoverage-per-test + + - name: Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Test Results + path: ${{ github.workspace }}/target/surefire-reports/*.xml + reporter: java-junit + + - name: Upload target folder + uses: actions/upload-artifact@v2 + with: + name: target + path: ${{ github.workspace }}/target + + analysis: + needs: + - test + runs-on: ubuntu-latest + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Install Java and Maven + uses: actions/setup-java@v2 + with: + java-version: '15' + distribution: 'adopt' + + - name: Restore local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ github.sha }} + + - name: Download target folder + uses: actions/download-artifact@v2 + with: + name: target + + - name: Analyse code + env: + SONAR_KEY: ${{ secrets.SONAR_KEY }} + SONAR_ORG: ${{ secrets.SONAR_ORG }} + run: | + mvn package sonar:sonar \ + -Dsonar.host.url="https://sonarcloud.io" \ + -Dsonar.organization=$SONAR_ORG \ + -Dsonar.login=$SONAR_KEY \ + -DskipTests \ + -Dcheckstyle.skip \ + -Dsonar.branch.name=${{ github.ref }} \ No newline at end of file diff --git a/changelogs/CHANGELOG.md b/changelogs/CHANGELOG.md new file mode 100644 index 0000000..fd7fc50 --- /dev/null +++ b/changelogs/CHANGELOG.md @@ -0,0 +1,22 @@ +## Version 4.0.0: 21/05/2021 + +## 💀 Breaking + +- #108 - Update server config structure and corresponding classes. +- #122 - Update device config structure. + +## 🌟 Enhancements + +- #133 - Screen recording and snapshot management. +- #134 - Clipboard management. +- #135 - Device gestures management. +- #136 - Element gestures management. +- #137 - Logs management. +- #141 - Device keyboard management. +- #142 - Provide support to update Appium settings. +- #146 - File management. +- #155 - Allow setting device language for multi-language testing + +## 📖 Others + +- #152 - Updated dependencies and README. \ No newline at end of file diff --git a/changelogs/latest.md b/changelogs/latest.md new file mode 100644 index 0000000..cced7b1 --- /dev/null +++ b/changelogs/latest.md @@ -0,0 +1,4 @@ +## 🌟 Enhancements + +- [#165]: Replace issue template with issue forms. +- [#158]: Replace CircleCI with GitHub Actions. \ No newline at end of file diff --git a/settings/settings.xml b/setting/settings.xml similarity index 92% rename from settings/settings.xml rename to setting/settings.xml index 9e74b1e..c4f98a5 100644 --- a/settings/settings.xml +++ b/setting/settings.xml @@ -33,8 +33,8 @@ ossrh - ${env.SERVER_OSSRH_USERNAME} - ${env.SERVER_OSSRH_PASSWORD} + ${env.NEXUS_USERNAME} + ${env.NEXUS_PASSWORD} \ No newline at end of file diff --git a/src/test/resources/test-config.yaml b/src/test/resources/test-config.yaml deleted file mode 100644 index b6404b5..0000000 --- a/src/test/resources/test-config.yaml +++ /dev/null @@ -1,93 +0,0 @@ -servers: - default: - ip: 127.0.0.1 - port: 4723 - timeouts_seconds: - start_up: 60 - log_file: logs/android-server.log - no_reset: true - external: true - session_override: true - other: - ip: 127.0.0.1 - port: 4724 - start_up_time_out_seconds: 60 - no_reset: true - -devices: - android: - app: - location: apps/android/xxxx.apk - external: false - package: com.company.cwp.app - activity: com.company.cwp.app.activity.xxxx.MainActivity - wait_activity: com.company.cwp.app.activity.xxxx.WalkthroughActivity - type: HYBRID - device: - type: ANDROID - name: Mi4 - version: 6.0.1 - automation_name: APPIUM - no_reset: true - full_reset: true - screenshot_path: /snaps - alert: - auto_grant_permissions: true - waits: - implicit: 60 - explicit: 60 - timeouts: - session: 60 - install: 60 - device_ready: 60 - duration: 60ms - - iphone: - app: - location: /Users/wasiq.bhamla/Downloads/xxxx.ipa - external: true - type: HYBRID - name: App Name - bundle_id: com.company.xxxx - device: - type: IOS - name: iPhone 6 - version: 10.3.1 - udid: - automation_name: XCUI - max_typing_frequency: 100 words per min - send_key_strategy: one by one - alert: - auto_accept: true - auto_dismiss: false - wda: - use_new: true - local_port: 8100 - retries: 2 - retry_interval: 10000 - update_bundle_id: com.facebook.MyWebDriverAgentRunner - team_id: <10 char Team ID> - signing_id: iPhone Developer - bootstrap_path: /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent - agent_path: /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj - timeouts: - wda_connection: 600 - wda_launch: 600 - wda_command: 600 - launch: 10000 - screenshot: 10 - waits: - inter_key: 100 - ios_install: 500 - iphone_simulator: - device_type: IOS - device_name: iPhone 6 - device_version: 10.3.1 - udid: - bundle_id: com.company.xxxx - app_type: HYBRID - app_location: /Users/wasiq.bhamla/Downloads/xxxx.ipa - automation_name: XCUI - app_name: App Name - bootstrap_path: /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent - agent_path: /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj