Skip to content

Commit

Permalink
Building out package/bottle builds
Browse files Browse the repository at this point in the history
  • Loading branch information
stovak committed Jun 21, 2021
1 parent 8317e76 commit b78a41d
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 9 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
],
Expand Down
26 changes: 20 additions & 6 deletions scripts/BuildDebianPackage.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
#!/usr/bin/env php
<?php

require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../vendor/autoload.php';


$composerFilePath = realpath(dirname(\Composer\Factory::getComposerFile()));

$composerContents = new \Pantheon\Terminus\Helpers\Composer\ComposerFile(
$composerFilePath . DIRECTORY_SEPARATOR . "composer.json"
);
$outputPath = $composerFilePath . DIRECTORY_SEPARATOR . "package";
if (is_dir($outputPath)) {
exec(sprintf("rm -Rf %s", $outputPath));
mkdir($outputPath);
}

$name = $composerContents->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'));
Expand All @@ -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");
Expand All @@ -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));
}
Empty file modified scripts/localTestMatrixRunner.sh
100644 → 100755
Empty file.
66 changes: 66 additions & 0 deletions src/Helpers/Composer/ComposerFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


}

0 comments on commit b78a41d

Please sign in to comment.