pasosdeJesus/heb412

View on GitHub
.gitlab-ci.yml

Summary

Maintainability
Test Coverage
# Basado entre otros en: https://dev.to/mpressen/rails-minitest-gitlab-ci-31ap

image: "ruby:3.0.2"

services:
  - name: vtamara/postgis-es_co:13.3-1
    alias: postgres

variables:
  RAILS_ENV: test
  POSTGRES_ENABLED: "true"
  POSTGRES_USER: runner
  POSTGRES_PASSWORD: ""
  POSTGRES_DB: heb412gen_pru
  POSTGRES_HOST_AUTH_METHOD: trust
  NOKOGIRI_USE_SYSTEM_LIBRARIES: "true"
  CC_TEST_REPORTER_ID: "2fb282f54ad990d39d0c0801d92f4554adce97dac8d4eb0dc66dc96301f969c9"


stages:
  - test

test:
  stage: test
  cache:
    paths:
      - apt-cache
      - node_modules
      - vendor/bundle
  before_script:
    - uname -a
    - whoami
    - echo "HOME=${HOME}"
    - pwd
    - which ruby
    - ruby -v
    - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
    - chmod +x ./cc-test-reporter
    - ./cc-test-reporter before-build
    - export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR
    - apt-get update -yy && apt-get install build-essential libpq-dev postgresql-client -y
    - curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh
    - bash ./nodesource_setup.sh
    - curl -fsSL https://deb.nodesource.com/setup_16.x | bash - # https://www.linuxcapable.com/how-to-install-node-js-14-lts-16-npm-on-debian-11-bullseye/
    - apt install -y -qq nodejs
    - node -v
    - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
    - echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
    - apt-get update -qq && apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -yqq yarn
    - yarn install
    - gem install bundler --no-document
    - bundle install --jobs $(nproc) "${FLAGS[@]}"
    - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
    - chmod +x ./cc-test-reporter
    - ./cc-test-reporter before-build
    - cp .env.gitlab .env
    - cp db/structure.sql db/structure.sql.copia 
    - sed -e 's/provider = libc,//g;s/SET default_table_access_method.*/-- &/g' db/structure.sql.copia > db/structure.sql 
    - bin/rails db:drop db:create db:setup
    - bin/rails msip:indices
    - bin/rails msip:stimulus_motores
    - bin/rails assets:precompile
  script:
    - CONFIG_HOSTS=www.example.com bin/rails test
    - ./cc-test-reporter after-build -t simplecov --exit-code $?



sast:
    stage: test
include:
- template: Security/SAST.gitlab-ci.yml