We're using version 13 because it's the one included in Debian Bullseye, which is the operating system we currently use in our Dockerfile. For consistency, we're using the same version in GitHub Actions. Note this image requires setting a password. Otherwise we get an error: > Database is uninitialized and superuser password is not specified. > You must specify POSTGRES_PASSWORD to a non-empty value for the > superuser. For example, "-e POSTGRES_PASSWORD=password" on > "docker run". Since now we're setting a password in the postgres service, we also need to provide the `PGPASSWORD` environment variable (or to specify the password in the `database.yml` file, which we do for GitLab since it uses a separate database configuration file). Otherwise we get an error: ``` PG::ConnectionBad: connection to server at "::1", port 5432 failed: fe_sendauth: no password supplied (PG::ConnectionBad) ```
52 lines
1.3 KiB
YAML
52 lines
1.3 KiB
YAML
stages:
|
|
- test
|
|
- lint
|
|
|
|
tests:
|
|
image: "ruby:3.2.5"
|
|
stage: test
|
|
services:
|
|
- postgres:13.16
|
|
cache:
|
|
key: consul
|
|
paths:
|
|
- vendor/
|
|
variables:
|
|
POSTGRES_USER: consul
|
|
POSTGRES_PASSWORD: password
|
|
RAILS_ENV: test
|
|
TEST_COVERAGE: 1
|
|
parallel: 5
|
|
script:
|
|
- apt-get update && apt-get install -y nodejs npm chromium
|
|
- for i in config/*.example; do cp "$i" "${i/.example}"; done
|
|
- for i in config/*.gitlab; do cp "$i" "${i/.gitlab}"; done
|
|
- bundle --without development
|
|
- npm clean-install
|
|
- bundle exec rake db:setup
|
|
- bundle exec rake assets:precompile > /dev/null 2>&1
|
|
- bin/knapsack_pro_rspec
|
|
artifacts:
|
|
when: on_failure
|
|
paths:
|
|
- tmp/screenshots/
|
|
|
|
# To make this job work, create a Personal Access Token with permissions
|
|
# to comment on your repository and add a variable named
|
|
# PRONTO_GITLAB_API_PRIVATE_TOKEN to your repository CI/CD settings
|
|
# giving it the value of the Personal Access Token
|
|
linters:
|
|
image: "ruby:3.2.5"
|
|
stage: lint
|
|
cache:
|
|
key: consul
|
|
paths:
|
|
- vendor/
|
|
only:
|
|
- merge_requests
|
|
script:
|
|
- apt-get update && apt-get install -y nodejs cmake pkg-config
|
|
- bundle --without test
|
|
- git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
|
|
- bundle exec pronto run -f gitlab_mr -c origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
|