Skip to content

Commit

Permalink
Fix issue with MySQL server
Browse files Browse the repository at this point in the history
  • Loading branch information
mechanicles committed Aug 5, 2023
1 parent 7846db0 commit 8439441
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,28 @@ jobs:

services:
postgres:
image: postgres:12.1-alpine
image: postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:latest
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_ROOT_PASSWORD: password
ports:
- 3306:3306
- 32574:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Show postgres version
run: psql -h localhost -U postgres -d postgres -c 'SHOW server_version'

- name: Checkout code
uses: actions/checkout@v2

Expand All @@ -38,21 +48,26 @@ jobs:
- name: Install dependencies
run: bundle install

- name: Set up Code Climate Test Reporter
- name: Start PostgreSQL service
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
docker-compose up -d postgres
sleep 5 # Wait for a few seconds for the PostgreSQL server to start
- name: Create MySQL and PostgreSQL databases
run: |
mysql -u root -e "CREATE DATABASE set_as_primary_test;"
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
sudo apt-get install -y mysql-client
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "CREATE DATABASE set_as_primary_test;"
createdb set_as_primary_test
- name: Run tests
run: bundle exec rake

- name: Set up Code Climate Test Reporter
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Upload test coverage results to Code Climate
if: always() && ${{ github.ref == 'refs/heads/master' }} # Adjust the branch name if needed
run: ./cc-test-reporter after-build --debug --exit-code ${{ job.status }}
run: ./cc-test-reporter after-build --debug --exit-code ${{ job.status }}

0 comments on commit 8439441

Please sign in to comment.