Skip to content

Build(deps-dev): Bump psalm/phar from 5.24.0 to 5.25.0 #1879

Build(deps-dev): Bump psalm/phar from 5.24.0 to 5.25.0

Build(deps-dev): Bump psalm/phar from 5.24.0 to 5.25.0 #1879

Workflow file for this run

name: Additional tests for pull requests
on:
pull_request:
jobs:
changelog:
name: Check if the changelog was updated
runs-on: ubuntu-22.04
steps:
- name: Checkout the app
uses: actions/checkout@v4
with:
filter: "blob:none"
fetch-depth: 0
- name: Get the diff
id: diff
run: |
if [ -n "$RUNNER_DEBUG" ]
then
set -x
fi
filename_prefix=".changelog/current/${{ github.event.number }}-"
git diff HEAD~1 --name-only -- $filename_prefix* > /tmp/changed-cl-files
echo "Possibly matching changelog files:"
cat /tmp/changed-cl-files
num_lines=$(cat /tmp/changed-cl-files | wc -l)
if [ "$num_lines" -gt 1 ]
then
{
echo "### Too many changelog files match"
echo ""
echo "There are too many changelog entries found for the PR #${{ github.event.number }} found."
echo "There must be only one entry."
echo ""
echo "The following entries were found:"
echo ""
sed 's@^@- @' /tmp/changed-cl-files
echo ""
echo "Please fix this manually."
} > $GITHUB_STEP_SUMMARY
exit 1
fi
echo "num_lines=$(cat /tmp/changed-cl-files | wc -l)" >> $GITHUB_OUTPUT
- name: Get all changed file names
id: file-names
run: |
if [ -n "$RUNNER_DEBUG" ]
then
set -x
fi
git diff HEAD~1 --name-only > /tmp/changed-files-in-pr
echo "Changed files:"
cat /tmp/changed-files-in-pr
totalcnt="$(cat /tmp/changed-files-in-pr | wc -l)"
echo "totalcount=$totalcnt" >> $GITHUB_OUTPUT
echo "In total that are $totalcnt files."
#
echo "Filtering out automatically updatable files"
cat /tmp/changed-files-in-pr | grep -v '^package-lock.json$' | grep -v '^composer.lock$' | grep -v '^\.github/workflows/' | grep -v '^docs/Gemfile.lock' | tee /tmp/relevant-files-in-pr
cnt="$(cat /tmp/relevant-files-in-pr | wc -l)"
echo "That are $cnt files relevant."
echo "num=$cnt" >> $GITHUB_OUTPUT
#
echo "That are $totalcnt changed files. After reducing the number there are $cnt files left."
- name: Error/warn if no changelog entry was found
run: |
if [ -n "$RUNNER_DEBUG" ]
then
set -x
fi
if [ ${{ steps.file-names.outputs.num }} -gt 0 ]; then
echo "::error::There was no change in the changelog detected. Please fill in a valid entry into that file."
{
echo "### No changelog was found"
echo ""
echo "You have in total ${{ steps.file-names.outputs.totalcount }} file(s) changed in the pull request."
echo "From these, there are ${{ steps.file-names.outputs.num }} file(s) which make a changelog entry mandatory."
echo "These files are:"
echo ""
sed 's@^@- @' /tmp/relevant-files-in-pr
echo ""
echo 'Please provide a file `.changelog/current/${{ github.event.number }}-foo` where you can set the text `foo` as you like.'
echo "A good suggestion is to summarize the PR's content and to replace any non-chars with dashes."
echo 'An example file name could be `.changelog/current/1234-update-nc-release-script`.'
} > $GITHUB_STEP_SUMMARY
exit 1
else
echo "::warning file=CHANGELOG.md::There was no change in the changelog detected. There are in total ${{ steps.file-names.outputs.totalcount }} changed files."
{
echo "### No changelog was needed"
echo ""
echo "No changelog entry was found so far."
echo "This is okay, as no files have been modified that would require a changelog entry."
echo "You might consider if adding a changelog entry would be benefical as significant changes have been made."
} > $GITHUB_STEP_SUMMARY
fi
if: ${{ steps.diff.outputs.num_lines == 0 }}
- name: Install Python package
run: pip install --user virtualenv pipenv
- name: Test creation of changelog
run: |
if [ -n "$RUNNER_DEBUG" ]
then
set -x
fi
cd .helpers/changelog
virtualenv venv
source venv/bin/activate
pipenv sync
echo "${{ secrets.GITHUB_TOKEN }}" > token
{
echo ""
echo "### Output of changelog generation unreleased section"
echo ""
echo '```'
python -m changelog_builder --token token --ci --pr ${{ github.event.number }} ../../.changelog/current/* 2>&1
echo '```'
} >> $GITHUB_STEP_SUMMARY
todo-checker:
name: Check for added todo messages
runs-on: ubuntu-22.04
steps:
- name: Git version output
run: git version
- name: Manual checkout of the app (base repo)
run: |
REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
BRANCH="${GITHUB_REF/#refs\/heads\//}"
git clone --filter=tree:0 "$REPO" .
- name: Manual checkout of the app (PR head)
env:
URL: ${{ github.event.pull_request.head.repo.html_url }}
HEAD_REF: ${{ github.head_ref }}
run: |
git remote add head "$URL"
git fetch head --filter=tree:0
git checkout -b head-branch head/$HEAD_REF
- name: Status of current git workspace
run: |
git branch
git status
- name: Check for open TODO annotations in source code
uses: ./.github/actions/check-todo
appinfo:
name: Check for matching app info file
runs-on: ubuntu-22.04
steps:
- name: Checkout of the app
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install jq
pip install yq
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Perform the test
env:
MAIN_FILE: appinfo/info.xml
DIST_FILE: .github/actions/deploy/appinfo/info.xml.dist
run: |
echo "Normalize the actual appinfo file"
xq -x 'del(.info.version)' "$MAIN_FILE" > /tmp/main-info.xml
xq -x 'del(.info.version)' "$DIST_FILE" > /tmp/dist-info.xml
echo '::group::Debug output'
tail -n 100 /tmp/main-info.xml /tmp/dist-info.xml
echo '::endgroup::'
if ! diff -q /tmp/main-info.xml /tmp/dist-info.xml > /dev/null; then
echo '::error::The app info file differs from the dist file. Please check manually!'
exit 1
fi
- name: Download schema
run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd
- name: Lint info.xml
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: ./appinfo/info.xml
xml-schema-file: ./info.xsd
package-lint:
name: Make sure the package.json is well-formatted
runs-on: ubuntu-22.04
steps:
- name: Checkout of the app
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Get the date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT
- name: Cache NPM cache
uses: actions/cache@v4.0.2
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-node-${{ steps.date.outputs.date }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ steps.date.outputs.date }}-
${{ runner.os }}-node-
- name: Install NPM modules
run: npm ci
- name: Perform the test
run: |
npm run package-lint
if [ $(git diff --name-only package.json | wc -l) -gt 0 ]; then
echo '::error file=package.json::The package.json file is not validly formatted.'
echo '::notice::It is suggested to run `npm run package-lint` and commit locally.'
exit 1
fi
fixup-check:
name: Block fixup and squash commits
runs-on: ubuntu-latest
steps:
- name: Run check
uses: xt0rted/block-autosquash-commits-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}