Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
MARP-59 migrate the marketplace from ivyteam jenkins to GitHub (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
tutn-axonivy authored Mar 27, 2024
1 parent d98a07c commit 9c335e0
Show file tree
Hide file tree
Showing 62 changed files with 1,038 additions and 1,042 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,19 @@ end_of_line = unset
indent_style = unset
indent_size = unset
insert_final_newline = unset

[/vendor/**]
charset = unset
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_style = unset
indent_size = unset

[**/market-cache/**]
charset = unset
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_style = unset
indent_size = unset
59 changes: 59 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI Build
run-name: Build on branch ${{github.ref_name}} triggered by ${{github.actor}}

on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 22 * * *'

env:
DIST_FILE: ivy-website-market.tar

jobs:
build:
runs-on: ["ubuntu-latest"]
steps:
- uses: actions/checkout@v4
- name: Set up PHP

uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
extensions: |
gd
zip
- name: Composer install
shell: sh
run: |
composer install --no-dev --no-progress
tar -cf ${{ env.DIST_FILE }} --exclude=src/web/_market --exclude=src/web/market-cache src vendor
- name: Archive build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.DIST_FILE }}
path: |
${{ env.DIST_FILE }}
- name: Run test
shell: sh
run: |
composer install --no-progress
./vendor/bin/phpunit --log-junit phpunit-junit.xml
- name: Public test report
uses: EnricoMi/publish-unit-test-result-action/linux@v2
if: success() || failure()
with:
files: "**/phpunit-junit.xml"

- name: Editor checker
uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker

- name: Clean up
run: |
rm -rf *
2 changes: 1 addition & 1 deletion docker/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN apt-get update && \
apt-get install -y wget

# install php composer
ADD install-composer.sh ./install-composer.sh
ADD install-composer.sh ./docker/apache/install-composer.sh
RUN chmod ugo+x ./install-composer.sh
RUN ./install-composer.sh

Expand Down
8 changes: 4 additions & 4 deletions src/app/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ public static function marketDirectory(): string
{
return self::isProductionEnvironment() ? '/home/axonivya/data/market' : __DIR__ . '/../../src/web/_market';
}

public static function marketCacheDirectory(): string
{
return self::isProductionEnvironment() ? '/home/axonivya/data/market-cache' : __DIR__ . '/../../src/web/market-cache';
}

public static function marketInstallationsFile(): string
{
return self::isProductionEnvironment() ? '/home/axonivya/data/market-installations.json' : '/tmp/market-installations.json';
}

public static function unzipper(): string
{
return __DIR__ . '/download-zip.sh';
return __DIR__ . '/download-zip.sh';
}
}
6 changes: 3 additions & 3 deletions src/app/RoutingRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public static function installRoutes($app)
$app->get('/api-browser', ApiBrowserAction::class);

$app->get('/internal/market-rcptt', MarketRCPTTAction::class);

$app->get('/market-cache/{key}/{artifactId}/{version}/logo.png', ProductLogoPermalinkAction::class);
$app->get('/market-cache/{key}/{artifactId}/{version}/_product.json', ProductJsonAction::class);
$app->get('/market-cache/{key}/{artifactId}/{version}/_product.json', ProductJsonAction::class);

$app->get('/{key}/{version}/doc[/{path:.*}]', DocPermalinkAction::class);
$app->get('/{key}/{version}/lib/{name}', LibraryPermalinkAction::class);
$app->get('/{key}/{version}/lib/{name}', LibraryPermalinkAction::class);
$app->get('/{key}[/{version}]', ProductAction::class);
}
}
3 changes: 2 additions & 1 deletion src/app/ViewerMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
return $handler->handle($request);
}

private static function readWriteCookie(ServerRequestInterface $request, string $name): string {
private static function readWriteCookie(ServerRequestInterface $request, string $name): string
{
$value = $request->getQueryParams()[$name] ?? '';
if (!empty($value)) {
setcookie($name, $value);
Expand Down
8 changes: 4 additions & 4 deletions src/app/domain/market/MarketInstallCounter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ public static function incrementInstallCount(string $key)
{
$json = self::readInstallations();
if (isset($json[$key])) {
$json[$key] ++;
$json[$key]++;
}
self::writeInstallations($json);
}

private static function readInstallations()
{
$installFile = Config::marketInstallationsFile();
$json = [];
if (file_exists($installFile)) {
$content = file_get_contents($installFile);
$json = json_decode($content, true);
}
}
return $json;
}

private static function writeInitialInstallations($json, string $key): int
{
$initialCount = rand(20, 50);
Expand Down
10 changes: 5 additions & 5 deletions src/app/domain/market/MavenProductInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ public function getDocArtifacts(): array
}
return $artifacts;
}

public function getProductArtifact(): ?MavenArtifact
{
return $this->productMavenArtifact;
}

public function getVersions(): array
{
{
$versions = [];
if ($this->productMavenArtifact != null) {
$versions = $this->productMavenArtifact->getVersions();
Expand Down Expand Up @@ -139,14 +139,14 @@ public function getVersionsToDisplay(bool $showDevVersions, ?String $designerVer
}

if (empty($designerVersion)) {
$versions = array_filter($versions, fn(string $v) => !str_contains($v, '-SNAPSHOT') && !str_contains($v, "-m"));
$versions = array_filter($versions, fn (string $v) => !str_contains($v, '-SNAPSHOT') && !str_contains($v, "-m"));
return array_values($versions);
}

if (Version::isValidVersionNumber($designerVersion)) {
$designerVersion = (new Version($designerVersion))->getMinorVersion();
}
$versions = array_filter($versions, fn(string $v) => str_starts_with($v, $designerVersion) || (!str_contains($v, '-SNAPSHOT') && !str_contains($v, '-m')));
$versions = array_filter($versions, fn (string $v) => str_starts_with($v, $designerVersion) || (!str_contains($v, '-SNAPSHOT') && !str_contains($v, '-m')));
$versions = MavenArtifact::filterSnapshotsBetweenReleasedVersions($versions);
return array_values($versions);
}
Expand Down
12 changes: 6 additions & 6 deletions src/app/domain/market/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ public function getIcon(): string

public static function all(): array
{
if (self::$types == null)
{
if (self::$types == null) {
self::$types = [
new Type('All Types', '', 'si-types'),
new Type('Connectors', 'connector', 'si-connector'),
new Type('All Types', '', 'si-types'),
new Type('Connectors', 'connector', 'si-connector'),
//new Type('Process Models', 'process', 'si-diagram'),
new Type('Solutions', 'solution', 'si-lab-flask'),
new Type('Utils', 'util', 'si-util')];
new Type('Solutions', 'solution', 'si-lab-flask'),
new Type('Utils', 'util', 'si-util')
];
}
return self::$types;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/domain/market/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class VersionResolver
{
public static function get(MavenProductInfo $info, string $requestedVersion) : ?string
public static function get(MavenProductInfo $info, string $requestedVersion): ?string
{
// redirect to latest version at all
if ($requestedVersion == 'dev' || $requestedVersion == 'nightly' || $requestedVersion == 'sprint') {
Expand Down Expand Up @@ -67,7 +67,7 @@ public static function findNewestVersion(MavenProductInfo $info, string $version
}

public static function findNewestDevVersion(MavenProductInfo $info, string $version): ?string
{
{
$versions = $info->getVersions();
foreach ($versions as $ver) {
if (str_starts_with($ver, $version)) {
Expand Down
9 changes: 6 additions & 3 deletions src/app/pages/_error/404.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
{% block content %}
<section id="one">
<div class="inner">
<h1 class="text-center"><i class="si si-404"></i> Process start not found...</h1>
<h1 class="text-center">
<i class="si si-404"></i>
Process start not found...</h1>
<p>
We could not find this page. Contact us if you miss something.
</p>

{% if message is not empty %}
<p>Reason: {{ message }}</p>
<p>Reason:
{{ message }}</p>
{% endif %}
</div>
</section>
Expand Down
6 changes: 3 additions & 3 deletions src/app/pages/product/json/ProductJsonAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ public function __invoke(Request $request, $response, $args)
if (empty($version)) {
throw new HttpNotFoundException($request, 'version is empty');
}

$info = $product->getMavenProductInfo();
if ($info == null) {
throw new HttpNotFoundException($request, 'product is not versionized');
}

if (!in_array($version, $info->getVersions())) {
throw new HttpNotFoundException($request, 'version does not exist');
}

MarketInstallCounter::incrementInstallCount($product->getKey());
$content = $product->getProductJsonContent($version);
$content = str_replace('${version}', $version, $content);

if (empty($content)) {
$content = "{}";
}
Expand Down
1 change: 1 addition & 0 deletions src/app/permalink/LibraryPermalinkAction.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace app\permalink;

use app\domain\market\Market;
Expand Down
1 change: 1 addition & 0 deletions src/app/permalink/ProductLogoPermalinkAction.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace app\pages\permalink;

use Slim\Psr7\Request;
Expand Down
6 changes: 4 additions & 2 deletions src/web/_market/a-trust/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"statusBadgeUrl": "https://github.com/axonivy-market/a-trust-connector/actions/workflows/ci.yml/badge.svg",
"language": "English",
"industry": "Cross-Industry",
"tags": [ "e-signature" ],
"tags": [
"e-signature"
],
"mavenArtifacts": [
{
"repoUrl": "https://maven.axonivy.com",
Expand All @@ -17,5 +19,5 @@
"artifactId": "a-trust-connector-product",
"type": "zip"
}
]
]
}
22 changes: 11 additions & 11 deletions src/web/_market/alfrescoecm/meta.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"id": "alfrescoecm",
"name": "Alfresco ECM",
"description": "Using Alfresco ECM it is easy to connect, manage and protect important company information.",
"type": "connector",
"platformReview": "4.5",
"sourceUrl": "https://github.com/axonivy-market/alfresco-connector",
"statusBadgeUrl": "https://github.com/axonivy-market/alfresco-connector/actions/workflows/ci.yml/badge.svg",
"language": "English",
"industry": "Cross-Industry",
"tags": ["ECM"],
"id": "alfrescoecm",
"name": "Alfresco ECM",
"description": "Using Alfresco ECM it is easy to connect, manage and protect important company information.",
"type": "connector",
"platformReview": "4.5",
"sourceUrl": "https://github.com/axonivy-market/alfresco-connector",
"statusBadgeUrl": "https://github.com/axonivy-market/alfresco-connector/actions/workflows/ci.yml/badge.svg",
"language": "English",
"industry": "Cross-Industry",
"tags": ["ECM"],
"mavenArtifacts": [
{
"repoUrl": "https://maven.axonivy.com",
Expand All @@ -17,5 +17,5 @@
"artifactId": "alfresco-connector-product",
"type": "zip"
}
]
]
}
2 changes: 1 addition & 1 deletion src/web/_market/amazon-comprehend/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"artifactId": "amazon-comprehend-connector-product",
"type": "zip"
}
]
]
}
2 changes: 1 addition & 1 deletion src/web/_market/amazon-lex/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"artifactId": "amazon-lex-connector-product",
"type": "zip"
}
]
]
}
34 changes: 17 additions & 17 deletions src/web/_market/basic-workflow-ui/meta.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"id": "basic-workflow-ui",
"name": "Basic Workflow UI",
"description": "Small and smart workflow ui",
"type": "util",
"sourceUrl": "https://github.com/axonivy-market/basic-workflow-ui",
"language": "EN/DE/FR",
"industry": "Cross-Industry",
"listed": false,
"tags": ["workflow-ui"],
"mavenArtifacts": [
{
"name": "Basic Workflow UI Product",
"groupId": "ch.ivyteam.ivy.project.wf",
"artifactId": "basic-workflow-ui-product",
"type": "zip"
}
]
"id": "basic-workflow-ui",
"name": "Basic Workflow UI",
"description": "Small and smart workflow ui",
"type": "util",
"sourceUrl": "https://github.com/axonivy-market/basic-workflow-ui",
"language": "EN/DE/FR",
"industry": "Cross-Industry",
"listed": false,
"tags": ["workflow-ui"],
"mavenArtifacts": [
{
"name": "Basic Workflow UI Product",
"groupId": "ch.ivyteam.ivy.project.wf",
"artifactId": "basic-workflow-ui-product",
"type": "zip"
}
]
}
Loading

0 comments on commit 9c335e0

Please sign in to comment.