- Setup Digital OceanDroplet
- Install Jenkins and required plugins
- Configure Github to work with Jenkins
- Set up PHP project
- Add Psalm to project
- Noteworthy Psalm Features
- Use referral link
- Follow through Instructions
- Create a droplet
- Get droplet instructions in email account
- Connect to droplet
- Install PHP by running
sudo apt update
sudo apt install php
- Install Composer
- Here is a concise guide on setting up Jenkins to Listen for pull requests on a Github Repo
The steps from the above help you set up a Jenkins Job, And also Configure the Job.
Configuring Psalm to Work with Demo locally
composer require --dev vimeo/psalm
- Add a psalm.xml file to Project root folder
- This can be achieved by running
./vendor/bin/psalm --init
- This can be achieved by running
- See Project errors
./vendor/bin/psalm --show-info=true
Configuring Psalm to Work with Demo on Jenkins
- Push psalm config files to demo repo
Now you can Add a build Step so Jenkins can install required Dependencies for Psalm, as well as run psalm static analysis on the demo project
composer require --dev vimeo/psalm
./vendor/bin/psalm --show-info=true
Working with Legacy Codebases
Psalm baseline feature allows us to grandfather errors already existing in the demo, while checking for new errors arising from subsequent PR's after its installation.
- This can be achieved by running
./vendor/bin/psalm --set-baseline=psalmbaseline.xml
-
--threads=10
This increases analysis speed as it utilizes 10 threads instead of one
-
--show-info=false
Ensures that only error messages are returned by Psalm and not info warnings, this keeps the output clean
-
--debug-by-line
Very useful to trace line causing Psalm to fail, this makes fixing easy
-
--config=psalm.xml
Set path to Psalm.xml in case you intend to put the config file outside the root directory
Handy PR comments for GithubPR builder
- "ok to test" to accept this pull request for testing
- "test this please" for a one time test run
- "add to whitelist" to add the author to the whitelist