Dalle feature #1727
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: Ruby on Rails CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }}-test | |
cancel-in-progress: true | |
timeout-minutes: 2 | |
services: | |
postgres: | |
image: postgres:16.1 | |
ports: | |
- "5432:5432" | |
env: | |
POSTGRES_DB: hostedgpt_test | |
POSTGRES_USER: rails | |
POSTGRES_PASSWORD: password | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
RAILS_ENV: test | |
DATABASE_URL: "postgres://rails:password@localhost:5432/hostedgpt_test" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Set up database schema | |
run: bin/rails db:prepare | |
- name: Build CSS | |
run: bin/rails tailwindcss:build | |
- name: Run tests | |
run: bin/rails test | |
system_tests: | |
if: github.repository == 'AllYourBot/hostedgpt' | |
runs-on: large-runner | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }}-system | |
cancel-in-progress: true | |
services: | |
postgres: | |
image: postgres:16.1 | |
ports: | |
- "5432:5432" | |
env: | |
POSTGRES_DB: hostedgpt_test | |
POSTGRES_USER: rails | |
POSTGRES_PASSWORD: password | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
RAILS_ENV: test | |
DATABASE_URL: "postgres://rails:password@localhost:5432/hostedgpt_test" | |
DISPLAY: "=:99" | |
CHROME_VERSION: "127.0.6533.119" | |
steps: | |
- name: Install Chrome | |
run: | | |
# Download specific Chrome version | |
wget https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}-1_amd64.deb | |
# Install Chrome | |
sudo apt-get install -y --allow-downgrades ./google-chrome-stable_${CHROME_VERSION}-1_amd64.deb | |
- uses: nanasess/setup-chromedriver@v2 | |
- name: Start chromedriver | |
run: | | |
set -x | |
chromedriver --url-base=/wd/hub & | |
# sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Set up database schema | |
run: bin/rails db:prepare | |
- name: Build CSS | |
run: bin/rails tailwindcss:build | |
- name: Run system tests | |
run: | | |
echo -e "###\n###\n###\n### NOTICE: If these tests fail because of Net::ReadTimeout then re-run the test suite. I can't figure out this sporadic failure.\n###\n###\n###" | |
sed -i 's/hoverOnlyWhenSupported: true/hoverOnlyWhenSupported: false/' config/tailwind.config.js | |
PARALLEL_WORKERS=2 bin/rails test:system | |
- name: Upload screenshots | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: System Test Screenshots | |
path: tmp/screenshots/ | |
if-no-files-found: ignore | |
lint: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }}-lint | |
cancel-in-progress: true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Lint Ruby files | |
run: bin/rubocop |