Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Github Actions #293

Merged
merged 4 commits into from
Oct 26, 2021
Merged

Add Github Actions #293

merged 4 commits into from
Oct 26, 2021

Conversation

danon
Copy link
Member

@danon danon commented May 5, 2021

Rationale:

As long as they both work, you can keep them both, to see which do you prefer.

PR Overview:

  • I used docker images for databases:
    • For MySQL: hub.docker.com/mysql:8
    • For PostgreSQL: hub.docker.com/postgres:10.0
    • Probably using alpine images or different versions will be easy. Just edit image field.
    • Databases are seeded from proper file from test/test-db/recreate_schema.sql
    • Both of them use db:ouzo_test and creds:ouzo_user/password
    • Fun note: Github configuration is 1:1 docker params. So you can recreate the workflow locally 1:1 (if you have docker). The results in the Github Actions were exactly the same as I had them using docker and phpunit locally.
    • You can't do mysql/psql, you must do mysql -h 127.0.0.1, psql -h 127.0.0.1 (or localhost). You must do the same if you run mysql/postgres in docker locally - another reason why ghActions is 1:1 local docker.
  • I recreated the matrix from Travis (['PHP 8.0.0', 'PHP 8.0.1'] x ['MySQL', 'PostgreSQL', 'SQLite'])
  • I used actions/cache@v1 action, so that composer dependencies aren't loaded each time (speeds up the build)
  • ./vendor/bin/php-coveralls is run at the end of the workflow, so coverage can be used by coveralls
  • I used echo | sqlite to seed SQLite base, because sqlite db -init file.sql opened prompt for stdin, so.
  • I tried to seed the MySQL database as ouzo_user user, but I was getting error, failing at CREATE FUNCTION get_name, line 39:
    You do not have the SUPER Privilege and Binary Logging is Enabled
    
    so I used superuser -u root -ppassword to seed it. Perhaps there's a way to seed and create function as a regular user, but I didn't find it.
  • phpunit is run with proper db env variable required by config/test/config.php, as well as proper @group
    matrix:
      php: [ '8.0.0', '8.0.1' ]
      db: [ 'MySQL', 'PostgreSQL', 'SQLite' ]
      include:
        - db: MySQL
          phpunitArgs: "--exclude-group postgres,sqlite3"
          phpunitEnv: db=mysql # from config/test/config.php
        - db: PostgreSQL
          phpunitArgs: "--exclude-group mysql,sqlite3"
          phpunitEnv: db=postgres # from config/test/config.php
        - db: SQLite
          phpunitArgs: "--exclude-group mysql,postgres,non-sqlite3"
          phpunitEnv: db=sqlite3 # from config/test/config.php
  • I added a badge for the build in ReadMe.me
    image

@danon danon requested review from piotrooo and bbankowski May 5, 2021 14:14
@danon danon self-assigned this May 5, 2021
@danon danon changed the title Migrate from Travis CI to Gihub Actions Migrate from Travis CI to Github Actions May 5, 2021
@danon danon force-pushed the github-actions branch 2 times, most recently from e1a03ed to 861218b Compare May 15, 2021 18:58
@danon danon changed the title Migrate from Travis CI to Github Actions Add Github Actions May 15, 2021
@bbankowski
Copy link
Member

Looks good, thanks @danon!

@danon
Copy link
Member Author

danon commented Oct 27, 2021

@bbankowski If you decide to stop using Travis, just revert the last commit in this PR, 1b262bb

@danon danon deleted the github-actions branch December 15, 2021 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants