Skip to content

Commit b78a41d

Browse files
committed
Building out package/bottle builds
1 parent 8317e76 commit b78a41d

File tree

5 files changed

+93
-9
lines changed

5 files changed

+93
-9
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,14 @@ jobs:
104104
needs: [ functional ]
105105
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'pantheon-systems' }}
106106
steps:
107-
- name: Download terminus.phar as artifact
107+
- name: Download repo content from artifact
108108
uses: actions/download-artifact@v2
109109
with:
110-
name: t3-phar
110+
name: full-workspace
111+
# - name: Long testing scheme
112+
# run: composer functional:long
113+
# - name: Build Deb package
114+
# run: composer build:packages
111115
- name: Release
112116
uses: softprops/action-gh-release@v1
113117
with:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
],
8484
"build:packages": [
8585
"echo 'Building Debian/Ubuntu package'",
86-
"`php scrips/BuildDebianPackage.php`",
86+
"scripts/BuildDebianPackage.php",
8787
"echo 'Building Mac Homebrew bottle'",
8888
"echo 'TODO: build this receipt/bottle'"
8989
],

scripts/BuildDebianPackage.php

100644100755
Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1+
#!/usr/bin/env php
12
<?php
23

3-
require_once __DIR__ . '/../vendor/autoload.php';
4+
require_once __DIR__ . '/../vendor/autoload.php';
5+
46

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

79
$composerContents = new \Pantheon\Terminus\Helpers\Composer\ComposerFile(
810
$composerFilePath . DIRECTORY_SEPARATOR . "composer.json"
911
);
1012
$outputPath = $composerFilePath . DIRECTORY_SEPARATOR . "package";
13+
if (is_dir($outputPath)) {
14+
exec(sprintf("rm -Rf %s", $outputPath));
15+
mkdir($outputPath);
16+
}
17+
18+
$name = $composerContents->getName();
1119

20+
[$vendor, $package] = explode("/", $name);
1221
// Create a config object.
1322
$config = new \Pantheon\Terminus\Config\DefaultsConfig();
1423
$config->extend(new \Pantheon\Terminus\Config\YamlConfig($config->get('root') . '/config/constants.yml'));
@@ -18,17 +27,17 @@
1827

1928
$control = new \wdm\debian\control\StandardFile();
2029
$control
21-
->setPackageName($composerContents->get('name'))
30+
->setPackageName($package)
2231
->setVersion($config->get('version'))
23-
->setDepends(array("php7.4", "php7.4-cli"))
32+
->setDepends(["php7.4", "php7.4-cli"])
2433
->setInstalledSize(27648)
34+
->setArchitecture('noarch')
2535
->setMaintainer("Terminus 3", "[email protected]")
26-
->setProvides("pantheon-systems-terminus")
36+
->setProvides($package)
2737
->setDescription($composerContents->get('description'));
28-
;
2938

3039
$packager = new \wdm\debian\Packager();
31-
mkdir($composerFilePath . DIRECTORY_SEPARATOR . "package");
40+
3241
$packager->setOutputPath($outputPath);
3342
$packager->setControl($control);
3443
$packager->addMount("{$composerFilePath}/t3", "/usr/bin/t3");
@@ -38,3 +47,8 @@
3847

3948
//Get the Debian package command
4049
echo $packager->build();
50+
exec($packager->build(), $result, $status);
51+
52+
if ($status !== 0) {
53+
throw new \Exception(join(PHP_EOL, $result));
54+
}

scripts/localTestMatrixRunner.sh

100644100755
File mode changed.

src/Helpers/Composer/ComposerFile.php

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,4 +451,70 @@ public function getRepositories(): array
451451
{
452452
return $this->getConfig()->raw()['repositories'];
453453
}
454+
455+
/**
456+
* @return string|null
457+
*/
458+
public function getName(): ?string
459+
{
460+
return $this->name;
461+
}
462+
463+
/**
464+
* @param string|null $name
465+
*/
466+
public function setName(?string $name): void
467+
{
468+
$this->name = $name;
469+
}
470+
471+
/**
472+
* @return string|null
473+
*/
474+
public function getDescription(): ?string
475+
{
476+
return $this->description;
477+
}
478+
479+
/**
480+
* @param string|null $description
481+
*/
482+
public function setDescription(?string $description): void
483+
{
484+
$this->description = $description;
485+
}
486+
487+
/**
488+
* @return string|null
489+
*/
490+
public function getVersion(): ?string
491+
{
492+
return $this->version;
493+
}
494+
495+
/**
496+
* @param string|null $version
497+
*/
498+
public function setVersion(?string $version): void
499+
{
500+
$this->version = $version;
501+
}
502+
503+
/**
504+
* @return string|null
505+
*/
506+
public function getType(): ?string
507+
{
508+
return $this->type;
509+
}
510+
511+
/**
512+
* @param string|null $type
513+
*/
514+
public function setType(?string $type): void
515+
{
516+
$this->type = $type;
517+
}
518+
519+
454520
}

0 commit comments

Comments
 (0)