update copyright #4
This file contains hidden or 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: CodeToQuery CI | |
| on: | |
| push: | |
| branches: [ "main", "master" ] | |
| pull_request: | |
| branches: [ "main", "master" ] | |
| jobs: | |
| test_postgres: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:13 | |
| env: | |
| POSTGRES_DB: code_to_query_test | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: secret | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby-version: ["3.0", "3.1", "3.2", "3.3"] | |
| ar-gemfile: ["activerecord7.0", "activerecord7.1", "activerecord7.2"] | |
| exclude: | |
| - ruby-version: "3.0" | |
| ar-gemfile: "activerecord7.2" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby-version }} | |
| bundler-cache: true | |
| - name: Install dependencies | |
| run: | | |
| cp gemfiles/Gemfile.${{ matrix.ar-gemfile }} Gemfile | |
| bundle install --jobs 4 --retry 3 | |
| - name: Wait for Postgres | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y postgresql-client | |
| for i in {1..10}; do | |
| pg_isready -h localhost -p 5432 -U postgres && break | |
| echo "Waiting for postgres..." | |
| sleep 5 | |
| done | |
| - name: Create test DB (Postgres) | |
| run: | | |
| psql -h localhost -U postgres -c "CREATE DATABASE code_to_query_test;" || true | |
| - name: Prepare DB env (Postgres) | |
| run: | | |
| echo "DB_ADAPTER=postgresql" >> $GITHUB_ENV | |
| echo "DB_HOST=localhost" >> $GITHUB_ENV | |
| echo "DB_USER=postgres" >> $GITHUB_ENV | |
| echo "DB_PASSWORD=secret" >> $GITHUB_ENV | |
| echo "DB_DATABASE=code_to_query_test" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: bundle exec rspec | |
| - name: Run RuboCop | |
| run: bundle exec rubocop | |
| test_mysql: | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:8 | |
| env: | |
| MYSQL_DATABASE: code_to_query_test | |
| MYSQL_ROOT_PASSWORD: secret | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd "mysqladmin ping -h 127.0.0.1 --password=secret" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby-version: ["3.0", "3.1", "3.2", "3.3"] | |
| ar-gemfile: ["activerecord7.0", "activerecord7.1", "activerecord7.2"] | |
| exclude: | |
| - ruby-version: "3.0" | |
| ar-gemfile: "activerecord7.2" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby-version }} | |
| bundler-cache: true | |
| - name: Install dependencies | |
| run: | | |
| cp gemfiles/Gemfile.${{ matrix.ar-gemfile }} Gemfile | |
| bundle install --jobs 4 --retry 3 | |
| - name: Wait for MySQL | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y mysql-client | |
| for i in {1..10}; do | |
| mysqladmin ping -h 127.0.0.1 --password=secret && break | |
| echo "Waiting for mysql..." | |
| sleep 5 | |
| done | |
| - name: Create test DB (MySQL) | |
| run: | | |
| mysql -h 127.0.0.1 -uroot -psecret -e "CREATE DATABASE IF NOT EXISTS code_to_query_test" | |
| - name: Prepare DB env (MySQL) | |
| run: | | |
| echo "DB_ADAPTER=mysql2" >> $GITHUB_ENV | |
| echo "DB_HOST=127.0.0.1" >> $GITHUB_ENV | |
| echo "DB_USER=root" >> $GITHUB_ENV | |
| echo "DB_PASSWORD=secret" >> $GITHUB_ENV | |
| echo "DB_DATABASE=code_to_query_test" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: bundle exec rspec | |
| - name: Run RuboCop | |
| run: bundle exec rubocop | |
| test_sqlite: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby-version: ["3.0", "3.1", "3.2", "3.3"] | |
| ar-gemfile: ["activerecord7.0", "activerecord7.1", "activerecord7.2"] | |
| exclude: | |
| - ruby-version: "3.0" | |
| ar-gemfile: "activerecord7.2" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby-version }} | |
| bundler-cache: true | |
| - name: Install dependencies | |
| run: | | |
| cp gemfiles/Gemfile.${{ matrix.ar-gemfile }} Gemfile | |
| bundle install --jobs 4 --retry 3 | |
| - name: Prepare DB env (SQLite) | |
| run: | | |
| echo "DB_ADAPTER=sqlite3" >> $GITHUB_ENV | |
| echo "DB_DATABASE=:memory:" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: bundle exec rspec | |
| - name: Run RuboCop | |
| run: bundle exec rubocop |