Fix CI tests and add github workflows #1
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: CI tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| tests: | |
| name: Rails CI Tests | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql-container: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: somepassword | |
| ports: | |
| - "3306:3306" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.3.7" | |
| bundler-cache: true | |
| - name: Install dependencies | |
| run: | | |
| curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - | |
| echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list | |
| apt-get update && apt-get -yqq install imagemagick yarn libzstd-dev libmysqlclient-dev | |
| bundle install --jobs 4 --retry 3 | |
| - name: Run Tests | |
| env: | |
| RAILS_ENV: test | |
| run: | | |
| cp config/database.ci.yml config/database.yml | |
| bundle exec rails db:prepare | |
| bundle exec rails test |