Skip to content

Commit

Permalink
Merge pull request #29 from Net-Logic/langs
Browse files Browse the repository at this point in the history
workflow
  • Loading branch information
frederic34 committed Mar 27, 2023
2 parents 587617c + 7d6ab4a commit 6495eb0
Show file tree
Hide file tree
Showing 11 changed files with 1,692 additions and 293 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This is a basic workflow to help you get started with Actions

name: CHANGELOG

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: php-parallel-lint/php-var-dump-check, parallel-lint, cs2pr, phpcs
- uses: actions/setup-node@v3
with:
node-version: 14.x
registry-url: 'https://registry.npmjs.org'
- name: Print PHP version
run: echo ${{ steps.setup-php.outputs.php-version }}
- name: Run autotranslator
run: |
php ./.tx/autotranslator.php fr_FR it_IT ${{ secrets.GOOGLE_API_TRANSLATE }}
php ./.tx/autotranslator.php fr_FR en_US ${{ secrets.GOOGLE_API_TRANSLATE }}
php ./.tx/autotranslator.php fr_FR es_ES ${{ secrets.GOOGLE_API_TRANSLATE }}
php ./.tx/autotranslator.php fr_FR de_DE ${{ secrets.GOOGLE_API_TRANSLATE }}
- name: Run changelog
run: npx lerna-changelog --from=v0.0.0 > ChangeLog.md
env:
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
- name: Bump version and push tag
uses: Net-Logic/github-dolibarr-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_OWNER: Net-Logic
RELEASE_BRANCH: master
MODULE: microsoftgraph
CLASSNAME: MicrosoftGraph
RELEASE_BRANCHES: master
DEFAULT_BUMP: none
INITIAL_VERSION: v0.0.0
VERBOSE: true
- name: Zip Folder
run: |
ls -al
mkdir build/htdocs
rsync -arv --exclude='.git/' --exclude='.github/' --exclude='.gitignore' --exclude='.tx/' --exclude='build/' --exclude='codesniffer/' . ./build/htdocs/microsoftgraph
- name: Switch to Release Folder
run: |
cd build
zip -r module_microsoftgraph-${{ env.module_version }}.zip htdocs
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Bump version #none
61 changes: 61 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: php-parallel-lint/php-var-dump-check, parallel-lint, cs2pr, phpcs
- uses: actions/setup-node@v3
with:
node-version: 14.x
registry-url: 'https://registry.npmjs.org'
- name: Print PHP version
run: echo ${{ steps.setup-php.outputs.php-version }}
- name: Run PHPCS
run: phpcs -q --report=checkstyle --standard=codesniffer/ruleset.xml --extensions=php --ignore=*/tx/*,*/vendor/* . | cs2pr --graceful-warnings
- name: Run Parallel Lint
run: parallel-lint --exclude vendor/ .
- name: Run VarDump Check
run: var-dump-check --extensions php --tracy --exclude vendor/ .
- name: Bump version and push tag
uses: Net-Logic/github-dolibarr-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_OWNER: Net-Logic
RELEASE_BRANCH: main
MODULE: prune
CLASSNAME: Prune
RELEASE_BRANCHES: main
DEFAULT_BUMP: none
INITIAL_VERSION: v0.0.0
VERBOSE: true
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Bump version #none
93 changes: 93 additions & 0 deletions .tx/autotranslator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/usr/bin/env php
<?php
/* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

/**
* \file dev/translation/autotranslator.php
* \ingroup dev
* \brief This script uses google language ajax api as the translator engine
* The main translator function can be found at:
* defunct -http://code.google.com/intl/fr/apis/language/translate/overview.html-
* defunct -http://translate.google.com/translate_tools-
* https://code.google.com/apis/console
*/

$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path = dirname(__FILE__) . '/';

// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n";
exit;
}

require_once "./.tx/class/translate.class.php";
$langs = new Translate($path);
$langs->setDefaultLang('fr_FR');
// Load main language strings
$langs->load("main");

// Global variables
$version = '1.14';
$error = 0;


// -------------------- START OF YOUR CODE HERE --------------------
@set_time_limit(0);
print "***** " . $script_file . " (" . $version . ") *****\n";
$dir = "./langs";

// Check parameters
if (!isset($argv[3])) {
print "Usage: " . $script_file . " lang_code_src lang_code_dest|all APIKEY [langfile.lang]\n";
print "Example: " . $script_file . " en_US pt_PT 123456 abcdef.lang\n";
print "Rem: lang_code to use can be found on https://translate.google.com\n";
exit;
}

// Show parameters
print 'Argument 1=' . $argv[1] . "\n";
print 'Argument 2=' . $argv[2] . "\n";
print 'Argument 3=' . $argv[3] . "\n";
$file = '';
if (isset($argv[4])) {
$file = $argv[4];
print 'Argument 4=' . $argv[4] . "\n";
}
print 'Files will be generated/updated in directory ' . $dir . "\n";

if ($argv[2] != 'all') {
if (!is_dir($dir . '/' . $argv[2])) {
print 'Create directory ' . $dir . '/' . $argv[2] . "\n";
$result = mkdir($dir . '/' . $argv[2]);
if (!$result) {
// $db->close();
return -1;
}
}
}

require_once "./.tx/class/autotranslator.class.php";

$langParser = new AutoTranslator($argv[2], $argv[1], $dir, $file, $argv[3]);

print "***** Finished *****\n";

// -------------------- END OF YOUR CODE --------------------

return $error;

0 comments on commit 6495eb0

Please sign in to comment.