Build(deps): Bump json from 2.8.2 to 2.9.0 in /docs #7039
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
paths-ignore: | |
- 'docs/**' | |
- 'l10n/**' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
code-lint: | |
name: Run PHP Linter and Code Style checker | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout the project | |
uses: actions/checkout@v4 | |
- name: Setup node and NPM | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '16' | |
- name: Install npm | |
shell: bash | |
run: npm install -g npm@^8 | |
- name: Get the date | |
id: date | |
run: echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT | |
- name: Cache NPM cache | |
uses: actions/[email protected] | |
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: Cache composer files | |
uses: actions/[email protected] | |
with: | |
path: | | |
vendor | |
key: ${{ runner.os }}-composer-${{ steps.date.outputs.date }}-${{ hashFiles('composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer-${{ steps.date.outputs.date }}- | |
${{ runner.os }}-composer- | |
- name: Get PHP version | |
shell: bash | |
run: php -v | |
- name: Install Composer | |
shell: bash | |
run: >- | |
wget https://github.com/composer/getcomposer.org/raw/main/web/installer -O - -q | | |
php -- --quiet | |
- name: Install PHP packages | |
shell: bash | |
run: composer install | |
- name: Install Node packages | |
shell: bash | |
run: npm -q ci || { cat ~/.npm/eresolve-report.txt ; exit 1; } | |
- name: Run PHP linter | |
shell: bash | |
run: composer lint:lint | |
- name: Run PHP code style checker | |
shell: bash | |
run: composer cs:check | |
- name: Run PHP type checker Psalm | |
shell: bash | |
run: composer psalm | |
- name: Check for formatting issues with vue files (prettier) | |
shell: bash | |
run: >- | |
npm run prettier || { | |
echo '::error ::The prettier style checker failed. | |
Please run `npm run prettier-fix` in order to correct this.'; | |
exit 1; | |
} | |
- name: Check for issues with vue and js files (eslint) | |
shell: bash | |
run: >- | |
npm run eslint || { | |
echo '::error ::The eslint style checker failed. | |
Please run `npm run eslint-fix` in order to correct this.'; | |
exit 1; | |
} | |
- name: Check for formatting issues with CSS files (stylelint) | |
shell: bash | |
run: >- | |
npm run stylelint || { | |
echo '::error ::The stylelint checker failed. | |
Please run `npm run stylelint-fix` to help solving these issues if possible.'; | |
exit 1; | |
} | |
unit-tests: | |
name: Run the unittests | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
database: | |
- mysql | |
coreVersion: | |
- 30 | |
phpVersion: | |
- "8.3" | |
httpServer: | |
- "apache" | |
include: | |
- database: sqlite | |
coreVersion: 28 | |
phpVersion: "8.1" | |
httpServer: "apache" | |
- database: pgsql | |
coreVersion: 29 | |
phpVersion: "8.2" | |
httpServer: "nginx" | |
steps: | |
- name: Checkout the app | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Ensure the appinfo is built | |
shell: bash | |
run: make appinfo/info.xml | |
#- name: Docker Layer Caching | |
#uses: satackey/[email protected] | |
- name: Install helper program | |
shell: bash | |
run: |- | |
pip install yq | |
echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
- name: Get the min and max compatible server versions from manifest XML file | |
shell: bash | |
id: ncVersionRequirements | |
run: |- | |
minVersion="$(cat appinfo/info.xml | xq '.info.dependencies.nextcloud."@min-version"' -r)" | |
maxVersion="$(cat appinfo/info.xml | xq '.info.dependencies.nextcloud."@max-version"' -r)" | |
echo "minVersion=$minVersion" >> $GITHUB_OUTPUT | |
echo "maxVersion=$maxVersion" >> $GITHUB_OUTPUT | |
echo "Compatible NC server versions: [$minVersion, $maxVersion]" | |
if [ "${{ matrix.coreVersion }}" -ge "$minVersion" -a "${{ matrix.coreVersion }}" -le "$maxVersion" ]; then | |
mv="true" | |
else | |
mv="false" | |
echo "Skipping the main tests as this version is marked incompatible with the installed NC version." >> $GITHUB_STEP_SUMMARY | |
fi | |
echo "matchingVersion=$mv" >> $GITHUB_OUTPUT | |
echo "The app is compatible with the current NV core v${{ matrix.coreVersion }}: $mv" | |
- name: Run the tests in docker container | |
if: steps.ncVersionRequirements.outputs.matchingVersion == 'true' | |
uses: ./.github/actions/run-tests | |
with: | |
db: ${{ matrix.database }} | |
phpVersion: ${{ matrix.phpVersion }} | |
server: ${{ matrix.httpServer }} | |
coreVersion: stable${{ matrix.coreVersion }} | |
- name: Upload the log file as artifact | |
if: steps.ncVersionRequirements.outputs.matchingVersion == 'true' && always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Nextcloud-logs (${{matrix.database}}, stable${{matrix.coreVersion}}, ${{matrix.httpServer}}, ${{matrix.phpVersion}}) | |
path: .github/actions/run-tests/volumes/data/nextcloud.log | |
- name: Copy coverage-reports into non-link folder | |
if: steps.ncVersionRequirements.outputs.matchingVersion == 'true' | |
shell: bash | |
run: >- | |
mkdir /tmp/coverage && | |
rsync -a .github/actions/run-tests/volumes/coverage/latest/ /tmp/coverage | |
- name: Upload the code coverage report for codecov as artifacts | |
if: steps.ncVersionRequirements.outputs.matchingVersion == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Code coverage (XML) (${{matrix.database}}, stable${{matrix.coreVersion}}, ${{matrix.httpServer}}, ${{matrix.phpVersion}}) | |
path: "/tmp/coverage/coverage.*.xml" | |
# - name: Upload the code coverage report (unit tests) as artifacts | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: Code coverage (HTML) (${{matrix.database}}, stable${{matrix.coreVersion}}, ${{matrix.httpServer}}, ${{matrix.phpVersion}}) | |
# path: "/tmp/coverage" | |
- name: Upload the junit log file artifact as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Junit test log files (${{matrix.database}}, stable${{matrix.coreVersion}}, ${{matrix.httpServer}}, ${{matrix.phpVersion}}) | |
path: .github/actions/run-tests/volumes/coverage/junit*.xml | |
if: steps.ncVersionRequirements.outputs.matchingVersion == 'true' && always() | |
unit-tests-master: | |
name: Run the tests against the master branch of the NC server | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout the app | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Ensure the appinfo is built | |
shell: bash | |
run: make appinfo/info.xml | |
#- name: Docker Layer Caching | |
#uses: satackey/[email protected] | |
- name: Run the tests in docker container | |
uses: ./.github/actions/run-tests | |
with: | |
db: mysql | |
coreVersion: master | |
phpVersion: "8.1" | |
server: apache | |
installUntested: true | |
- name: Upload the log file as artifact | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: Nextcloud-logs (mysql, master, apache) | |
path: .github/actions/run-tests/volumes/data/nextcloud.log | |
- name: Copy coverage-reports into non-link folder | |
shell: bash | |
run: >- | |
mkdir /tmp/coverage && | |
rsync -a .github/actions/run-tests/volumes/coverage/latest/ /tmp/coverage | |
- name: Upload the code coverage report for codecov as artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Code coverage (XML) (mysql, master, apache) | |
path: "/tmp/coverage/coverage.*.xml" | |
- name: Upload the junit log file artifact as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Junit test log files (mysql, master, apache) | |
path: .github/actions/run-tests/volumes/coverage/junit*.xml | |
if: always() | |
upload-codecov: | |
name: Upload artifacts to codecov.io | |
needs: | |
- unit-tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Create folder structure | |
run: mkdir artifacts code unit-coverage integration-coverage | |
- name: Download artifacts | |
if: ${{ github.event_name == 'push' }} | |
uses: actions/[email protected] | |
with: | |
path: artifacts | |
- name: Checkout of code base | |
if: ${{ github.event_name == 'push' }} | |
uses: actions/checkout@v4 | |
with: | |
path: code | |
fetch-depth: 2 | |
- name: Download the uploader | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import | |
curl -Os https://uploader.codecov.io/latest/linux/codecov | |
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM | |
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig | |
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM | |
shasum -a 256 -c codecov.SHA256SUM | |
chmod +x codecov | |
- name: Copy Coverage reports to separate folders | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
cd artifacts | |
for i in Code* | |
do | |
if [ -f "$i/coverage.unit.xml" ]; then | |
mkdir -p "../unit-coverage/$i" | |
cp "$i/coverage.unit.xml" "../unit-coverage/$i/coverage.xml" | |
fi | |
if [ -f "$i/coverage.integration.xml" ]; then | |
mkdir -p "../integration-coverage/$i" | |
cp "$i/coverage.integration.xml" "../integration-coverage/$i/coverage.xml" | |
fi | |
if [ -f "$i/coverage.migration.xml" ]; then | |
mkdir -p "../migration-coverage/$i" | |
cp "$i/coverage.migration.xml" "../migration-coverage/$i/coverage.xml" | |
fi | |
done | |
- name: Show file structure | |
if: ${{ github.event_name == 'push' }} | |
run: ls -lR *-coverage | |
- name: Upload unit test codecov reports | |
if: ${{ github.event_name == 'push' }} | |
run: >- | |
./codecov | |
-F unittests | |
-s unit-coverage | |
-R code | |
-X gcov | |
-v | |
- name: Upload integration test codecov reports | |
if: ${{ github.event_name == 'push' }} | |
run: >- | |
./codecov | |
-F integration | |
-s integration-coverage | |
-R code | |
-X gcov | |
-v | |
- name: Upload migration test codecov reports | |
if: ${{ github.event_name == 'push' }} | |
run: >- | |
./codecov | |
-F migration | |
-s migration-coverage | |
-R code | |
-X gcov | |
-v | |
source-package: | |
name: Create source code artifacts | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout the app | |
uses: actions/checkout@v4 | |
- name: Setup node and NPM | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '16' | |
- name: Install npm | |
shell: bash | |
run: npm install -g npm@^8 | |
- name: Get the date | |
id: date | |
run: echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT | |
- name: Use cache for NPM | |
uses: actions/[email protected] | |
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: Use cache for Composer | |
uses: actions/[email protected] | |
with: | |
path: | | |
vendor | |
key: ${{ runner.os }}-composer-${{ steps.date.outputs.date }}-${{ hashFiles('composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer-${{ steps.date.outputs.date }}- | |
${{ runner.os }}-composer- | |
- name: Install the NPM dependencies | |
shell: bash | |
run: >- | |
npm ci | |
- name: Install the dependencies for composer | |
shell: bash | |
run: >- | |
make composer_dist | |
- name: Build node app | |
shell: bash | |
run: >- | |
make npm | |
- name: Create the app store package | |
shell: bash | |
run: >- | |
make appstore_package_name=/tmp/appstore appstore | |
- name: Publish the app store package as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cookbook-appstore | |
path: /tmp/appstore.tar.gz | |
event_file: | |
name: "Upload Event File" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Event File | |
path: ${{ github.event_path }} | |
retention-days: 1 | |
lint-php: | |
name: "Lint PHP files to be compatible" | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout of the app | |
uses: actions/checkout@v4 | |
- name: build docker container image | |
run: docker build -t php-lint-tester .github/actions/php-linter | |
- name: Check the code base | |
run: docker run --rm -v $(pwd):/work:ro php-lint-tester | |
run-jest: | |
name: "Run JS tests" | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout of the app | |
uses: actions/checkout@v4 | |
- name: Get the date | |
id: date | |
run: echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT | |
- name: Cache NPM cache | |
uses: actions/[email protected] | |
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 the NPM dependencies | |
run: npm ci | |
- name: Run the tests | |
run: npm run ci-test | |
successful_run: | |
name: The tests have successfully run | |
runs-on: ubuntu-22.04 | |
needs: | |
- unit-tests | |
- code-lint | |
- source-package | |
- lint-php | |
- event_file | |
- run-jest | |
steps: | |
- name: Run successfully | |
shell: bash | |
run: echo "The tests have been running successfully" |