Skip to content

Commit

Permalink
Merge pull request #3 from unipept/feature/test-action
Browse files Browse the repository at this point in the history
Add GitHub action for tests
  • Loading branch information
pverscha authored Mar 14, 2023
2 parents 4f861ca + 3c0e018 commit 872c6fe
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Ruby
name: Lint

on: [push]

Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test

on: [push]

jobs:
test:
env:
RAILS_ENV: "test"
TEST_DATABASE_URL: "mysql2://root:[email protected]:3306/unipept_test"
runs-on: ubuntu-latest
services:
mysql:
image: mariadb:10.9
env:
MYSQL_DATABASE: "unipept_test"
MYSQL_ROOT_PASSWORD: "unipept"
MYSQL_HOST: "localhost"
ports:
- 3306:3306
options: --health-cmd "mysqladmin ping -h localhost" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Use ruby from .ruby-version
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run tests
run: |
bundle exec rails db:test:prepare
bundle exec rails test
2 changes: 1 addition & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ development:
test:
<<: *default
database: unipept_test
socket: /tmp/mysql.sock
url: <%= ENV['TEST_DATABASE_URL'] || ENV['DATABASE_URL'] %>

production:
<<: *default
Expand Down

0 comments on commit 872c6fe

Please sign in to comment.