-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from PrestaShop/develop
MEP 2023-11-08
- Loading branch information
Showing
12 changed files
with
231 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: APIQANIGHTLY PRESTABULLE CLEANING | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- develop | ||
|
||
env: | ||
LABELS: ${{toJSON(github.event.pull_request.labels)}} | ||
|
||
jobs: | ||
apiqanightly_prestabulle: | ||
name: apiqanightly Cleaning Prestabulle | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 25 | ||
if: contains(github.event.pull_request.labels.*.name, 'prestabulle1') || | ||
contains(github.event.pull_request.labels.*.name, 'prestabulle2') || | ||
contains(github.event.pull_request.labels.*.name, 'prestabulle3') | ||
|
||
steps: | ||
- name: Checkout the repository 🎁 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setting up the Bulle variable for later 💬 | ||
run: echo "BULLE=$BULLE$(echo $LABELS > labels.json && cat labels.json | jq -r '.[]|.name'|grep prestabulle)" >> $GITHUB_OUTPUT | ||
id: get_bulle | ||
|
||
- name: Trigger clean prestabulle | ||
uses: aurelien-baudet/workflow-dispatch@v2 | ||
with: | ||
workflow: prestabulle-clean.yml | ||
repo: PrestaShopCorp/qanightlyresults-cd | ||
inputs: '{ "project": "api-nightly", "bulle": "${{ steps.get_bulle.outputs.BULLE }}"}' | ||
token: ${{ secrets.TERRAFORM_ACCESS_TOKEN }} | ||
ref: 'refs/heads/main' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Integration CD for QAnightly | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, labeled] | ||
|
||
env: | ||
LABELS: ${{toJSON(github.event.pull_request.labels)}} | ||
|
||
jobs: | ||
integration_deployment: | ||
name: Deploy (integration) | ||
runs-on: ubuntu-latest | ||
environment: integration | ||
if: contains(github.event.pull_request.labels.*.name, 'prestabulle1') || | ||
contains(github.event.pull_request.labels.*.name, 'prestabulle2') || | ||
contains(github.event.pull_request.labels.*.name, 'prestabulle3') | ||
|
||
steps: | ||
- name: Checkout the repository 🎁 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setting up the Bulle variable for later 💬 | ||
run: echo "BULLE=$BULLE$(echo $LABELS > labels.json && cat labels.json | jq -r '.[]|.name'|grep prestabulle)" >> $GITHUB_OUTPUT | ||
id: get_bulle | ||
|
||
- name: Get branch name | ||
id: branch | ||
uses: tj-actions/[email protected] | ||
|
||
- name: Trigger CI / CD | ||
uses: aurelien-baudet/workflow-dispatch@v2 | ||
with: | ||
workflow: integration-cd.yml | ||
repo: PrestaShopCorp/qanightlyresults-cd | ||
inputs: '{ "branch": "${{ steps.branch.outputs.current_branch }}", "bulle": "${{ steps.get_bulle.outputs.BULLE }}", "project": "api-nightly", "repository": "PrestaShop/QANightlyResults"}' | ||
token: ${{ secrets.TERRAFORM_ACCESS_TOKEN }} | ||
ref: 'refs/heads/main' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: preprod CD for QAnightly | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
preprod_deployment: | ||
name: Deploy (preprod) | ||
runs-on: ubuntu-latest | ||
environment: preproduction | ||
concurrency: preprod-cd | ||
|
||
steps: | ||
- name: Checkout the repository 🎁 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get branch name | ||
id: branch | ||
uses: tj-actions/[email protected] | ||
|
||
- name: Trigger CI / CD | ||
uses: aurelien-baudet/workflow-dispatch@v2 | ||
with: | ||
workflow: preproduction-cd.yml | ||
repo: PrestaShopCorp/qanightlyresults-cd | ||
inputs: '{ "branch": "${{ steps.branch.outputs.current_branch }}", "project": "api-nightly", "repository": "PrestaShop/QANightlyResults"}' | ||
token: ${{ secrets.TERRAFORM_ACCESS_TOKEN }} | ||
ref: 'refs/heads/main' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: production CD for QAnightly | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
jobs: | ||
production_deployment: | ||
name: Deploy (production) | ||
runs-on: ubuntu-latest | ||
environment: production | ||
concurrency: production-cd | ||
|
||
steps: | ||
- name: Checkout the repository 🎁 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get branch name | ||
id: branch | ||
uses: tj-actions/[email protected] | ||
|
||
- name: Trigger CI / CD | ||
uses: aurelien-baudet/workflow-dispatch@v2 | ||
with: | ||
workflow: production-cd.yml | ||
repo: PrestaShopCorp/qanightlyresults-cd | ||
inputs: '{ "branch": "${{ steps.branch.outputs.current_branch }}", "project": "api-nightly", "repository": "PrestaShop/QANightlyResults"}' | ||
token: ${{ secrets.TERRAFORM_ACCESS_TOKEN }} | ||
ref: 'refs/heads/main' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
echo "Launching DB upgrade php script..." | ||
|
||
/usr/local/bin/php src/Upgrade/upgrade.php | ||
|
||
exitCode=$? | ||
|
||
echo "Script ended with this exit code: $exitCode" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Controller; | ||
|
||
use Illuminate\Database\Capsule\Manager; | ||
use Illuminate\Database\QueryException; | ||
use Slim\Psr7\Request; | ||
use Slim\Psr7\Response; | ||
|
||
class HealthCheckController extends BaseController | ||
{ | ||
/** | ||
* Display data for a badge in GitHub | ||
* | ||
* @param Request $request | ||
* @param Response $response | ||
* | ||
* @return Response | ||
*/ | ||
public function check(Request $request, Response $response): Response | ||
{ | ||
$data = [ | ||
'database' => true, | ||
'gcp' => true, | ||
]; | ||
|
||
// Check database | ||
try { | ||
Manager::table('settings')->first(); | ||
} catch (QueryException $e) { | ||
$data['database'] = false; | ||
} | ||
|
||
// Check GCP | ||
$gcpCall = file_get_contents(QANB_GCPURL); | ||
if (!$gcpCall) { | ||
$data['gcp'] = false; | ||
} | ||
|
||
$response->getBody()->write(json_encode($data)); | ||
|
||
return $response->withHeader('Content-Type', 'application/json'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
<VirtualHost *:80> | ||
DocumentRoot "/var/www/html/PROJECT/public" | ||
ServerName api.domain.com | ||
ServerAdmin [email protected] | ||
ServerName api-nightly.prestashop.com | ||
ServerAlias integration-api-nightly.prestashop.com | ||
DocumentRoot "/var/www/html/public/" | ||
|
||
<Directory "/var/www/html/PROJECT/public/"> | ||
Header set Access-Control-Allow-Origin "*" | ||
|
||
<Directory "/var/www/html/public/"> | ||
Options FollowSymLinks Indexes MultiViews | ||
AllowOverride All | ||
# replace the * by the full URL of your front eg. "https://www.domain.com" | ||
Header set Access-Control-Allow-Origin "*" | ||
# "testing" or "staging" to see errors | ||
SetEnv QANB_ENV "production" | ||
SetEnv QANB_DB_HOST "localhost" | ||
SetEnv QANB_DB_USERNAME "root" | ||
SetEnv QANB_DB_PASSWORD "" | ||
SetEnv QANB_DB_NAME "qanightlyresults" | ||
# replace "token" by your token value eg. "gfs5hkomhgSJh2sfhgs7Qdsv0" | ||
SetEnv QANB_TOKEN "token" | ||
SetEnv QANB_GCPURL "https://storage.googleapis.com/prestashop-core-nightly/" | ||
SetEnv CI_ENV "production" | ||
Require all granted | ||
</Directory> | ||
</VirtualHost> | ||
</VirtualHost> |