diff --git a/.github/workflows/build-release-zip.yml b/.github/workflows/build-release-zip.yml index c8f139de0..2e18f68c3 100644 --- a/.github/workflows/build-release-zip.yml +++ b/.github/workflows/build-release-zip.yml @@ -2,25 +2,58 @@ name: Build release zip on: workflow_dispatch: + workflow_call: jobs: build_zip: name: Build release zip runs-on: ubuntu-latest + steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set Node.js 16.x + + - name: Setup node uses: actions/setup-node@v4 with: + cache: 'npm' node-version-file: .nvmrc - - name: npm install and build + + - name: Cache node_modules + id: cache-node-modules + uses: actions/cache@v4 + env: + cache-name: cache-node-modules + with: + path: node_modules + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + id: cache-composer + uses: actions/cache@v4 + env: + cache-name: cache-composer + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }} + + - name: Install node dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: npm ci --no-optional + + - name: Install composer dependencies + run: composer install --no-dev -o + + - name: Build run: | - npm install npm run build npm run makepot - composer install --no-dev npm run archive + - name: Upload the ZIP file as an artifact uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/plugin-check.yml b/.github/workflows/plugin-check.yml new file mode 100644 index 000000000..00c112f2a --- /dev/null +++ b/.github/workflows/plugin-check.yml @@ -0,0 +1,39 @@ +name: WordPress Plugin Checks + +on: + push: + branches: + - develop + - trunk + pull_request: + branches: + - develop + +jobs: + build: + uses: 10up/classifai/.github/workflows/build-release-zip.yml@develop + + test: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download built zip + uses: actions/download-artifact@v4 + with: + name: ${{ github.event.repository.name }} + path: ${{ github.event.repository.name }} + + - name: Display structure of downloaded files + run: ls -R + working-directory: ${{ github.event.repository.name }} + + - name: Run plugin check + uses: wordpress/plugin-check-action@v1 + with: + build-dir: ${{ github.event.repository.name }} + exclude-checks: 'plugin_readme,plugin_updater' # Plugin isn't on .org so excluding these for now. + exclude-directories: 'assets,dist,vendor' diff --git a/includes/Classifai/Providers/OpenAI/TextToSpeech.php b/includes/Classifai/Providers/OpenAI/TextToSpeech.php index 1b44702f1..ff332b527 100644 --- a/includes/Classifai/Providers/OpenAI/TextToSpeech.php +++ b/includes/Classifai/Providers/OpenAI/TextToSpeech.php @@ -84,6 +84,7 @@ public function render_provider_fields(): void { '' : sprintf( wp_kses( + /* translators: %s is replaced with the OpenAI Text to Speech models URL */ __( 'Select a model depending on your requirement.', 'classifai' ), [ 'a' => [ @@ -120,7 +121,8 @@ public function render_provider_fields(): void { '' : sprintf( wp_kses( - __( 'Select the speech voice.', 'classifai' ), + /* translators: %s is replaced with the OpenAI Text to Speech voice options URL */ + __( 'Select the speech voice.', 'classifai' ), [ 'a' => [ 'href' => [], @@ -144,8 +146,8 @@ public function render_provider_fields(): void { 'option_index' => static::ID, 'label_for' => 'format', 'options' => [ - 'mp3' => __( '.mp3', 'classifai' ), - 'wav' => __( '.wav', 'classifai' ), + 'mp3' => __( '.mp3', 'classifai' ), + 'wav' => __( '.wav', 'classifai' ), ], 'default_value' => $settings['format'], 'description' => __( 'Select the desired audio format.', 'classifai' ), @@ -349,9 +351,9 @@ public function get_debug_information(): array { $debug_info = []; if ( $this->feature_instance instanceof FeatureTextToSpeech ) { - $debug_info[ __( 'Model', 'classifai' ) ] = $provider_settings['tts_model'] ?? ''; - $debug_info[ __( 'Voice', 'classifai' ) ] = $provider_settings['voice'] ?? ''; - $debug_info[ __( 'Audio format', 'classifai' ) ] = $provider_settings['format'] ?? ''; + $debug_info[ __( 'Model', 'classifai' ) ] = $provider_settings['tts_model'] ?? ''; + $debug_info[ __( 'Voice', 'classifai' ) ] = $provider_settings['voice'] ?? ''; + $debug_info[ __( 'Audio format', 'classifai' ) ] = $provider_settings['format'] ?? ''; // We don't save the response transient because WP does not support serialized binary data to be inserted to the options. }