--- /dev/null
+image: ruby:3.0.3
+
+workflow:
+ rules:
+ - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+
+stages:
+ - diff
+ - build
+ - test
+
+variables:
+ CONTINUOUS_INTEGRATION: "true" # not sure what this does…
+ DB_HOST: postgres
+ DB_USER: $POSTGRES_USER
+ DB_PASS: $POSTGRES_PASSWORD
+ DB_NAME: $POSTGRES_DB
+ DB_PORT: 5432
+ DISABLE_SIMPLECOV: "true" # not sure what this does…
+ NODEJS_SOURCE: https://deb.nodesource.com/setup_16.x # NodeJS 16
+ POSTGRES_DB: $POSTGRES_DB
+ POSTGRES_USER: $POSTGRES_USER
+ POSTGRES_PASSWORD: $POSTGRES_PASSWORD
+ POSTGRES_HOST_AUTH_METHOD: trust
+ RAILS_ENV: test
+ REDIS_HOST: redis
+ REDIS_PORT: 6379
+
+services:
+ - redis:6.2-alpine
+ - postgres:14-alpine
+
+cache:
+ - key:
+ files:
+ - Gemfile.lock
+ paths:
+ - vendor/ruby
+ - key:
+ files:
+ - yarn.lock
+ paths:
+ - .yarn-cache/
+
+before_script:
+ - curl -fsSL $NODEJS_SOURCE | bash -
+ - alias node=nodejs
+ - apt-get update -q && apt-get install -yqq git libicu-dev libidn11-dev nodejs
+ - corepack enable && yarn set version latest
+ - bundle config set path 'vendor'
+ - bundle config without 'development production'
+ - ruby -v
+ - bundle install -j $(nproc)
+ - yarn --version
+ - echo 'yarn-offline-mirror ".yarn-cache/"' >> .yarnrc
+ - echo 'yarn-offline-mirror-pruning true' >> .yarnrc
+ - yarn install --frozen-lockfile --no-progress
+
+diff:
+ image: denoland/deno:latest
+ stage: diff
+ before_script: []
+ script:
+ - >
+ deno eval "
+ import response from 'https://gitlab.com/api/v4/projects/$CI_MERGE_REQUEST_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID/changes' assert { type: 'json' };
+ const { all, rb, js } = [
+ ...function* () {
+ for (const change of response.changes) {
+ const path = change.new_path;
+ if (change.deleted_file) ;
+ else yield path;
+ }
+ }(),
+ ].reduce(
+ ({ all, rb, js }, change) => {
+ all.push(change);
+ if (/[.]rb$/.test(change)) rb.push(change);
+ else if (/[.]js$/.test(change)) js.push(change);
+ return { all, rb, js };
+ },
+ { all: [], rb: [], js: [] },
+ );
+ Deno.writeTextFileSync(
+ 'build.env',
+ 'CHANGED_FILES=' + all.join(' ') + String.fromCodePoint(0x0A) +
+ 'CHANGED_RUBY=' + rb.join(' ') + String.fromCodePoint(0x0A) +
+ 'CHANGED_JS=' + js.join(' ') + String.fromCodePoint(0x0A),
+ );"
+ - cat build.env
+ artifacts:
+ reports:
+ dotenv: build.env
+
+build:
+ stage: build
+ script:
+ - ./bin/rails assets:precompile
+ artifacts:
+ name: assets
+ expire_in: 1 week
+ paths:
+ - public/assets
+ - public/packs-test
+
+lint:
+ stage: test
+ script:
+ - 'if [ ! -z "$CHANGED_RUBY" ]; then bundle exec standardrb $CHANGED_RUBY; fi'
+ allow_failure: true
+
+test:
+ stage: test
+ dependencies:
+ - build
+ variables:
+ RAILS_ENV: test
+ script:
+ - apt-get install -yqq ffmpeg imagemagick libpam-dev
+ - ./bin/rails db:create db:schema:load db:seed
+ - bundle exec rspec --format progress --format RspecJunitFormatter --out rspec.xml
+ artifacts:
+ when: always
+ paths:
+ - rspec.xml
+ reports:
+ junit:
+ - rspec.xml
gem 'pry-byebug', '~> 3.9'
gem 'pry-rails', '~> 0.3'
gem 'rspec-rails', '~> 5.1'
+ gem 'standard', '~> 1.9'
end
group :production, :test do
gem 'letter_opener', '~> 1.8'
gem 'letter_opener_web', '~> 2.0'
gem 'memory_profiler'
- gem 'rubocop', '~> 1.28', require: false
- gem 'rubocop-rails', '~> 2.14', require: false
gem 'brakeman', '~> 5.2', require: false
gem 'bundler-audit', '~> 0.9', require: false
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.17.0)
parser (>= 3.1.1.0)
- rubocop-rails (2.14.2)
- activesupport (>= 4.2.0)
- rack (>= 1.1)
+ rubocop-performance (1.13.3)
rubocop (>= 1.7.0, < 2.0)
+ rubocop-ast (>= 0.4.0)
ruby-progressbar (1.11.0)
ruby-saml (1.13.0)
nokogiri (>= 1.10.5)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stackprof (0.2.19)
+ standard (1.11.0)
+ rubocop (= 1.28.2)
+ rubocop-performance (= 1.13.3)
statsd-ruby (1.5.0)
stoplight (2.2.1)
strong_migrations (0.7.9)
rspec-rails (~> 5.1)
rspec-sidekiq (~> 3.1)
rspec_junit_formatter (~> 0.5)
- rubocop (~> 1.28)
- rubocop-rails (~> 2.14)
ruby-progressbar (~> 1.11)
sanitize (~> 6.0)
scenic (~> 1.6)
sprockets (~> 3.7.2)
sprockets-rails (~> 3.4)
stackprof
+ standard (~> 1.9)
stoplight (~> 2.2.1)
strong_migrations (~> 0.7)
thor (~> 1.2)