diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 1c95533..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,127 +0,0 @@ -# This file is a template, and might need editing before it works on your project. -# To contribute improvements to CI/CD templates, please follow the Development guide at: -# https://docs.gitlab.com/ee/development/cicd/templates.html -# This specific template is located at: -# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Android.gitlab-ci.yml - -# Read more about this script on this blog post https://about.gitlab.com/2018/10/24/setting-up-gitlab-ci-for-android-projects/, by Jason Lenny -# If you are interested in using Android with FastLane for publishing take a look at the Android-Fastlane template. - -default: - image: openjdk:8-jdk - tags: - - size:2xlarge - - arch:amd64 -variables: - - # ANDROID_COMPILE_SDK is the version of Android you're compiling with. - # It should match compileSdkVersion. - ANDROID_COMPILE_SDK: "30" - - # ANDROID_BUILD_TOOLS is the version of the Android build tools you are using. - # It should match buildToolsVersion. - ANDROID_BUILD_TOOLS: "30.0.2" - - # It's what version of the command line tools we're going to download from the official site. - # Official Site-> https://developer.android.com/studio/index.html - # There, look down below at the cli tools only, sdk tools package is of format: - # commandlinetools-os_type-ANDROID_SDK_TOOLS_latest.zip - # when the script was last modified for latest compileSdkVersion, it was which is written down below - ANDROID_SDK_TOOLS: "6514223" - -workflow: - rules: - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - when: always - - if: $CI_COMMIT_REF_NAME == "main" - when: always - - when: never - -# Check merge request message -lint: - stage: .pre - script: - - echo Start PR Validation - - env - - '[[ "$CI_COMMIT_MESSAGE" =~ ^(feat|fix|chore|docs|tests|ci) ]] || (echo "no commit type is specified in merge request title" && exit 1)' - -gentoken: - stage: .pre - script: - - echo "gitLabPrivateToken=$PRIVATE_TOKEN" >> key.properties - - echo "projectUrl=$PROJECT_URL" >> key.properties - artifacts: - paths: - - key.properties - expire_in: 10 mins - -# Make Project -build: - stage: build - # Packages installation before running script - before_script: - - apt-get --quiet update --yes - - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 - - # Setup path as android_home for moving/exporting the downloaded sdk into it - - export ANDROID_HOME="${PWD}/android-home" - # Create a new directory at specified location - - install -d $ANDROID_HOME - # Here we are installing androidSDK tools from official source, - # (the key thing here is the url from where you are downloading these sdk tool for command line, so please do note this url pattern there and here as well) - # after that unzipping those tools and - # then running a series of SDK manager commands to install necessary android SDK packages that'll allow the app to build - - wget --output-document=$ANDROID_HOME/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip - # move to the archive at ANDROID_HOME - - pushd $ANDROID_HOME - - unzip -d cmdline-tools cmdline-tools.zip - - popd - - export PATH=$PATH:${ANDROID_HOME}/cmdline-tools/tools/bin/ - - # Nothing fancy here, just checking sdkManager version - - sdkmanager --version - - # use yes to accept all licenses - - yes | sdkmanager --sdk_root=${ANDROID_HOME} --licenses || true - - sdkmanager --sdk_root=${ANDROID_HOME} "platforms;android-${ANDROID_COMPILE_SDK}" - - sdkmanager --sdk_root=${ANDROID_HOME} "platform-tools" - - sdkmanager --sdk_root=${ANDROID_HOME} "build-tools;${ANDROID_BUILD_TOOLS}" - - # Not necessary, but just for security - - chmod +x ./gradlew - script: - - ./gradlew build -p clickstream - - ./gradlew jacocoTestReport - - grep -Eo "Total.*?([0–9]{1,3})%" clickstream/build/reports/jacoco/index.html - coverage: '/Total.*?([0-9]{1,3})%/' - artifacts: - paths: - - clickstream/build/outputs/aar/ - - clickstream/build/reports/ - - clickstream/build/reports/jacoco/jacoco.xml - reports: - junit: - - clickstream/build/test-results/test*/TEST-*.xml - -test-coverage: - # Must be in a stage later than test-jdk11's stage. - # The `visualize` stage does not exist by default. - # Please define it first, or chose an existing stage like `deploy`. - stage: test - image: registry.gitlab.com/haynes/jacoco2cobertura:1.0.9 - script: - # convert report from jacoco to cobertura, using relative project path - - python /opt/cover2cover.py clickstream/build/reports/jacoco/jacoco.xml clickstream/src/main/java/ > clickstream/build/cobertura.xml - needs: [ "build" ] - artifacts: - reports: - coverage_report: - coverage_format: cobertura - path: clickstream/build/cobertura.xml - -publish-sdk: - stage: deploy - needs: [ "build","gentoken" ] - script: - - ./gradlew publish -p clickstream - - echo publish success diff --git a/README.md b/README.md index 329502e..45c4e1c 100644 --- a/README.md +++ b/README.md @@ -32,22 +32,6 @@ open an terminal window,at the root project folder to execute: ```shell ./gradlew build -p clickstream ``` -## How to build in GitLab -### Runner tags select -Because We need to allow 64-bit machines to run Android's 32-bit tools, so we need to execute: -```shell -- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 -``` -This command needs to be executed in amd64 architecture machine, -so we should config the runner both size and arch tag below at `.gitlab-ci.yml` to ensure the architecture is right to execute. -```shell -default: - image: openjdk:8-jdk - tags: - - size:2xlarge - - arch:amd64 -``` - ## Security @@ -55,7 +39,4 @@ See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more inform ## License -This project is licensed under the Apache-2.0 License. - -This library is licensed under the [Apache 2.0 License](./LICENSE). - +This library is licensed under the [Apache 2.0 License](./LICENSE). \ No newline at end of file