[DRH-135] Cleaning up #27
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: [push, pull_request] | |
jobs: | |
tests: | |
name: Tests | |
runs-on: ubuntu-20.04 | |
env: | |
RAILS_ENV: test | |
TERM: dumb-color | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_USER: seek | |
POSTGRES_DB: seek_test | |
POSTGRES_PASSWORD: test | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_USER: seek | |
MYSQL_PASSWORD: test | |
MYSQL_DATABASE: seek_test | |
MYSQL_ROOT_PASSWORD: test | |
ports: | |
- 33306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
virtuoso: | |
image: tenforce/virtuoso | |
env: | |
DBA_PASSWORD: tester | |
SPARQL_UPDATE: true | |
DEFAULT_GRAPH: http://www.example.com/my-graph | |
ports: | |
- 8890:8890 | |
- 1111:1111 | |
strategy: | |
fail-fast: false | |
matrix: | |
database: | |
- mysql | |
suite: | |
- rails test test/unit | |
- rails test test/functional | |
- rails test test/integration | |
- rspec spec | |
# - rake teaspoon | |
- rake assets:precompile | |
- rake db:setup | |
- rake db:migrate | |
- rake seek:upgrade | |
include: | |
- database: postgres | |
suite: rails test test/unit | |
- database: sqlite3 | |
suite: rails test test/unit | |
steps: | |
- name: Install system dependencies | |
run: | | |
sudo apt install -y software-properties-common | |
sudo add-apt-repository ppa:deadsnakes/ppa | |
sudo apt update | |
sudo apt install -y graphicsmagick graphviz libcurl4-gnutls-dev libreoffice poppler-utils build-essential \ | |
git imagemagick libgmp-dev python3.9-dev python3.9-distutils python3-pip | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' # The JDK version to make available on the path. | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
# This path is specific to Ubuntu | |
path: ~/.cache/pip | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: Install Python dependencies | |
run: | | |
python3.9 -m pip install setuptools==58 | |
python3.9 -m pip install -r requirements.txt | |
- name: Create test database | |
run: | | |
cp test/config/database.github.${{ matrix.database }}.yml config/database.yml | |
bundle exec rake db:create | |
- name: Set MySQL char set and collation | |
if: matrix.database == 'mysql' | |
run: echo -e "ALTER DATABASE seek_test CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\n" | bundle exec rails dbconsole -p | |
- name: Checkout previous schema | |
if: github.event_name == 'push' && matrix.suite == 'rake db:migrate' && github.event.before != '0000000000000000000000000000000000000000' | |
run: | | |
git fetch origin ${{ github.event.before }} | |
git checkout ${{ github.event.before }} -- db/schema.rb | |
- name: Load test database schema | |
run: bundle exec rake db:schema:load | |
- name: Seed database | |
if: matrix.suite == 'rake seek:upgrade' | |
run: bundle exec rake db:seed | |
- name: Virtuoso config | |
if: matrix.suite == 'rails test test/integration' | |
run: cp test/config/virtuoso_test_settings.yml config/virtuoso_settings.yml | |
- name: Run tests | |
run: bundle exec ${{ matrix.suite }} |