Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation of PHAR using Nix, in a reproducible environment #754

Merged
merged 19 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
/.gitignore export-ignore
/box.json.dist export-ignore
/build-phar.sh export-ignore
/composer.lock export-ignore
drupol marked this conversation as resolved.
Show resolved Hide resolved
/infection.json.dist
/phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
Expand Down
34 changes: 5 additions & 29 deletions .github/workflows/release-phar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,12 @@ jobs:
- name: "Checkout"
uses: "actions/checkout@v3"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
- uses: DeterminateSystems/nix-installer-action@v9

- name: "Cache dependencies"
uses: "actions/cache@v3"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"

- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"

- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress --no-suggest"

- name: "build-phar.sh"
run: "build-phar.sh"
- name: "Build PHAR"
run: |
"nix build .#phar"
"cp result/*.phar dist/*"

- name: "Upload PHAR"
uses: fnkr/[email protected]
Expand Down
7 changes: 1 addition & 6 deletions box.json.dist
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
{
"compactors": [
"Herrera\\Box\\Compactor\\Php",
"Herrera\\Box\\Compactor\\Json"
],
"compression": "GZ",
"main": "bin/roave-backward-compatibility-check.php",
"output": "dist/roave-backward-compatibility-check.phar",
"files-bin": [
"LICENSE",
"vendor/composer/composer/LICENSE"
],
"chmod": "0755",
"git-version": "git-version"
"chmod": "0755"
}
11 changes: 5 additions & 6 deletions build-phar.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#!/usr/bin/env bash

#!/usr/bin/env nix-shell
#! nix-shell -i bash --pure
#! nix-shell -p bash phpPackages.box phpPackages.composer
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/fae7198d73783051aae436f84bb91bd9932a6f6d.tar.gz
set -e
drupol marked this conversation as resolved.
Show resolved Hide resolved

BOX_DIR="/tmp/box"

mkdir -p ${BOX_DIR}

# Install humbug/box
composer --working-dir=${BOX_DIR} require humbug/box "^3.8" --no-interaction --no-progress --no-suggest

# Remove dev dependencies for package distribution
composer install --no-dev

${BOX_DIR}/vendor/bin/box compile
box compile

composer install

Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"description": "Tool to compare two revisions of a public API to check for BC breaks",
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"ext-json": "*",
"azjezz/psl": "^2.3.1",
"composer/composer": "^2.5.1",
"nikic/php-parser": "^4.15.3",
Expand Down
Loading
Loading