Thanks to @GuiFalourd and further research and testing I found out the following.
Regular Ubuntu machine in GitHub actions uses only 2 cores.
Parallel testing using php artisan test --parallel
creates as many test databases as cores the first time it runs and executes the migrations on each one of them. It does this to avoid deadlocks and other issues between concurrent tests. If you have many migrations it could be slower to use parallel testing in a CI pipeline because databases are not persisted between runs and migrations occur on every run for every process.
Solution: You can squash your migrations into a mysql dump, to avoid the time consuming migrations.
Performance benefits with parallel testing using GitHub actions will not be great, since it would only use 2 cores/processes, but it should be faster than without if you avoid the migrations step by squashing them.