Skip to content

Commit

Permalink
simplify ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Aug 9, 2024
1 parent ee3cacd commit 20cee01
Showing 1 changed file with 13 additions and 34 deletions.
47 changes: 13 additions & 34 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches:
- master
concurrency:
group: ${{github.workflow}}-${{github.event.pull_request.number || github.ref}}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -21,11 +24,6 @@ jobs:
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
options: >-
--health-cmd "mysqladmin ping --silent"
--health-interval 10s
--health-timeout 5s
--health-retries 10
postgres:
image: postgres:14
ports:
Expand All @@ -34,11 +32,6 @@ jobs:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -47,33 +40,19 @@ jobs:
with:
ruby-version: ${{matrix.ruby}}
bundler-cache: true
- name: Setup database configuration
- name: Setup database
run: |
case ${{matrix.database}} in
sqlite)
echo "DATABASE_URL=sqlite3::memory:" >> $GITHUB_ENV
;;
mysql)
echo "DATABASE_URL=mysql2://root:root@localhost/test" >> $GITHUB_ENV
;;
postgres)
echo "DATABASE_URL=postgres://postgres:postgres@localhost/test" >> $GITHUB_ENV
;;
sqlite)
echo "DATABASE_URL=sqlite3::memory:" >> $GITHUB_ENV
;;
mysql)
echo "DATABASE_URL=mysql2://root:root@localhost/test" >> $GITHUB_ENV
;;
postgres)
echo "DATABASE_URL=postgres://postgres:postgres@localhost/test" >> $GITHUB_ENV
;;
esac
- name: Wait for MySQL
if: matrix.database == 'mysql'
run: |
until mysqladmin ping -h"localhost" --silent; do
echo "Waiting for MySQL to be ready..."
sleep 1
done
- name: Wait for Postgres
if: matrix.database == 'postgres'
run: |
until pg_isready -h "localhost" -U "postgres"; do
echo "Waiting for Postgres to be ready..."
sleep 1
done
- name: Test
run: bundle exec rake test
# sqlite is not supported yet because it doesn't support
Expand Down

0 comments on commit 20cee01

Please sign in to comment.