Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Set up a GitHub Actions workflow #5

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

TravisCarden
Copy link
Collaborator

@TravisCarden TravisCarden commented Mar 28, 2024


  • Build the project the way it would be used in real life (via composer create-project, not just composer install)
  • Test against PHP 8.1, 8.2, and 8.3
  • Also against Ubuntu (macOS and Windows deferred to a follow-up)
  • Run automatically...
    • every 12 hours
    • on pushes to main and wip
    • on PRs to main and develop
    • when triggered manually
  • The web directory should be served by Apache

Notes

  • Per discussion with you, macOS and Windows support have been deferred to an as-yet unprioritized follow-up issue.
  • I configured it to run on pushes and pull requests, even though that wasn't explicitly in the requirements, because it seemed obvious and I assume you would want it.
  • This doesn't install Nightwatch or any supplementary testing requirements, as they weren't in the success criteria. Obviously, they can be added in follow-ups as necessary.
  • I assume that Apache is multi-threaded by default, but I haven't confirmed it. I don't know, for example, if it has to have the MPM worker specifically enabled. Unless you know the answer, I'll check on it (or it will become evident as soon as you try to do something in the build that requires it). This will be deferred to a follow-up, depending on whether it turns out to actually be an issue.

@TravisCarden TravisCarden added the tests Needs test coverage, or related to CI label Mar 28, 2024
@TravisCarden TravisCarden added this to the DrupalCon milestone Mar 28, 2024
@TravisCarden TravisCarden linked an issue Apr 11, 2024 that may be closed by this pull request
@TravisCarden TravisCarden marked this pull request as ready for review April 11, 2024 16:43
.github/workflows/main.yml Outdated Show resolved Hide resolved
.github/workflows/main.yml Show resolved Hide resolved
@TravisCarden TravisCarden force-pushed the feature/github-actions branch 5 times, most recently from cf2c092 to 8b699c1 Compare April 15, 2024 17:07
@TravisCarden TravisCarden deleted the branch phenaproxima:main April 15, 2024 19:26
@TravisCarden TravisCarden deleted the feature/github-actions branch April 15, 2024 19:27
@TravisCarden TravisCarden restored the feature/github-actions branch April 15, 2024 19:30
@TravisCarden TravisCarden deleted the feature/github-actions branch April 15, 2024 19:30
@TravisCarden TravisCarden restored the feature/github-actions branch April 15, 2024 19:30
@TravisCarden TravisCarden reopened this Apr 15, 2024
@TravisCarden TravisCarden changed the base branch from develop to main April 15, 2024 19:31
@TravisCarden TravisCarden force-pushed the feature/github-actions branch 3 times, most recently from e48f66c to b8a918d Compare April 15, 2024 21:22
@TravisCarden
Copy link
Collaborator Author

@phenaproxima this is done except for one thing that I don't know whether it's on the application side or the CI config side:

PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database

I've identified the database file created by creating the project (/var/www/web/db.sqlite) and set it to mode 0777 without any effect. What are your thoughts?

@TravisCarden
Copy link
Collaborator Author

TravisCarden commented Apr 19, 2024

@phenaproxima I rebased onto main. New problem:

$ composer create-project, etc...

...

Error: Hash mismatch for patch downloaded from https://git.drupalcode.org/project/distributions_recipes/-/raw/patch/recipe-10.3.x.patch
4f134408e250a2dfce06657a8e4f1b642c1081b1d4c66ce051dd8238e102036c; expected 88d4e6e1d0006d143ee6c8e16e143b39f3b70f61dd4985c32aa0423b2473d066

I can reproduce it locally, so it seems like it's an actual issue in the application.

@phenaproxima
Copy link
Owner

phenaproxima commented Apr 19, 2024

Yeah...we get that when the upstream patch changes but our patches.lock.json doesn't adjust. See what happens if you remove and gitignore patches.lock.json...?

@TravisCarden
Copy link
Collaborator Author

That doesn't seem to make any difference, @phenaproxima.

@TravisCarden TravisCarden force-pushed the feature/github-actions branch 3 times, most recently from a1d8612 to 2258021 Compare April 23, 2024 02:03
@TravisCarden
Copy link
Collaborator Author

The patches.lock.json problems went away after I rebased onto main. Running composer patches-relock causes a new and different problem, so I'm going to ignore it for now.

@TravisCarden TravisCarden force-pushed the feature/github-actions branch 8 times, most recently from b828b07 to 5b05331 Compare April 23, 2024 04:02
@TravisCarden
Copy link
Collaborator Author

@phenaproxima I'm still getting the same error trying to load the site after it's installed:

The website encountered an unexpected error. Try again later.
PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in Drupal\Component\DependencyInjection\PhpArrayContainer->createService() (line 77 of /var/www/web/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php).

Unfortunately, I'm having an unrelated problem with the build on this PR, but you can see the problem on the wip branch: https://github.com/phenaproxima/drupal-suite/actions/runs/8794640443/job/24134418742

Any ideas while I work on the PR build problem?

@phenaproxima
Copy link
Owner

So about that SQLite error -- a quick search reveals https://stackoverflow.com/questions/3319112/sqlite-error-attempt-to-write-a-readonly-database-during-insert:

The problem, as it turns out, is that the PDO SQLite driver requires that if you are going to do a write operation (INSERT,UPDATE,DELETE,DROP, etc), then the folder the database resides in must have write permissions, as well as the actual database file.

@phenaproxima
Copy link
Owner

phenaproxima commented Apr 23, 2024

I've created a way around this, I think. (It's in main now, so you'll need to rebase again.)

First, let's use MySQL on CI, instead of SQLite, since it seems to be problem-prone. Pretty sure you can easily do that with GitHub Actions' Docker integration.

What you'll need to do (pseudocode):

composer create-project --no-install ....
cd project
./vendor/bin/yaml-cli update:value ./drush/drush.yml command.site.install.options.db-url "mysql://user:password@server/dbname"
composer install
composer drupal:install

(This way, you can also remove the test -n "$CI" stuff from post-create-project-cmd, which will make it more portable.)

Drush requires grasmash/yaml-cli, but if it'll make you feel better, go ahead and add it as a direct dev dependency.

To me, this is absolutely good enough.

@TravisCarden TravisCarden force-pushed the feature/github-actions branch 5 times, most recently from c4c80f8 to bc1fb8b Compare April 24, 2024 17:42
@TravisCarden
Copy link
Collaborator Author

@phenaproxima we have a working PR now. It doesn't do everything the way we (you) want, but it's fully functional, and it catches the main issues we tend to encounter. I propose you merge it as-is so we start getting the benefit, and we can iterate on it as we choose.

@phenaproxima phenaproxima merged commit 920c442 into phenaproxima:main Apr 26, 2024
3 checks passed
@phenaproxima
Copy link
Owner

Yeah, I agree. Let's just merge it and sally forth bravely!

@phenaproxima
Copy link
Owner

Welp, it's failing: https://github.com/phenaproxima/drupal-suite/actions/runs/8851596378. Can you fix? 🙏

@TravisCarden TravisCarden deleted the feature/github-actions branch May 22, 2024 14:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tests Needs test coverage, or related to CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set up a GitHub Actions workflow
2 participants