diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9950045..0f9d017 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,26 +1,39 @@ # Basado entre otros en: https://dev.to/mpressen/rails-minitest-gitlab-ci-31ap -image: "ruby:3.0.2" +include: + - template: Security/Dependency-Scanning.gitlab-ci.yml + - template: Security/License-Scanning.gitlab-ci.yml + - template: Security/SAST.gitlab-ci.yml + - template: Security/Secret-Detection.gitlab-ci.yml + - template: Security/DAST.gitlab-ci.yml + - template: Code-Quality.gitlab-ci.yml + + + +image: "ruby:3.1.2" services: - name: vtamara/postgis-es_co:13.3-1 alias: postgres + - name: selenium/standalone-chrome + alias: chrome variables: RAILS_ENV: test POSTGRES_ENABLED: "true" POSTGRES_USER: runner POSTGRES_PASSWORD: "" - POSTGRES_DB: sivel2gen_pru + POSTGRES_DB: sifasol_pru POSTGRES_HOST_AUTH_METHOD: trust NOKOGIRI_USE_SYSTEM_LIBRARIES: "true" - CC_TEST_REPORTER_ID: "af8fb32f310935cd6bc8811d81e2f16682b94c340e3a47b4ebc3558f88ae656a" - - + SELENIUM_REMOTE_URL: http://chrome:4444/wd/hub + DAST_WEBSITE: http://example.com + CC_TEST_REPORTER_ID: "568b1ae5098341f2ba3eb9e36f304e17325eb93a7d021f3cfb1e9fbe94a9a40f" stages: - test + - dast test: stage: test @@ -31,11 +44,9 @@ test: - vendor/bundle before_script: - uname -a - - whoami - - echo "HOME=${HOME}" - - pwd - - which ruby + - cat /etc/os-release - ruby -v + - which ruby - 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 -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/ @@ -45,22 +56,22 @@ test: - 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 - - bundle install --jobs $(nproc) "${FLAGS[@]}" - cp .env.gitlab .env + - cp config/database.ci.yml config/database.yml - 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 + - which psql - bin/rails db:drop db:create db:setup - bin/rails sip:indices + - bin/rails sip:stimulus_motores + - bin/rails assets:precompile script: - - CONFIG_HOSTS=www.example.com bin/rails test + - (. .env && 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