stages: - generic - test - security-testing - misc - build include: - project: 'affinidi/foundational/foundational-pipeline' file: '/security.yml' - project: 'affinidi/foundational/foundational-pipeline' file: '/variables.yml' variables: # FOUNDATIONAL_TOOLING_VERSION: v1.232.3 NODE_BUILD_VERSION: 16.14.2-alpine3.15 NPM_CACHE_PREFIX: npm JEST_CACHE_PREFIX: jest ANDROID_COMPILE_SDK: "30" #set compile SDK version ANDROID_BUILD_TOOLS: "30.0.3" #set build tool version ANDROID_SDK_TOOLS: "7583922" #set SDK tool build number you can find yous here https://developer.android.com/studio/releases/sdk-tools security-fixes: stage: misc needs: [] image: registry.gitlab.com/affinidi/foundational/tooling/foundational-tooling:${FOUNDATIONAL_TOOLING_VERSION} allow_failure: true script: - rm -Rf /scripts/reports - python3 /scripts/vulnerability_dismisser.py --project-path "${CI_PROJECT_PATH}" artifacts: paths: - ./report/* .npm-cache-pull-push: &npm-cache-pull-push key: prefix: ${NPM_CACHE_PREFIX} files: - package.json - package-lock.json policy: pull-push paths: ['node_modules/', '.npm/'] .npm-cache-pull: &npm-cache-pull key: prefix: ${NPM_CACHE_PREFIX} files: - package.json - package-lock.json policy: pull paths: ['node_modules/', '.npm/'] .jest-cache-pull-push: &jest-cache-pull-push key: prefix: ${JEST_CACHE_PREFIX} files: - babel.config.js - jest.config.js policy: pull-push paths: ['.jest/cache'] .base: image: registry.gitlab.com/affinidi/container-image-cache/node-build:${NODE_BUILD_VERSION} #image: openjdk:11.0.14.1-jdk before_script: - export NPM_TOKEN=$CI_JOB_TOKEN #- apt install curl #- curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - #- apt install nodejs - npm config set cache .npm #- cat /etc/os-release #- apt-get --quiet update --yes #- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 # Setup path as ANDROID_SDK_ROOT for moving/exporting the downloaded sdk into it #- export ANDROID_SDK_ROOT="${PWD}/android-home" # Create a new directory at specified location #- install -d $ANDROID_SDK_ROOT # 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_SDK_ROOT/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip # move to the archive at ANDROID_SDK_ROOT #- pushd $ANDROID_SDK_ROOT #- unzip -d cmdline-tools cmdline-tools.zip #- pushd cmdline-tools # since commandline tools version 7583922 the root folder is named "cmdline-tools" so we rename it if necessary #- mv cmdline-tools tools || true #- popd #- popd #- export PATH=$PATH:${ANDROID_SDK_ROOT}/cmdline-tools/tools/bin/ # Nothing fancy here, just checking sdkManager version #- sdkmanager --version # use yes to accept all licenses #- yes | sdkmanager --licenses || true #- sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" #- sdkmanager "platform-tools" #- sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" # Not necessary, but just for surity #- chmod +x ./android/gradlew #- ls -l $(which javac) prepare: stage: generic extends: .base cache: - *npm-cache-pull-push script: - | if [[ ! -d node_modules ]]; then npm i --cache .npm --prefer-offline --legacy-peer-deps else echo node_modules exists, CI step skipped. fi lint: stage: test extends: .base cache: - *npm-cache-pull except: - /^release-.*$/ script: - npm run lint unit-tests: stage: test extends: .base cache: - *npm-cache-pull - *jest-cache-pull-push except: - /^release-.*$/ script: - npm test coverage: /All\sfiles.*?\s+(\d+.\d+)/ unit-test-coverage: stage: test extends: .base cache: - *npm-cache-pull - *jest-cache-pull-push script: - npm run test -- --coverage coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/ build-bundle: stage: build extends: .base cache: - *npm-cache-pull #- *jest-cache-pull-push except: - /^release-.*$/ script: - npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res artifacts: paths: - android/app/src/main/assets/ expire_in: 2 days