I use a CI pipline runner called Drone.
We push to drone and it runs our tests then publishes an artifact.
That could be an NPM package, a new version of an app, or a Docker image.
How can I do this with a PHP Composer package. It seems composer publishes pacakges of git tags. Usually a normal workflow is to tag a version and CI picks up that tag and attempts to publish it on the package registry .... with composer it just runs off git tags so I could have a git tag that fails CI but is published on composer... thats CRAZY!
Related
We have git repositories that are Composer, php packages.
To publish a new version of one of these Composer packages on https://packagist.org we currently do the following:
Create a new git tag such as v1.0.0 and push it.
Travis-CI picks up this change and runs our tests.
Packagist (composer) also picks the new tag and auto-magically publishes a new version v1.0.0
The issues we have with this workflow is:
If the tests fail, there a broken version of our package is published.
A PR workflow would alleviate this, although not totally.
Most package mangers such as NPM; have release/publish functionality.
Creating a PR and only merging into master on passing builds is great. Although it still allows maintainers to release versions from master that do not pass CI, if they forego the PR workflow.
I have a minishift instance running on my laptop. I am running a Laravel app on it and it's configured to use a private git repository (a copy of repo is present on my laptop from where I push the changes to the git repository). Now my question is
How do I compile assets on it using laravel mix after I make CSS changes on my local repository and push them to the git repo?
Till now I have tried to:
Run npm dev by logging in to minishift using SSH. But it gives the error npm not installed.
The npm package was added to the S2I base image only recently, it may not have got through to official images yet if using the Minishift from the CDK. It should have got through to CentOS based builder images that would be used by Origin based Minishift.
https://github.com/sclorg/s2i-base-container/issues/115
Where did you get Minishift from and what version?
I have a Laravel 5.1 application that I've built a couple of custom packages inside of (I follow this tutorial). These packages have no dependencies that didn't already exist in the root Laravel app.
My first question is, if I needed to add a dependency to the package that wasn't already in the root app, how would it get pulled into the root app? Running composer update or composer install from the root application does not pull them in. I understand that once I publish to GitHub and later pull the package into my app with Composer, that it's dependencies will pull in...but how do I do it while developing?
My next question is, how do I go about creating automated tests for this package? None of the tutorials I've found address this. Should the package be in it's own instance of Laravel with the tests inside of the tests directory?
To pull in dependencies for your own package, you will need to navigate to your package root (not your application root) and run the composer update and composer install commands from there. That should create a vendor directory local to your package which will contain all dependencies declared in your package's composer.json.
The same goes for testing - you can create a tests directory local to your package inside the larger Laravel app and run your tests from the package root. Just make sure to include your testing dependencies inside your package's composer.json.
I have a Neos project, consisting of a Site providing the main composer container. composer.json requires a huge number of packages (whole neos/flow environment), including some packages we develop.
Our deployment setup consists of Jenkins, building the css/javascript for both the site and plugin packages (only within their specific gits) and finally triggering TYPO3 Surf, which actually calls composer install and then rsync's to the server.
Right now, each time we want some changes in our dev branch to be deployed to the testing environment, we have to manually cd to the main composer directory, do a
composer update vendor/package && git add composer.lock && git commit -m "update composer.lock"`.
Is there anyway to always use the newest version of our plugin package with composer? Perhaps excluding the requirement from composer.lock, or just changing it without installing the actual packages.
For a continuous deployment to a testing server you could just make jenkins do a composer update and with your packages set to dev/master in the composer.json.
I want to use the autoloader generated by composer for my unit tests to load classes automatically.
Now I don't know if I should commit my vendor directory to my git repo. A pro is that everyone who clones my repo immediately can run the phpUnit tests. A con is that I ship a lot of proprietary code with my repo.
Should I insist that the user who clones my repo has to run composer install first and therefor has to have composer "installed"?
Is it a solution to don't commit vendor directory into my git repo but pack it into a release branch so that my application runs out of the box?
The official recommendation is to ignore vendor/:
Tip: If you are using git for your project, you probably want to add vendor into your .gitignore. You really don't want to add all of that code to your repository.
Make sure to include both your composer.json and composer.lock files, though.