Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsgiehl <stefan@matomo.org>2021-10-26 14:33:48 +0300
committersgiehl <stefan@matomo.org>2021-10-26 14:33:48 +0300
commitb3866c9698047ab72e91d22d6645d535e9cf11c1 (patch)
tree6d1d39427cb4e5f757eacce6fbe49564c211ae2f /.github
parentdd8b69d726e9cbdc10b04fc38b47dfe4d7dbf201 (diff)
parentc3b32a5c3a2999c80852ad901a95352462866bfe (diff)
Merge branch '4.x-dev' into fix11796
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/buildvue.yml137
-rw-r--r--.github/workflows/composer-update.yml95
2 files changed, 232 insertions, 0 deletions
diff --git a/.github/workflows/buildvue.yml b/.github/workflows/buildvue.yml
new file mode 100644
index 0000000000..48b072652b
--- /dev/null
+++ b/.github/workflows/buildvue.yml
@@ -0,0 +1,137 @@
+name: Build Vue files
+
+on:
+ pull_request:
+ types: [synchronize]
+
+permissions:
+ actions: read
+ checks: none
+ contents: write
+ deployments: none
+ issues: read
+ packages: none
+ pull-requests: write
+ repository-projects: none
+ security-events: none
+ statuses: none
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Detect branch for PR
+ id: vars
+ run: |
+ PR="${{ github.event.pull_request.number }}"
+
+ PR_INFO=$( curl \
+ --request GET \
+ --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
+ --header 'content-type: application/json' \
+ --url https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$PR )
+ REF=$(echo "${PR_INFO}" | jq -r .head.ref)
+ BASE=$(echo "${PR_INFO}" | jq -r .head.repo.full_name)
+ STATE=$(echo "${PR_INFO}" | jq -r .state)
+ BASE_SHA=$(echo "${PR_INFO}" | jq -r .base.sha)
+
+ if [[ $STATE == "closed" ]]
+ then
+ echo "Pull Request already closed."
+ exit 0;
+ fi
+
+ if [[ $BASE != $GITHUB_REPOSITORY ]]
+ then
+ echo "It's only possible to update local branches"
+ exit 1;
+ fi
+
+ echo ::set-output name=branch::$REF
+ echo ::set-output name=base::$BASE_SHA
+ - uses: actions/checkout@v2
+ with:
+ ref: ${{ steps.vars.outputs.branch }}
+ lfs: false
+ if: steps.vars.outputs.branch != ''
+ - name: Check vue changes
+ id: vuecheck
+ run: |
+ git fetch --depth=1 origin ${{ steps.vars.outputs.base }}
+
+ VUE_FILES_MODIFIED=$(git diff --name-only ${{ steps.vars.outputs.base }} -- plugins/*/vue/**/* | wc -l)
+
+ if [[ $VUE_FILES_MODIFIED == "0" ]]
+ then
+ echo "No vue files modified"
+ exit;
+ fi
+
+ echo ::set-output name=vue_modified::1
+ if: steps.vars.outputs.branch != ''
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '8.0'
+ if: steps.vars.outputs.branch != '' && steps.vuecheck.outputs.vue_modified == '1'
+ - name: Setup node
+ uses: actions/setup-node@v2
+ with:
+ node-version: '16'
+ cache: 'npm'
+ if: steps.vars.outputs.branch != '' && steps.vuecheck.outputs.vue_modified == '1'
+ - run: npm install
+ if: steps.vars.outputs.branch != '' && steps.vuecheck.outputs.vue_modified == '1'
+ - name: Get composer cache directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+ if: steps.vars.outputs.branch != '' && steps.vuecheck.outputs.vue_modified == '1'
+ - name: Cache dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-
+ if: steps.vars.outputs.branch != '' && steps.vuecheck.outputs.vue_modified == '1'
+ - name: Install dependencies
+ run: composer install --prefer-dist
+ if: steps.vars.outputs.branch != '' && steps.vuecheck.outputs.vue_modified == '1'
+ - name: Quick Matomo Install
+ run: |
+ cat <<-EOF > ./config/config.ini.php
+ [General]
+ always_load_commands_from_plugin=CoreVue
+
+ [Development]
+ enabled = 1
+ EOF
+
+ cat ./config/config.ini.php
+ if: steps.vars.outputs.branch != '' && steps.vuecheck.outputs.vue_modified == '1'
+ - name: Prepare git config
+ run: |
+ cat <<- EOF > $HOME/.netrc
+ machine github.com
+ login $GITHUB_ACTOR
+ password $GITHUB_TOKEN
+ machine api.github.com
+ login $GITHUB_ACTOR
+ password $GITHUB_TOKEN
+ EOF
+ chmod 600 $HOME/.netrc
+ git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
+ git config --global user.name "$GITHUB_ACTOR"
+ if: steps.vars.outputs.branch != '' && steps.vuecheck.outputs.vue_modified == '1'
+ - name: Build Vue Modules
+ run: php ./console vue:build
+ if: steps.vars.outputs.branch != '' && steps.vuecheck.outputs.vue_modified == '1'
+ - name: Push changes
+ run: |
+ if [[ $( git diff --numstat plugins/*/vue/dist/*.js plugins/*/vue/dist/*.map ) ]]
+ then
+ cd $GITHUB_WORKSPACE
+ git add plugins/*/vue/dist/*.js plugins/*/vue/dist/*.map
+ git commit -m "built vue files"
+ git push
+ fi
+ if: steps.vars.outputs.branch != '' && steps.vuecheck.outputs.vue_modified == '1'
diff --git a/.github/workflows/composer-update.yml b/.github/workflows/composer-update.yml
new file mode 100644
index 0000000000..a16d9e92d7
--- /dev/null
+++ b/.github/workflows/composer-update.yml
@@ -0,0 +1,95 @@
+name: Composer update
+
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: "0 2 * * 5"
+
+permissions:
+ actions: read
+ checks: none
+ contents: write
+ deployments: none
+ issues: read
+ packages: none
+ pull-requests: write
+ repository-projects: none
+ security-events: none
+ statuses: none
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ ref: '4.x-dev'
+ lfs: false
+ - name: Install composer dependencies
+ run: composer install
+ - name: Prepare branches
+ run: |
+ cat <<- EOF > $HOME/.netrc
+ machine github.com
+ login $GITHUB_ACTOR
+ password $GITHUB_TOKEN
+ machine api.github.com
+ login $GITHUB_ACTOR
+ password $GITHUB_TOKEN
+ EOF
+ chmod 600 $HOME/.netrc
+
+ git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
+ git config --global user.name "$GITHUB_ACTOR"
+
+ git remote add upstream https://github.com/${GITHUB_REPOSITORY}.git
+
+ git push origin --delete composer-update || true
+ git branch -D composer-update || true
+ git fetch upstream 4.x-dev
+ git checkout -f upstream/4.x-dev
+ git branch composer-update
+ git checkout -f composer-update
+ - name: Update composer dependencies
+ id: update
+ run: |
+ composer update --no-ansi 2>&1 | tee COMPOSER_LOG
+ sed -i -e '1i```\' COMPOSER_LOG
+ sed -i -e '1icomposer update log:\' COMPOSER_LOG
+ echo '```' &>> COMPOSER_LOG
+
+ changes=( $(git diff composer.lock) )
+ git add "composer.lock"
+
+ # abort here if no change available
+ if [[ ${#changes[@]} -eq 0 ]]
+ then
+ exit 0
+ fi
+
+ echo ::set-output name=message::$(cat COMPOSER_LOG | jq -aRs)
+ shell: bash
+ - name: Push changes
+ run: |
+ git commit -m "updates composer dependencies"
+ git push --set-upstream origin composer-update
+ shell: bash
+ if: steps.update.outputs.message
+ - name: Create PR
+ run: |
+ message=
+ curl \
+ --request POST \
+ --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
+ --header 'content-type: application/json' \
+ --data '{
+ "title":"[automatic composer updates]",
+ "body":${{ steps.update.outputs.message }},
+ "head":"composer-update",
+ "base":"4.x-dev"
+ }' \
+ --url https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls
+ shell: bash
+ if: steps.update.outputs.message