diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..57066b3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,40 @@ +ads +android-signing-keystore.jks +api-5245190277294621651-718463-f914fb7573c6.json +app +appintro +build +build.gradle +bundledemoji +CHANGELOG +Dockerfile +.dockerignore +extras +Gemfile +Gemfile.lock +.git +.gitignore +.gitlab-ci.yml +.gitmodules +.gradle +gradle +gradle.properties +gradlew +gradlew.bat +handwashing_app_logo.png +handwashing_app_logo.webp +handwashing_icon.png +handwashing_icon.webp +.idea +keystore.properties +LICENSE +local.properties +public +README.md +secrets.properties +settings.gradle +test-app-js +tgs +.vscode +functions/node_modules +functions/ui-debug.log diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 808e28c..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,128 +0,0 @@ -# This file is a template, and might need editing before it works on your project. -# Read more about how to use this script on this blog post https://about.gitlab.com/2019/01/28/android-publishing-with-gitlab-and-fastlane/ -# You will also need to configure your build.gradle, Dockerfile, and fastlane configuration to make this work. -# If you are looking for a simpler template that does not publish, see the Android template. - -stages: - - environment - - build - - test - - deploy - - internal - - alpha - - beta - - production - - -.updateContainerJob: - image: docker:19.03.0 - variables: - DOCKER_DRIVER: overlay2 - DOCKER_TLS_CERTDIR: "/certs" - # CI_REGISTRY: registry.gitlab.com - stage: environment - services: - - docker:19.03.0-dind - before_script: - - docker info - script: - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - - docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG || true - - docker build --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG . - - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG - -updateContainer: - extends: .updateContainerJob - only: - changes: - - Dockerfile - -ensureContainer: - extends: .updateContainerJob - allow_failure: true - before_script: - - "mkdir -p ~/.docker && echo '{\"experimental\": \"enabled\"}' > ~/.docker/config.json" - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - # Skip update container `script` if the container already exists - # via https://gitlab.com/gitlab-org/gitlab-foss/issues/26866#note_97609397 -> https://stackoverflow.com/a/52077071/796832 - - docker manifest inspect $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG > /dev/null && exit || true - - -.build_job: - image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG - stage: build - before_script: - # We store this binary file in a variable as hex with this command: `xxd -p android-app.jks` - # Then we convert the hex back to a binary file - - echo "$signing_jks_file_hex" | xxd -r -p - > android-signing-keystore.jks - - "export VERSION_CODE=$CI_PIPELINE_IID && echo $VERSION_CODE" - - "export VERSION_SHA=`echo ${CI_COMMIT_SHA:0:8}` && echo $VERSION_SHA" - after_script: - - rm -f android-signing-keystore.jks || true - artifacts: - paths: - - app/build/outputs - -buildDebug: - extends: .build_job - script: - - bundle exec fastlane buildDebug - -buildRelease: - extends: .build_job - script: - - bundle exec fastlane buildRelease - environment: - name: production - -testDebug: - image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG - stage: test - dependencies: - - buildDebug - script: - - bundle exec fastlane test - -publishInternal: - image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG - stage: internal - dependencies: - - buildRelease - when: manual - before_script: - - echo $google_play_service_account_api_key_json > ~/google_play_api_key.json - after_script: - - rm ~/google_play_api_key.json - script: - - bundle exec fastlane internal - -.promote_job: - image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG - when: manual - dependencies: [] - before_script: - - echo $google_play_service_account_api_key_json > ~/google_play_api_key.json - after_script: - - rm ~/google_play_api_key.json - -promoteAlpha: - extends: .promote_job - stage: alpha - script: - - bundle exec fastlane promote_internal_to_alpha - -promoteBeta: - extends: .promote_job - stage: beta - script: - - bundle exec fastlane promote_alpha_to_beta - -promoteProduction: - extends: .promote_job - stage: production - # We only allow production promotion on `master` because - # it has its own production scoped secret variables - only: - - master - script: - - bundle exec fastlane promote_beta_to_production diff --git a/Dockerfile b/Dockerfile index 33c11ae..ce2a977 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,97 +1,13 @@ -# ====================================================================== # -# Android SDK Docker Image -# ====================================================================== # - -# Base image -# ---------------------------------------------------------------------- # -FROM ubuntu:18.04 - -# Author -# ---------------------------------------------------------------------- # -LABEL maintainer "thyrlian@gmail.com" - -# support multiarch: i386 architecture -# install Java -# install essential tools -# install Qt -RUN dpkg --add-architecture i386 && \ - apt update -y && \ - apt install -y --no-install-recommends libncurses5:i386 libc6:i386 libstdc++6:i386 lib32gcc1 lib32ncurses5 lib32z1 zlib1g:i386 && \ - apt install -y --no-install-recommends openjdk-8-jdk && \ - apt install -y --no-install-recommends git wget unzip && \ - apt install -y --no-install-recommends qt5-default - -# download and install Gradle -# https://services.gradle.org/distributions/ -ARG GRADLE_VERSION=6.1.1 -ARG GRADLE_DIST=bin -RUN cd /opt && \ - wget -q https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-${GRADLE_DIST}.zip && \ - unzip gradle*.zip && \ - ls -d */ | sed 's/\/*$//g' | xargs -I{} mv {} gradle && \ - rm gradle*.zip - -# download and install Kotlin compiler -# https://github.com/JetBrains/kotlin/releases/latest -ARG KOTLIN_VERSION=1.3.71 -RUN cd /opt && \ - wget -q https://github.com/JetBrains/kotlin/releases/download/v${KOTLIN_VERSION}/kotlin-compiler-${KOTLIN_VERSION}.zip && \ - unzip *kotlin*.zip && \ - rm *kotlin*.zip - -# download and install Android SDK -# https://developer.android.com/studio/#downloads -ARG ANDROID_SDK_VERSION=4333796 -ENV ANDROID_HOME /opt/android-sdk -RUN mkdir -p ${ANDROID_HOME} && cd ${ANDROID_HOME} && \ - wget -q https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip && \ - unzip *tools*linux*.zip && \ - rm *tools*linux*.zip - -# set the environment variables -ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64 -ENV GRADLE_HOME /opt/gradle -ENV KOTLIN_HOME /opt/kotlinc -ENV PATH ${PATH}:${GRADLE_HOME}/bin:${KOTLIN_HOME}/bin:${ANDROID_HOME}/emulator:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools/bin -ENV _JAVA_OPTIONS -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -# WORKAROUND: for issue https://issuetracker.google.com/issues/37137213 -ENV LD_LIBRARY_PATH ${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib - -# accept the license agreements of the SDK components -ADD license_accepter.sh /opt/ -RUN chmod +x /opt/license_accepter.sh && /opt/license_accepter.sh $ANDROID_HOME - -# setup adb server -EXPOSE 5037 - -# install and configure SSH server -EXPOSE 22 -ADD sshd-banner /etc/ssh/ -ADD authorized_keys /tmp/ -RUN apt-get update -y && \ - apt-get install -y --no-install-recommends openssh-server supervisor locales && \ - mkdir -p /var/run/sshd /var/log/supervisord && \ - locale-gen en en_US en_US.UTF-8 && \ - apt-get remove -y locales && apt-get autoremove -y && \ - FILE_SSHD_CONFIG="/etc/ssh/sshd_config" && \ - echo "\nBanner /etc/ssh/sshd-banner" >> $FILE_SSHD_CONFIG && \ - echo "\nPermitUserEnvironment=yes" >> $FILE_SSHD_CONFIG && \ - ssh-keygen -q -N "" -f /root/.ssh/id_rsa && \ - FILE_SSH_ENV="/root/.ssh/environment" && \ - touch $FILE_SSH_ENV && chmod 600 $FILE_SSH_ENV && \ - printenv | grep "JAVA_HOME\|GRADLE_HOME\|KOTLIN_HOME\|ANDROID_HOME\|LD_LIBRARY_PATH\|PATH" >> $FILE_SSH_ENV && \ - FILE_AUTH_KEYS="/root/.ssh/authorized_keys" && \ - touch $FILE_AUTH_KEYS && chmod 600 $FILE_AUTH_KEYS && \ - for file in /tmp/*.pub; \ - do if [ -f "$file" ]; then echo "\n" >> $FILE_AUTH_KEYS && cat $file >> $FILE_AUTH_KEYS && echo "\n" >> $FILE_AUTH_KEYS; fi; \ - done && \ - (rm /tmp/*.pub 2> /dev/null || true) - -ADD supervisord.conf /etc/supervisor/conf.d/ -CMD ["/usr/bin/supervisord"] - -# install Fastlane -COPY Gemfile.lock . -COPY Gemfile . -RUN gem install bundle -RUN bundle install \ No newline at end of file +FROM node:10 +# app directory +WORKDIR /usr/src/app +# Copy neccessary files +COPY ./functions ./functions +COPY ./functions ./functions +COPY ./firebase.json ./ +COPY ./.firebaserc ./ +COPY ./.firebase ./ +WORKDIR /usr/src/app/functions +RUN npm i --only=production -g pm2@latest firebase-tools cross-env typescript +RUN npm ci --only=production +CMD ["pm2-runtime", "start", "daemon.json"] diff --git a/Dockerfile.old b/Dockerfile.old deleted file mode 100644 index 64b8d2e..0000000 --- a/Dockerfile.old +++ /dev/null @@ -1,31 +0,0 @@ -FROM openjdk:8-jdk - -# Just matched `app/build.gradle` -ENV ANDROID_COMPILE_SDK "29" -# Just matched `app/build.gradle` -ENV ANDROID_BUILD_TOOLS "29.0.3" -# Version from https://developer.android.com/studio/releases/sdk-tools -ENV ANDROID_SDK_TOOLS "26.1.1" - -ENV ANDROID_HOME /android-sdk-linux -ENV PATH="${PATH}:/android-sdk-linux/platform-tools/" - -# install OS packages -RUN apt --quiet update --yes -RUN apt --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 build-essential ruby ruby-dev -# We use this for xxd hex->binary -RUN apt --quiet install --yes vim-common -# install Android SDK -RUN wget --quiet --output-document=android-sdk.tgz https://dl.google.com/android/android-sdk_r${ANDROID_SDK_TOOLS}-linux.tgz -RUN tar --extract --gzip --file=android-sdk.tgz -RUN echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter android-${ANDROID_COMPILE_SDK} -RUN echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter platform-tools -RUN echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter build-tools-${ANDROID_BUILD_TOOLS} -RUN echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-android-m2repository -RUN echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-google_play_services -RUN echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-m2repository -# install Fastlane -COPY Gemfile.lock . -COPY Gemfile . -RUN gem install bundle -RUN bundle install \ No newline at end of file diff --git a/fastlane/Appfile b/fastlane/Appfile deleted file mode 100644 index 620a499..0000000 --- a/fastlane/Appfile +++ /dev/null @@ -1,2 +0,0 @@ -json_key_file("api-5245190277294621651-718463-f914fb7573c6.json") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one -package_name("com.javinator9889.handwashingreminder") # e.g. com.krausefx.app diff --git a/fastlane/Fastfile b/fastlane/Fastfile deleted file mode 100644 index ce0f9bd..0000000 --- a/fastlane/Fastfile +++ /dev/null @@ -1,58 +0,0 @@ -# This file contains the fastlane.tools configuration -# You can find the documentation at https://docs.fastlane.tools -# -# For a list of all available actions, check out -# -# https://docs.fastlane.tools/actions -# -# For a list of all available plugins, check out -# -# https://docs.fastlane.tools/plugins/available-plugins -# - -# Uncomment the line if you want fastlane to automatically update itself -# update_fastlane - -default_platform(:android) - -platform :android do - - desc "Builds the debug code" - lane :buildDebug do - gradle(task: "assembleDebug") - end - - desc "Builds the release code" - lane :buildRelease do - gradle(task: "assembleRelease") - end - - desc "Runs all the tests" - lane :test do - gradle(task: "test") - end - - desc "Submit a new Internal Build to Play Store" - lane :internal do - upload_to_play_store(track: 'internal', apk: 'app/build/outputs/apk/release/app-release.apk') - end - - # `skip_upload_changelogs` from https://github.com/fastlane/fastlane/issues/15681#issuecomment-556617987 - desc "Promote Internal to Alpha" - lane :promote_internal_to_alpha do - upload_to_play_store(track: 'internal', skip_upload_changelogs: true, track_promote_to: 'alpha') - end - - # `skip_upload_changelogs` from https://github.com/fastlane/fastlane/issues/15681#issuecomment-556617987 - desc "Promote Alpha to Beta" - lane :promote_alpha_to_beta do - upload_to_play_store(track: 'alpha', skip_upload_changelogs: true, track_promote_to: 'beta') - end - - # `skip_upload_changelogs` from https://github.com/fastlane/fastlane/issues/15681#issuecomment-556617987 - desc "Promote Beta to Production" - lane :promote_beta_to_production do - upload_to_play_store(track: 'beta', skip_upload_changelogs: true, track_promote_to: 'production') - end -end - diff --git a/fastlane/README.md b/fastlane/README.md deleted file mode 100644 index dc840ad..0000000 --- a/fastlane/README.md +++ /dev/null @@ -1,59 +0,0 @@ -fastlane documentation -================ -# Installation - -Make sure you have the latest version of the Xcode command line tools installed: - -``` -xcode-select --install -``` - -Install _fastlane_ using -``` -[sudo] gem install fastlane -NV -``` -or alternatively using `brew cask install fastlane` - -# Available Actions -## Android -### android buildDebug -``` -fastlane android buildDebug -``` -Builds the debug code -### android buildRelease -``` -fastlane android buildRelease -``` -Builds the release code -### android test -``` -fastlane android test -``` -Runs all the tests -### android internal -``` -fastlane android internal -``` -Submit a new Internal Build to Play Store -### android promote_internal_to_alpha -``` -fastlane android promote_internal_to_alpha -``` -Promote Internal to Alpha -### android promote_alpha_to_beta -``` -fastlane android promote_alpha_to_beta -``` -Promote Alpha to Beta -### android promote_beta_to_production -``` -fastlane android promote_beta_to_production -``` -Promote Beta to Production - ----- - -This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run. -More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). -The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/fastlane/metadata/android/es-ES/full_description.txt b/fastlane/metadata/android/es-ES/full_description.txt deleted file mode 100644 index 466eded..0000000 --- a/fastlane/metadata/android/es-ES/full_description.txt +++ /dev/null @@ -1 +0,0 @@ -Una aplicaciĆ³n que te recuerda que te laves las manos de forma inteligente \ No newline at end of file diff --git a/fastlane/metadata/android/es-ES/images/featureGraphic.png b/fastlane/metadata/android/es-ES/images/featureGraphic.png deleted file mode 100644 index b6861fb..0000000 Binary files a/fastlane/metadata/android/es-ES/images/featureGraphic.png and /dev/null differ diff --git a/fastlane/metadata/android/es-ES/images/icon.png b/fastlane/metadata/android/es-ES/images/icon.png deleted file mode 100644 index face3ce..0000000 Binary files a/fastlane/metadata/android/es-ES/images/icon.png and /dev/null differ diff --git a/fastlane/metadata/android/es-ES/images/phoneScreenshots/1_es-ES.png b/fastlane/metadata/android/es-ES/images/phoneScreenshots/1_es-ES.png deleted file mode 100644 index cd5ff86..0000000 Binary files a/fastlane/metadata/android/es-ES/images/phoneScreenshots/1_es-ES.png and /dev/null differ diff --git a/fastlane/metadata/android/es-ES/images/phoneScreenshots/2_es-ES.png b/fastlane/metadata/android/es-ES/images/phoneScreenshots/2_es-ES.png deleted file mode 100644 index d5b7eaa..0000000 Binary files a/fastlane/metadata/android/es-ES/images/phoneScreenshots/2_es-ES.png and /dev/null differ diff --git a/fastlane/metadata/android/es-ES/short_description.txt b/fastlane/metadata/android/es-ES/short_description.txt deleted file mode 100644 index 466eded..0000000 --- a/fastlane/metadata/android/es-ES/short_description.txt +++ /dev/null @@ -1 +0,0 @@ -Una aplicaciĆ³n que te recuerda que te laves las manos de forma inteligente \ No newline at end of file diff --git a/fastlane/metadata/android/es-ES/title.txt b/fastlane/metadata/android/es-ES/title.txt deleted file mode 100644 index 14aa7c7..0000000 --- a/fastlane/metadata/android/es-ES/title.txt +++ /dev/null @@ -1 +0,0 @@ -Handwashing reminder \ No newline at end of file diff --git a/fastlane/metadata/android/es-ES/video.txt b/fastlane/metadata/android/es-ES/video.txt deleted file mode 100644 index e69de29..0000000 diff --git a/fastlane/report.xml b/fastlane/report.xml deleted file mode 100644 index aa300ac..0000000 --- a/fastlane/report.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/functions/.dockerignore b/functions/.dockerignore new file mode 100644 index 0000000..730cbec --- /dev/null +++ b/functions/.dockerignore @@ -0,0 +1,2 @@ +node_modules +ui-debug.log \ No newline at end of file diff --git a/functions/daemon.json b/functions/daemon.json index 2c41e72..32b4eb2 100644 --- a/functions/daemon.json +++ b/functions/daemon.json @@ -3,7 +3,7 @@ { "name": "Newsriver-daemon", "script": "npm", - "args": "run updater" + "args": "run daemon" } ] } \ No newline at end of file diff --git a/functions/package.json b/functions/package.json index d39f13f..5c04d26 100644 --- a/functions/package.json +++ b/functions/package.json @@ -13,7 +13,7 @@ "daemon": "cross-env-shell RUN_DAEMON=true \"npm run build && firebase emulators:start --only functions\"" }, "engines": { - "node": "8" + "node": "10" }, "main": "lib/bin/index.js", "dependencies": { @@ -25,10 +25,10 @@ "http-errors": "^1.7.3", "morgan": "^1.10.0", "node-fetch": "^2.6.0", + "cross-env": "^7.0.2", "pug": "^3.0.0" }, "devDependencies": { - "cross-env": "^7.0.2", "firebase-functions-test": "^0.2.0", "tslint": "^5.12.0", "typescript": "^3.8.0"