Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: reafactoring makefile and packaging #430

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1fbb07d
Rely on php-scoper's phar instead of docker
jokesterfr Aug 12, 2024
343eed7
Ignore php-scoper phar and MAC stuff
jokesterfr Aug 12, 2024
1db134f
Update composer's lockfile
jokesterfr Aug 12, 2024
8d10255
En avant
jokesterfr Aug 13, 2024
7c3c9b4
Move to pnpm
jokesterfr Aug 23, 2024
ef17e49
Make zip is easier te remember
jokesterfr Aug 23, 2024
329a5af
Much better this way
jokesterfr Aug 23, 2024
382294d
Better inner documentation
jokesterfr Aug 23, 2024
9607355
Going even further down the line
jokesterfr Aug 23, 2024
53c0388
Reset to 0.0.0
jokesterfr Aug 27, 2024
04c1753
Remove space
jokesterfr Aug 27, 2024
403f8c6
Tidying _dev
jokesterfr Aug 27, 2024
a79c4b4
Remove old docker stuff
jokesterfr Aug 27, 2024
89bfbc4
Docker cleanup
jokesterfr Aug 27, 2024
b9bf06a
Makefile fixes
jokesterfr Aug 27, 2024
9b7b056
Go on
jokesterfr Aug 29, 2024
6882091
hop
jokesterfr Aug 29, 2024
bba68a8
Hop
jokesterfr Aug 30, 2024
3767bfb
Paf
jokesterfr Aug 30, 2024
4428d14
Zou
jokesterfr Aug 30, 2024
741430a
Simplify packaging
jokesterfr Aug 30, 2024
3d0b80d
Good to go
jokesterfr Aug 30, 2024
6015cdd
Update codeowners
jokesterfr Aug 30, 2024
1694f1e
Almost there
jokesterfr Aug 30, 2024
356ff87
do not need this
jokesterfr Aug 30, 2024
22146d9
test this
jokesterfr Aug 30, 2024
e60d804
Yop
jokesterfr Aug 30, 2024
69b1cb3
Update doc
jokesterfr Aug 30, 2024
30d5dad
What about this?
jokesterfr Aug 30, 2024
7b58921
Try my best
jokesterfr Aug 30, 2024
5c9d20a
Add note
jokesterfr Oct 21, 2024
f27218b
Merge branch 'main' into fix/make-packaging
jokesterfr Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .config.local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
imports:
- { resource: common.yml }

parameters:
# In case you need to override with environment variables, you can follow this example :
# env(PS_ACCOUNTS_SENTRY_CREDENTIALS): 'https://[email protected]/5354585'
# sentry.credentials: '%env(string:PS_ACCOUNTS_SENTRY_CREDENTIALS)%'
#
# In order to manage multiple config files you can use PS_ACCOUNTS_ENV=[myenv] environment variable
# to load a specific services_[myenv].yml

ps_accounts.accounts_api_url: "https://accounts-api.prestashop.localhost/"
ps_accounts.accounts_ui_url: "https://accounts.prestashop.localhost"
ps_accounts.sso_api_url: "https://auth-preprod.prestashop.com/api/v1/"
ps_accounts.sso_account_url: "https://authv2-preprod.prestashop.com/login"
ps_accounts.sso_resend_verification_email_url: "https://auth-preprod.prestashop.com/account/send-verification-email"
ps_accounts.billing_api_url: "https://billing-api.psessentials-integration.net"
ps_accounts.indirect_channel_api_url: "https://indirect-channel-api-integration.prestashop.net"
ps_accounts.sentry_credentials: "https://[email protected]/5354585"
ps_accounts.segment_write_key: "UITzSdsFTgYsXaiJG09hsCiupUPwgJQB"
ps_accounts.check_api_ssl_cert: false
ps_accounts.verify_account_tokens: false
ps_accounts.accounts_vue_cdn_url: "https://unpkg.com/prestashop_accounts_vue_components@3/dist/psaccountsVue.umd.min.js"
ps_accounts.accounts_cdn_url: "https://unpkg.com/prestashop_accounts_vue_components@4/dist/psaccountsVue.umd.min.js"
ps_accounts.environment: "development"

# a page to display "Update Your Module" message
ps_accounts.svc_accounts_ui_url: "https://accounts.psessentials-integration.net"

# OAuth2 configuration url
ps_accounts.oauth2_url: "https://oauth.prestashop.localhost"

# Login page testimonials url
ps_accounts.testimonials_url: "https://assets.prestashop3.com/dst/accounts/assets/testimonials.json"
37 changes: 37 additions & 0 deletions .config.preprod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
imports:
- { resource: common.yml }

parameters:
# In case you need to override with environment variables, you can follow this example :
# env(PS_ACCOUNTS_SENTRY_CREDENTIALS): 'https://[email protected]/5354585'
# sentry.credentials: '%env(string:PS_ACCOUNTS_SENTRY_CREDENTIALS)%'
#
# In order to manage multiple config files you can use PS_ACCOUNTS_ENV=[myenv] environment variable
# to load a specific services_[myenv].yml
# prestashop-ready-integration.firebaseapp.com
ps_accounts.segment_write_key: "eYODaH20rT1lMRTTUtAa15BKBlV1XUXQ"
ps_accounts.accounts_api_url: "https://accounts-api.distribution-preprod.prestashop.net/"
ps_accounts.accounts_ui_url: "https://accounts.distribution-preprod.prestashop.net"
ps_accounts.billing_api_url: "https://billing-api.distribution-preprod.prestashop.net/"
ps_accounts.sso_api_url: "https://auth-preprod.prestashop.com/api/v1/"
ps_accounts.sso_account_url: "https://authv2-preprod.prestashop.com/login"
ps_accounts.indirect_channel_api_url: "https://indirect-channel-api-preprod.prestashop.net"
ps_accounts.segment_api_key: "yO1sKx3Xe9upW4bRDoRXEB0TZEXQm2y3"
ps_accounts.sso_resend_verification_email_url: "https://auth-preprod.prestashop.com/account/send-verification-email"
ps_accounts.sentry_credentials: "https://[email protected]/5354585"
ps_accounts.accounts_vue_cdn_url: "https://unpkg.com/prestashop_accounts_vue_components/dist/psaccountsVue.js"
ps_accounts.accounts_cdn_url: "https://unpkg.com/prestashop_accounts_vue_components/dist/psaccountsVue.js"

ps_accounts.environment: "preprod"

# whether to check ssl certificate when calling external api
ps_accounts.check_api_ssl_cert: true
# whether to verify tokens while storing link account
ps_accounts.verify_account_tokens: true

# a page to display "Update Your Module" message
ps_accounts.svc_accounts_ui_url: "https://accounts.psessentials-integration.net"

ps_accounts.oauth2_url: "https://oauth-preprod.prestashop.com"

ps_accounts.testimonials_url: "https://assets.prestashop3.com/dst/accounts/assets/testimonials.json"
20 changes: 20 additions & 0 deletions .config.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
imports:
- { resource: common.yml }
parameters:
ps_accounts.environment: "production"
ps_accounts.accounts_api_url: "https://accounts-api.distribution.prestashop.net/"
ps_accounts.accounts_ui_url: "https://accounts.distribution.prestashop.net"
ps_accounts.sso_api_url: "https://auth.prestashop.com/api/v1/"
ps_accounts.sso_account_url: "https://auth.prestashop.com/login"
ps_accounts.sso_resend_verification_email_url: "https://auth.prestashop.com/account/send-verification-email"
ps_accounts.billing_api_url: "https://billing-api.distribution.prestashop.net/"
ps_accounts.indirect_channel_api_url: "https://indirect-channel-api.prestashop.net"
ps_accounts.sentry_credentials: "https://[email protected]/5354585"
ps_accounts.segment_write_key: "pEJGnRxw47CU01efFjMyl1S7YcxshLxl"
ps_accounts.check_api_ssl_cert: true
ps_accounts.verify_account_tokens: true
ps_accounts.accounts_vue_cdn_url: "https://unpkg.com/prestashop_accounts_vue_components@3/dist/psaccountsVue.umd.min.js"
ps_accounts.accounts_cdn_url: "https://unpkg.com/prestashop_accounts_vue_components@5"
ps_accounts.svc_accounts_ui_url: "https://accounts.psessentials.net"
ps_accounts.oauth2_url: "https://oauth.prestashop.com"
ps_accounts.testimonials_url: "https://assets.prestashop3.com/dst/accounts/assets/testimonials.json"
12 changes: 6 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
; top-most EditorConfig file
root = true

; Unix-style newlines
[*]
charset = utf-8
end_of_line = LF
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 2

[*.{php,tpl}]
indent_style = space
Expand All @@ -16,6 +16,6 @@ indent_size = 4
[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tabs
indent_size = 8
[{Makefile,makefile,**.mk}]
indent_style = tab
indent_size = 4
104 changes: 23 additions & 81 deletions .github/workflows/build-release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
release:
types: [released, prereleased]

env:
NODE_VERSION: 20
PNPM_VERSION: 9

jobs:
build:
name: Build the base artifact
Expand All @@ -15,11 +19,15 @@ jobs:
uses: actions/[email protected]

- name: Setup node env 🏗
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
scope: '@prestashopcorp'
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"
scope: "@prestashopcorp"
cache: "pnpm"

- name: Install pnpm 🏗
run: npm install -g pnpm@${{ env.PNPM_VERSION }}

- name: Set version
id: set_version
Expand All @@ -31,45 +39,24 @@ jobs:
VERSION=${{ steps.set_version.outputs.version }} \
make version

# - name: Install composer dependencies
# run: composer install --no-dev -o
# - name: Install composer dependencies
# run: composer install --no-dev -o

- name: Scoped dependencies
run: make php-scoper

- name: Get yarn cache directory path 🛠
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Install _dev dependencies
working-directory: ./_dev

- name: Cache node_modules 📦
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install _dev dependencies 👨🏻‍💻
working-directory: ./_dev
run: yarn --frozen-lockfile --silent
run: pnpm install
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_RO }}

- name: Build apps
working-directory: ./_dev
run: yarn build

# - name: Clean-up project
# uses: PrestaShopCorp/[email protected]
- name: Clean-up project 🧹
run: |
rm -rf .git
rm -rf _dev
run: pnpm build

- name: Create & upload artifact
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: ../
Expand All @@ -81,37 +68,13 @@ jobs:
outputs:
zip_file: ${{ steps.set_zip_file.outputs.zip_file }}
steps:
- name: Set the zip file
id: set_zip_file
run: |
echo "zip_file=${{ github.event.repository.name }}-${{ needs.build.outputs.version }}.zip" >> "$GITHUB_ENV"
echo "zip_file=${{ github.event.repository.name }}-${{ needs.build.outputs.version }}.zip" >> "$GITHUB_OUTPUT"

- name: Download artifact
uses: actions/download-artifact@v1
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.GCLOUD_PROJECT_PRODUCTION }}
service_account_key: ${{ secrets.G_CREDENTIAL_PRODUCTION }}
export_default_credentials: true

- name: Copy env files
run: |
gcloud components install beta
gcloud beta secrets versions access latest --secret="accounts-module-config" > ps_accounts/ps_accounts/config/config.yml
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.G_CREDENTIAL_PRODUCTION }}

- name: Prepare the production zip
run: |
cd ${{ github.event.repository.name }}/${{ github.event.repository.name }}
sh ./scripts/bundle-module.sh ${{ env.zip_file }}
env:
ENV_FILE: ${{ secrets.PS_ACCOUNTS_ENV_PROD }}
- name: Make the zip for production
run: make zip:prod

- name: Publish the production zip
uses: actions/[email protected]
Expand All @@ -128,34 +91,13 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- name: Set the zip file
id: set_zip_file
run: |
echo "zip_file=${{ github.event.repository.name }}_preprod-${{ needs.build.outputs.version }}.zip" >> "$GITHUB_ENV"

- name: Download artifact
uses: actions/download-artifact@v1
with:
name: ${{ github.event.repository.name }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.GCLOUD_PROJECT_PREPROD }}
service_account_key: ${{ secrets.G_CREDENTIAL_PREPROD }}
export_default_credentials: true

- name: Copy env files
run: |
gcloud components install beta
gcloud beta secrets versions access latest --secret="accounts-module-config" > ps_accounts/ps_accounts/config/config.yml
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.G_CREDENTIAL_PREPROD }}

- name: Prepare the preprod zip
run: |
cd ${{ github.event.repository.name }}/${{ github.event.repository.name }}
sh ./scripts/bundle-module.sh ${{ env.zip_file }}
- name: Make the zip for pre-production
run: make zip:preprod

- name: Publish the preprod zip
uses: actions/[email protected]
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/build-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Build staging module

on:
push:
branches:
- main
workflow_dispatch:
workflow_call:

env:
PHP_BUILDER_VERSION: "8.3"

jobs:
update_staging_release:
name: Build and update staging assets
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_BUILDER_VERSION }}

- name: Bundle zips
run: make zip
env:
VERSION: staging

- name: Move the staging tag
run: |
git tag -d staging | true
git tag staging
git push origin :refs/tags/staging
git push origin staging

- name: Release
uses: softprops/action-gh-release@v2
with:
name: staging
tag_name: staging
prerelease: true
files: |
./dist/ps_accounts-staging.zip
./dist/ps_accounts-staging_e2e.zip
./dist/ps_accounts-staging_preproduction.zip
23 changes: 18 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,34 @@ app.js
### IDE ###
.idea
.vscode
*.bak

### Composer ###
composer.phar
/vendor/
node_modules/
vendor/
.php_cs.cache
.php_cs
install.lock
composer-dev.json
composer-dev.lock
.env
.env*
!.env.dist
!.env.example

### PHP Scoper ###
php-scoper.phar

# Mac OS
.DS_Store

# Node.js
node_modules/

### PHPUnit ###
.phpunit.result.cache

### Configuration ###
config/config*.yml
config/**/services_*.yml
!config/config.yml.dist
!config/admin/services.yml
!config/front/services.yml

Expand All @@ -52,8 +61,12 @@ views/files/*
/views/favicon.ico
/views/index.html
./_dev/.npmrc
.npmrc

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# PrestaShop sources
/prestashop
Loading
Loading