PHP-Parallel-Lint icon indicating copy to clipboard operation
PHP-Parallel-Lint copied to clipboard

Host .phar version

Open realityking opened this issue 9 years ago • 17 comments

Hi there,

parallel-lint is awesome! It's just a tiny bit painful to integrate it into my CI flow. I'd be happy to help you set up a small gh-pages site to host it. Would you be able to keep it updated?

Cheers, Rouven

realityking avatar Jul 11 '16 16:07 realityking

Any reason why it's hard to integrate into CI?

bbashy avatar Oct 04 '16 10:10 bbashy

Do you use Composer?

grogy avatar Oct 04 '16 19:10 grogy

@realityking you probably haven't heard about travis releases:

https://docs.travis-ci.com/user/deployment/releases

i have set it up in few project and now i no longer build release archives myself:

  • https://github.com/eventum/eventum/blob/v3.1.3/.travis.yml#L93
  • https://github.com/eventum/scm/blob/v3.1.2/.travis.yml#L27
  • https://github.com/glensc/nagios-plugin-check_raid/blob/a674c3ef6ffabaa74d314a122339aef21bfe74f6/.travis.yml#L26

glensc avatar Oct 05 '16 14:10 glensc

I agree with glensc that automatic deploy by Travis is good solution and gh-page can only link to latest release.

JakubOnderka avatar Oct 17 '16 18:10 JakubOnderka

perhaps upload the .phar manually to each github releases until it is automated

and use some "fixed" name like "parallel-lint.phar" not "parallel-lint-1.3.1.phar", so you could use in docs such link:

  • https://github.com/JakubOnderka/PHP-Parallel-Lint/archive/latest/parallel-lint.phar
  • https://github.com/JakubOnderka/PHP-Parallel-Lint/releases/download/latest/parallel-lint.phar

i'm not sure which one works as there is no .phar, but such "latest" link redirects properly:

  • https://github.com/JakubOnderka/PHP-Parallel-Lint/releases/latest

glensc avatar Oct 17 '16 18:10 glensc

oh and parallel-lint.phar is not good name (too generic), or do you plan linting other languages too than PHP?

glensc avatar Oct 17 '16 18:10 glensc

PHAR usually requires a great maintenance overhead and different approach to code and debugging itself.

What would be the added value over this?

TomasVotruba avatar Mar 19 '17 01:03 TomasVotruba

@TomasVotruba added value is that your dev dependencies don't pollute your app's real dependencies, so there is less possibility of conflicts between low-level dependencies.

Yesterday I wanted to add PHPStan to project based on Laravel 4.2 which our team took over and I was unable to do that because of conflict on nikic/php-parser (PHPStan requires ~3.0 while Laravel's dependencies locked it with ~1.0). With Phar I can download dev tool with all its dependencies without need to worry about conflicts with libraries used by application.

Today I learned there is https://github.com/tommy-muehle/tooly-composer-script which automates downloading PHAR files for development, so I wanted to check if there is one for parallel lint - so here I am :-)

Wirone avatar Sep 15 '17 11:09 Wirone

Apparently, this is already set up, only there has not been a new release yet. @JakubOnderka Could you please make a dummy release so we could use the PHAR?

jtojnar avatar Dec 06 '17 15:12 jtojnar

I feel there is a natural move towards phar files for dev tools happening in the PHP space, its often for the reason of not having your dev deps clash with your non-dev though as @Wirone stated. You can quickly end up in a situation where either you want to move forward and the tool hasn't.. or the other way around.

If there is automated stuff for this then Id assume the extra work load is minimal? seems like @jtojnar is suggesting all that is required is a release.

gsdevme avatar Feb 08 '18 23:02 gsdevme

also should integrate with https://phar.io/

glensc avatar Oct 01 '18 09:10 glensc

the travis integrfation to build phar on git tag was done in 2016 October:

  • https://github.com/JakubOnderka/PHP-Parallel-Lint/compare/3de48be1dcfc0442421140a040c9697ad21dc6c9...c87e2531d9a9ec7348836b8df98a162ea82a0985

which means 1.0.0 tag has the integration present.

so i looked travis build log for 1.0.0 tag:

  • https://travis-ci.org/JakubOnderka/PHP-Parallel-Lint/jobs/345666647

@JakubOnderka seems your travis key setup is incorrect:

Preparing deploy
/home/travis/.rvm/gems/ruby-2.2.6/gems/octokit-4.6.2/lib/octokit/response/raise_error.rb:16:in `on_complete': GET https://api.github.com/user: 401 - Bad credentials // See: https://developer.github.com/v3 (Octokit::Unauthorized)
...
failed to deploy

so, please recheck what's there wrong and tag 1.0.1 (from the same tag for example)

glensc avatar Oct 01 '18 10:10 glensc

Please provide PHARs for your releases and make them installable with Phive.

sebastianbergmann avatar Apr 12 '19 05:04 sebastianbergmann

While doing this please also consider migrating to https://github.com/humbug/box, which is a maintained version of box, that is not only fast but provides some additional features.

jakzal avatar Apr 23 '19 20:04 jakzal

Modern PHP tools tend to be distributed in PHAR files. Please consider distributing using PHIVE

szepeviktor avatar Jun 01 '19 07:06 szepeviktor

Just FYI - as of version 1.3.0, the PHAR is part of the release assets. See: https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases

Adding support for Phive is on the roadmap to be addressed in the near future: https://github.com/php-parallel-lint/PHP-Parallel-Lint/issues/75

jrfnl avatar Feb 17 '22 02:02 jrfnl

Posting this just in case it's useful to anybody else, I automated downloading the latest released phar file with the following bash function:

##############################################################################
# Downloads a phar file from the latest release of a GitHub project.
# Arguments:
#   A github.com project url (e.g. "https://github.com/php-parallel-lint/PHP-Parallel-Lint")
##############################################################################
download_phar_release_github() {
    local -r github_url="$1"
    local api_url download_url phar_filename phar_path
    api_url=$(echo "${github_url}" | sed -e "s|github.com|api.github.com/repos|g")/releases/latest
    download_url=$(curl -s "${api_url}" | grep -m 1 "browser_download_url.*phar" | cut -d : -f 2,3 | xargs)
    phar_filename=$(basename "${download_url}")
    phar_path="tools/${phar_filename%.*}"

    echo "Downloading ${download_url} to ${phar_path}..."
    curl -s -L -o "${phar_path}" "${download_url}"
    chmod u+x "${phar_path}"
}

download_phar_release_github https://github.com/php-parallel-lint/PHP-Parallel-Lint

pereorga avatar Feb 07 '23 22:02 pereorga