Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
rules: {
// This plugin's Vue SFCs use the `<script setup>`-first ordering
// (script before template), so the default tag-order check does not apply.
'vue/component-tags-order': 'off',
},
};
105 changes: 105 additions & 0 deletions .github/workflows/buildvue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Vue build check

on: pull_request

permissions:
actions: read
checks: read
contents: read
deployments: none
issues: read
packages: none
pull-requests: read
repository-projects: none
security-events: none
statuses: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PLUGIN_NAME: AIProviders

jobs:
buildvue:
name: Vue build check
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v7
with:
lfs: false
persist-credentials: false

- name: Set up PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: '8.1'

- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '16'

- name: Check out github-action-tests repository
uses: actions/checkout@v7
with:
repository: matomo-org/github-action-tests
ref: main
path: github-action-tests

- name: Check out Matomo for plugin builds
run: ${{ github.workspace }}/github-action-tests/scripts/bash/checkout_matomo.sh
env:
PLUGIN_NAME: ${{ env.PLUGIN_NAME }}
WORKSPACE: ${{ github.workspace }}
ACTION_PATH: ${{ github.workspace }}/github-action-tests
MATOMO_TEST_TARGET: maximum_supported_matomo

- name: Install Composer dependencies
run: composer install --ignore-platform-reqs --no-progress
working-directory: matomo

- name: Install npm dependencies
run: npm install --no-audit --no-fund
working-directory: matomo

- name: Write minimal Matomo config
run: |
cat <<'EOF' > config/config.ini.php
[General]
always_load_commands_from_plugin=CoreVue

[Development]
enabled = 1
EOF
working-directory: matomo

- name: Build Vue artifacts
run: php ./console vue:build ${{ env.PLUGIN_NAME }}
working-directory: matomo

- name: Verify dist matches committed artifacts
run: |
# Replace the plugin checkout's dist with the freshly built one.
# rsync --delete picks up any tracked file the build no longer
# produces.
rsync -a --delete matomo/plugins/${{ env.PLUGIN_NAME }}/vue/dist/ vue/dist/

# git respects .gitignore — generated artifacts the plugin
# intentionally ignores (e.g. *.map, *.common.js,
# *.development.*) won't be staged here, so they don't cause
# false-positive drift.
git add -A vue/dist/

if ! git diff --cached --quiet -- vue/dist/; then
echo "::error::Vue dist files are out of date."
echo ""
echo "Drift summary:"
git diff --cached --stat -- vue/dist/
echo ""
echo "Please run './console vue:build ${{ env.PLUGIN_NAME }}' locally and commit the resulting changes under vue/dist/."
exit 1
fi
echo "Vue dist is up to date."
53 changes: 53 additions & 0 deletions .github/workflows/matomo-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Action for running tests
# This file has been automatically created.
# To recreate it you can run this command
# ./console generate:test-action --plugin="AIProviders" --php-versions="7.2,8.4"

name: Plugin AIProviders Tests

on:
pull_request:
types: [opened, synchronize]
push:
branches:
- '**.x-dev'
workflow_dispatch:

permissions:
actions: read
checks: none
contents: read
deployments: none
issues: read
packages: none
pull-requests: read
repository-projects: none
security-events: none
statuses: none

concurrency:
group: php-${{ github.ref }}
cancel-in-progress: true

jobs:
PluginTests:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php: [ '7.2', '8.4' ]
target: ['minimum_required_matomo', 'maximum_supported_matomo']
steps:
- uses: actions/checkout@v6
with:
lfs: true
persist-credentials: false
- name: Run tests
uses: matomo-org/github-action-tests@main
with:
plugin-name: 'AIProviders'
php-version: ${{ matrix.php }}
test-type: 'PluginTests'
matomo-test-branch: ${{ matrix.target }}
artifacts-pass: ${{ secrets.ARTIFACTS_PASS }}
upload-artifacts: ${{ matrix.php == '7.2' && matrix.target == 'maximum_supported_matomo' }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
.idea/
/node_modules
tests/System/processed/*xml
/vue/dist/demo.html
/vue/dist/*.common.js
/vue/dist/*.map

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the ignored files have already been committed and should be removed to prevent them from not being updated.

/vue/dist/*.development.*
.codex
Loading
Loading