once more #16
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: CI | |
on: | |
push: | |
branches: | |
- DR-3256-migrate-ci-to-gh-actions | |
- qa | |
- nypl-dams-prod | |
pull_request: | |
branches: | |
- qa | |
- nypl-dams-prod | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST_AUTH_METHOD: trust | |
options: >- | |
--health-cmd="pg_isready -U postgres" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=5 | |
ports: | |
- 5432:5432 | |
mysql: | |
image: mysql:5.6 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: "yes" | |
options: >- | |
--health-cmd="mysqladmin ping --silent" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=10 | |
ports: | |
- 3306:3306 | |
env: | |
RAILS_ENV: test | |
IMAGE_FILESTORE_DATABASE_NAME: image_filestore_test | |
AMI_FILESTORE_DATABASE_NAME: ami_filestore_test | |
IMAGE_FILESTORE_DATABASE_USER: root | |
AMI_FILESTORE_DATABASE_USER: root | |
# DATABASE_USERNAME: root | |
#DATABASE_PASSWORD: "" # Empty password | |
#DATABASE_HOST: 127.0.0.1 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3.3 | |
bundler-cache: true | |
- name: Update RubyGems and install Bundler | |
run: | | |
gem update --system '3.3.22' | |
gem install bundler -v '2.5.18' | |
- name: Wait for Database Services | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y postgresql-client mysql-client | |
until pg_isready -h localhost -U postgres; do echo "Waiting for PostgreSQL..."; sleep 1; done | |
until mysqladmin ping --silent; do echo "Waiting for MySQL..."; sleep 1; done | |
- name: Set up Databases | |
run: | | |
psql -U postgres -c 'create database fedora_ingest_rails_test;' | |
mysql -uroot -e 'CREATE DATABASE ami_filestore_test; CREATE DATABASE image_filestore_test' | |
mysql -uroot ami_filestore_test < ./db/resources/ami_filestore_schema.sql | |
mysql -uroot image_filestore_test < ./db/resources/image_filestore_schema.sql | |
- name: Run Tests | |
run: | | |
bundle exec rspec | |