From b78a41dd3ad9f20d712700b5cf9c26861e17cd7c Mon Sep 17 00:00:00 2001 From: stovak <119924+stovak@users.noreply.github.com> Date: Mon, 21 Jun 2021 09:54:57 -0700 Subject: [PATCH] Building out package/bottle builds --- .github/workflows/ci.yml | 8 +++- composer.json | 2 +- scripts/BuildDebianPackage.php | 26 ++++++++--- scripts/localTestMatrixRunner.sh | 0 src/Helpers/Composer/ComposerFile.php | 66 +++++++++++++++++++++++++++ 5 files changed, 93 insertions(+), 9 deletions(-) mode change 100644 => 100755 scripts/BuildDebianPackage.php mode change 100644 => 100755 scripts/localTestMatrixRunner.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe5f2c6a1..2e48ad159 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,10 +104,14 @@ jobs: needs: [ functional ] if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'pantheon-systems' }} steps: - - name: Download terminus.phar as artifact + - name: Download repo content from artifact uses: actions/download-artifact@v2 with: - name: t3-phar + name: full-workspace + # - name: Long testing scheme + # run: composer functional:long + # - name: Build Deb package + # run: composer build:packages - name: Release uses: softprops/action-gh-release@v1 with: diff --git a/composer.json b/composer.json index dbb96a599..2ddd0460d 100644 --- a/composer.json +++ b/composer.json @@ -83,7 +83,7 @@ ], "build:packages": [ "echo 'Building Debian/Ubuntu package'", - "`php scrips/BuildDebianPackage.php`", + "scripts/BuildDebianPackage.php", "echo 'Building Mac Homebrew bottle'", "echo 'TODO: build this receipt/bottle'" ], diff --git a/scripts/BuildDebianPackage.php b/scripts/BuildDebianPackage.php old mode 100644 new mode 100755 index 7283d437e..4636a5065 --- a/scripts/BuildDebianPackage.php +++ b/scripts/BuildDebianPackage.php @@ -1,6 +1,8 @@ +#!/usr/bin/env php getName(); +[$vendor, $package] = explode("/", $name); // Create a config object. $config = new \Pantheon\Terminus\Config\DefaultsConfig(); $config->extend(new \Pantheon\Terminus\Config\YamlConfig($config->get('root') . '/config/constants.yml')); @@ -18,17 +27,17 @@ $control = new \wdm\debian\control\StandardFile(); $control - ->setPackageName($composerContents->get('name')) + ->setPackageName($package) ->setVersion($config->get('version')) - ->setDepends(array("php7.4", "php7.4-cli")) + ->setDepends(["php7.4", "php7.4-cli"]) ->setInstalledSize(27648) + ->setArchitecture('noarch') ->setMaintainer("Terminus 3", "terminus3@pantheon.io") - ->setProvides("pantheon-systems-terminus") + ->setProvides($package) ->setDescription($composerContents->get('description')); -; $packager = new \wdm\debian\Packager(); -mkdir($composerFilePath . DIRECTORY_SEPARATOR . "package"); + $packager->setOutputPath($outputPath); $packager->setControl($control); $packager->addMount("{$composerFilePath}/t3", "/usr/bin/t3"); @@ -38,3 +47,8 @@ //Get the Debian package command echo $packager->build(); +exec($packager->build(), $result, $status); + +if ($status !== 0) { + throw new \Exception(join(PHP_EOL, $result)); +} diff --git a/scripts/localTestMatrixRunner.sh b/scripts/localTestMatrixRunner.sh old mode 100644 new mode 100755 diff --git a/src/Helpers/Composer/ComposerFile.php b/src/Helpers/Composer/ComposerFile.php index 5c3999935..44d59e6f1 100644 --- a/src/Helpers/Composer/ComposerFile.php +++ b/src/Helpers/Composer/ComposerFile.php @@ -451,4 +451,70 @@ public function getRepositories(): array { return $this->getConfig()->raw()['repositories']; } + + /** + * @return string|null + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * @param string|null $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * @return string|null + */ + public function getDescription(): ?string + { + return $this->description; + } + + /** + * @param string|null $description + */ + public function setDescription(?string $description): void + { + $this->description = $description; + } + + /** + * @return string|null + */ + public function getVersion(): ?string + { + return $this->version; + } + + /** + * @param string|null $version + */ + public function setVersion(?string $version): void + { + $this->version = $version; + } + + /** + * @return string|null + */ + public function getType(): ?string + { + return $this->type; + } + + /** + * @param string|null $type + */ + public function setType(?string $type): void + { + $this->type = $type; + } + + }