diff options
Diffstat (limited to '.github')
-rw-r--r-- | .github/dependabot.yml | 4 | ||||
-rw-r--r-- | .github/pull_request_template.md | 12 | ||||
-rw-r--r-- | .github/release-drafter.yml | 30 | ||||
-rw-r--r-- | .github/workflows/api-integration-tests.yml | 53 | ||||
-rw-r--r-- | .github/workflows/api-php-static-code-check.yml | 23 | ||||
-rw-r--r-- | .github/workflows/api-php-tests.yml | 25 | ||||
-rw-r--r-- | .github/workflows/build-release.yml | 14 | ||||
-rw-r--r-- | .github/workflows/changelog-enforcer.yml | 5 | ||||
-rw-r--r-- | .github/workflows/documentation.yml | 4 | ||||
-rw-r--r-- | .github/workflows/frontend-nodejs-tests.yml | 8 | ||||
-rw-r--r-- | .github/workflows/lint-eslint.yml | 46 | ||||
-rw-r--r-- | .github/workflows/lint.yml | 52 | ||||
-rw-r--r-- | .github/workflows/post-merge-tasks.yml | 23 | ||||
-rw-r--r-- | .github/workflows/updater-test.yml | 80 |
14 files changed, 293 insertions, 86 deletions
diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 561141b9e..fbf793116 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,12 +7,13 @@ version: 2 updates: # Maintain dependencies for npm - package-ecosystem: "npm" - directory: "/js" + directory: "/" schedule: interval: "daily" labels: - "dependencies" - "Skip-Changelog" + versioning-strategy: increase # Maintain dependencies for Composer - package-ecosystem: "composer" @@ -22,6 +23,7 @@ updates: labels: - "dependencies" - "Skip-Changelog" + versioning-strategy: increase # Maintain dependencies for GitHub Actions - package-ecosystem: "github-actions" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..ff211fb84 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,12 @@ + +* Resolves: # <!-- related github issue --> + +## Summary + +<!-- your text --> + +## Checklist + +- Code is [properly formatted](https://nextcloud.github.io/news/developer/#coding-style-guidelines) +- [Sign-off message](https://github.com/src-d/guide/blob/master/developer-community/fix-DCO.md) is added to all commits +- Changelog entry added for all important changes. diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml deleted file mode 100644 index b983f6e58..000000000 --- a/.github/release-drafter.yml +++ /dev/null @@ -1,30 +0,0 @@ -name-template: '$RESOLVED_VERSION' -tag-template: '$RESOLVED_VERSION' -categories: - - title: 'Changed' - labels: - - 'change' - - 'enhancement' - - title: 'Fixed' - labels: - - 'fix' - - 'bugfix' - - 'bug' - - title: 'Dependencies' - labels: - - 'dependencies' -change-template: '- $TITLE @$AUTHOR (#$NUMBER)' -change-title-escapes: '\<*_&' -version-resolver: - major: - labels: - - 'major' - minor: - labels: - - 'minor' - patch: - labels: - - 'patch' - default: patch -template: | - $CHANGES diff --git a/.github/workflows/api-integration-tests.yml b/.github/workflows/api-integration-tests.yml index 297ee7446..0ab974e2a 100644 --- a/.github/workflows/api-integration-tests.yml +++ b/.github/workflows/api-integration-tests.yml @@ -16,7 +16,7 @@ jobs: name: "Integration: Nextcloud ${{ matrix.nextcloud }} - PHP ${{ matrix.php-versions }} - DB ${{ matrix.database }}" services: postgres: - image: postgres + image: postgres:14 env: POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} options: >- @@ -28,22 +28,24 @@ jobs: - 5432:5432 # Maps tcp port 5432 on service container to the host strategy: matrix: - php-versions: ['7.3', '7.4'] - nextcloud: ['stable20', 'stable21', 'stable22'] + php-versions: ['8.0', '8.1'] + nextcloud: ['stable27'] database: ['sqlite', 'pgsql', 'mysql'] experimental: [false] include: - - php-versions: 7.4 + - php-versions: 8.1 nextcloud: pre-release database: sqlite experimental: true - - php-versions: 8.0 + - php-versions: 8.2 nextcloud: pre-release database: sqlite experimental: true steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v4 + with: + submodules: recursive - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -51,9 +53,11 @@ jobs: php-version: ${{ matrix.php-versions }} extensions: pdo_sqlite,pdo_mysql,pdo_pgsql,gd,zip coverage: none + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Setup BATS - uses: mig4/setup-bats@v1.2.0 + - name: Setup BATS & httpie + run: sudo apt-get install -y httpie && npm install -g bats@1.7.0 ### MySQL specific setup - name: Setup mysql @@ -95,17 +99,30 @@ jobs: database-password: ${{ env.POSTGRES_PASSWORD }} - name: Prime app build - run: make + run: make composer - name: Configure server with app uses: SMillerDev/nextcloud-actions/setup-nextcloud-app@main with: app: 'news' - check-code: true + check-code: false force: ${{ matrix.experimental }} - - name: Setup problem matchers for PHP - run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + - name: Run API tests + working-directory: ../server + run: | + php -S localhost:8080 &> /tmp/webserver.log & + cd apps/news/tests/test_helper/feeds && php -S localhost:8090 &> /tmp/feedserver.log & + + sleep 2 + + cd ${{ github.workspace }}/../server + + bats apps/news/tests/api + + # Kill php server + kill %1 + kill %2 - name: Functional tests maintenance working-directory: ../server @@ -114,7 +131,16 @@ jobs: - name: Functional tests working-directory: ../server - run: bats apps/news/tests/integration + run: | + cd apps/news/tests/test_helper/feeds && php -S localhost:8090 &> /tmp/feedserver.log & + + sleep 2 + + cd ${{ github.workspace }}/../server + + bats apps/news/tests/command + + kill %1 - name: Prep PHP tests working-directory: ../server/apps/news @@ -123,3 +149,4 @@ jobs: - name: Feed tests working-directory: ../server/apps/news run: make feed-test + diff --git a/.github/workflows/api-php-static-code-check.yml b/.github/workflows/api-php-static-code-check.yml index 5f9216a4b..9a37fc40c 100644 --- a/.github/workflows/api-php-static-code-check.yml +++ b/.github/workflows/api-php-static-code-check.yml @@ -7,19 +7,26 @@ jobs: continue-on-error: true strategy: matrix: - php-versions: [ '7.4' ] - nextcloud: [ 'stable22' ] + php-versions: ['8.0', '8.1', '8.2' ] + nextcloud: [ 'stable27' ] database: [ 'sqlite' ] - name: "phpstan: Nextcloud ${{ matrix.nextcloud }}" + include: + - php-versions: 8.2 + nextcloud: pre-release + database: sqlite + experimental: true + name: "phpstan: Nextcloud ${{ matrix.nextcloud }} with ${{ matrix.php-versions }}" steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v4 - name: Set up php uses: shivammathur/setup-php@master with: - php-version: 7.4 + php-version: ${{ matrix.php-versions }} extensions: pdo_sqlite,pdo_mysql,pdo_pgsql,gd,zip coverage: none + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Set up server non MySQL uses: SMillerDev/nextcloud-actions/setup-nextcloud@main @@ -29,13 +36,13 @@ jobs: database-type: ${{ matrix.database }} - name: Build app - run: make + run: make composer - name: Configure server with app uses: SMillerDev/nextcloud-actions/setup-nextcloud-app@main with: app: 'news' - check-code: true + check-code: false force: true - name: Prep code scanning @@ -44,7 +51,7 @@ jobs: - name: PHPCS working-directory: ../server/apps/news - run: pwd && make phpcs #debug pwd + run: make phpcs - name: PHPStan working-directory: ../server/apps/news diff --git a/.github/workflows/api-php-tests.yml b/.github/workflows/api-php-tests.yml index 838522bae..2fb790770 100644 --- a/.github/workflows/api-php-tests.yml +++ b/.github/workflows/api-php-tests.yml @@ -9,13 +9,22 @@ jobs: name: "PHP: Nextcloud ${{ matrix.nextcloud }} - PHP ${{ matrix.php-versions }} - DB ${{ matrix.database }}" strategy: matrix: - php-versions: ['7.4'] - nextcloud: ['stable22'] + php-versions: ['8.1'] + nextcloud: ['stable27'] database: ['sqlite'] experimental: [false] + codecoverage: [false] + include: + - php-versions: 8.2 + nextcloud: stable27 + database: sqlite + experimental: false + codecoverage: true steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v4 + with: + fetch-depth: 2 # https://github.com/codecov/codecov-action/issues/190#issuecomment-790729633 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -23,6 +32,8 @@ jobs: php-version: ${{ matrix.php-versions }} extensions: pdo_sqlite,pdo_mysql,pdo_pgsql,gd,zip coverage: pcov + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ### Back to normal setup - name: Set up server non MySQL @@ -39,10 +50,7 @@ jobs: uses: SMillerDev/nextcloud-actions/setup-nextcloud-app@main with: app: 'news' - check-code: true - - - name: Setup problem matchers for PHPUnit - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + check-code: false - name: Prep PHP tests working-directory: ../server/apps/news @@ -50,6 +58,9 @@ jobs: - name: Unittests working-directory: ../server/apps/news run: make unit-test + env: + CODECOVERAGE: ${{ matrix.codecoverage }} - name: Upload codecoverage + if: ${{ matrix.codecoverage }} working-directory: ../server/apps/news run: bash <(curl -s https://codecov.io/bash) -f build/php-unit.clover -N ${{ github.sha }} diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index ab1e77fa3..c8f5a988a 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -14,22 +14,22 @@ jobs: name: "Release: build, sign and upload the app" strategy: matrix: - php-versions: ['7.4'] - nextcloud: ['stable22'] + php-versions: ['8.1'] + nextcloud: ['stable27'] database: ['sqlite'] steps: - name: Checkout - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f + uses: actions/checkout@v4 - name: Setup PHP - uses: shivammathur/setup-php@afefcaf556d98dc7896cca380e181decb609ca44 + uses: shivammathur/setup-php@7fdd3ece872ec7ec4c098ae5ab7637d5e0a96067 #2.26.0 with: php-version: ${{ matrix.php-versions }} extensions: pdo_sqlite,pdo_mysql,pdo_pgsql,gd,zip coverage: none - name: Set up server non MySQL - uses: SMillerDev/nextcloud-actions/setup-nextcloud@fae87e29aa7cdf1ea0b8033c67f60e75b10be2cd + uses: SMillerDev/nextcloud-actions/setup-nextcloud@1e38cb369e2193642279c64ee140fc93ddd4fa77 with: cron: false version: ${{ matrix.nextcloud }} @@ -39,7 +39,7 @@ jobs: run: make - name: Configure server with app - uses: SMillerDev/nextcloud-actions/setup-nextcloud-app@fae87e29aa7cdf1ea0b8033c67f60e75b10be2cd + uses: SMillerDev/nextcloud-actions/setup-nextcloud-app@1e38cb369e2193642279c64ee140fc93ddd4fa77 with: app: ${{ env.APP_NAME }} check-code: false @@ -52,7 +52,7 @@ jobs: app_public_crt: ${{ secrets.APP_PUBLIC_CRT }} - name: Upload app tarball to release - uses: svenstaro/upload-release-action@483c1e56f95e88835747b1c7c60581215016cbf2 + uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd id: attach_to_release with: repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/changelog-enforcer.yml b/.github/workflows/changelog-enforcer.yml index b7140c344..d4f7c073d 100644 --- a/.github/workflows/changelog-enforcer.yml +++ b/.github/workflows/changelog-enforcer.yml @@ -8,8 +8,7 @@ jobs: changelog: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 - - uses: dangoslen/changelog-enforcer@v2.2.0 + - uses: dangoslen/changelog-enforcer@v3 with: changeLogPath: 'CHANGELOG.md' - skipLabels: 'Skip-Changelog'
\ No newline at end of file + skipLabels: 'Skip-Changelog' diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 409fb4da8..ddf60315f 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -3,6 +3,8 @@ on: push: branches: - master + paths: + - 'docs/**' jobs: build: @@ -10,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout master - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Deploy docs uses: mhausenblas/mkdocs-deploy-gh-pages@master diff --git a/.github/workflows/frontend-nodejs-tests.yml b/.github/workflows/frontend-nodejs-tests.yml index 5035cd589..6b0cbbed9 100644 --- a/.github/workflows/frontend-nodejs-tests.yml +++ b/.github/workflows/frontend-nodejs-tests.yml @@ -9,13 +9,13 @@ jobs: name: "Frontend: Nextcloud ${{ matrix.nextcloud }} - PHP ${{ matrix.php-versions }} - DB ${{ matrix.database }}" strategy: matrix: - php-versions: ['7.4'] - nextcloud: ['stable22'] + php-versions: ['8.1'] + nextcloud: ['stable27'] database: ['sqlite'] experimental: [false] steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -39,7 +39,7 @@ jobs: uses: SMillerDev/nextcloud-actions/setup-nextcloud-app@main with: app: 'news' - check-code: true + check-code: false - name: Install frontend requirements run: sudo apt update && sudo apt install firefox diff --git a/.github/workflows/lint-eslint.yml b/.github/workflows/lint-eslint.yml new file mode 100644 index 000000000..2fd40e8dd --- /dev/null +++ b/.github/workflows/lint-eslint.yml @@ -0,0 +1,46 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization + +name: Lint + +on: pull_request + +permissions: + contents: read + +concurrency: + group: lint-eslint-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + + name: eslint + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Read package.json node and npm engines version + uses: skjnldsv/read-package-engines-version-actions@v3 + id: versions + with: + fallbackNode: '^16' + fallbackNpm: '^6' + + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@v4 + with: + node-version: ${{ steps.versions.outputs.nodeVersion }} + + - name: Set up npm ${{ steps.versions.outputs.npmVersion }} + run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" + + - name: Install dependencies + run: npm ci + + - name: Lint + run: npm run lint diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..fd3a5bf8d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,52 @@ +name: Lint + +on: + pull_request: + push: + branches: + - master + +jobs: + eslint: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + name: eslint node${{ matrix.node-versions }} + steps: + - uses: actions/checkout@v4 + + - name: Set up node ${{ matrix.node-versions }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-versions }} + + - name: Install dependencies + run: npm ci + + - name: Lint + run: npm run lint + + stylelint: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + name: stylelint node${{ matrix.node-versions }} + steps: + - uses: actions/checkout@v4 + + - name: Set up node ${{ matrix.node-versions }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-versions }} + + - name: Install dependencies + run: npm ci + + - name: Lint + run: npm run stylelint diff --git a/.github/workflows/post-merge-tasks.yml b/.github/workflows/post-merge-tasks.yml index dd6b1454d..58859acec 100644 --- a/.github/workflows/post-merge-tasks.yml +++ b/.github/workflows/post-merge-tasks.yml @@ -4,28 +4,23 @@ on: branches: - master jobs: - update-release-draft: - runs-on: ubuntu-latest - name: "Release Drafter" - steps: - - uses: release-drafter/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} php: runs-on: ubuntu-latest continue-on-error: false - name: "Coverage: Nextcloud PHP ${{ matrix.php-versions }}" + name: "Coverage: Nextcloud ${{ matrix.nextcloud }} PHP ${{ matrix.php-version }}" strategy: matrix: - nextcloud: ['stable22'] + nextcloud: ['stable27'] + codecoverage: [true] + php-version: ["8.1"] steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.4' + php-version: ${{ matrix.php-version }} ### Back to normal setup - name: Set up server non MySQL @@ -42,11 +37,15 @@ jobs: uses: SMillerDev/nextcloud-actions/setup-nextcloud-app@main with: app: 'news' - check-code: true + check-code: false - name: Prep PHP tests run: cd ../server/apps/news && make php-test-dependencies + - name: Unittests run: cd ../server/apps/news && make unit-test + env: + CODECOVERAGE: ${{ matrix.codecoverage }} + - name: Upload codecoverage run: cd ../server/apps/news && bash <(curl -s https://codecov.io/bash) -f build/php-unit.clover diff --git a/.github/workflows/updater-test.yml b/.github/workflows/updater-test.yml new file mode 100644 index 000000000..3f9b217ee --- /dev/null +++ b/.github/workflows/updater-test.yml @@ -0,0 +1,80 @@ +name: Updater Tests +on: + pull_request + +env: + POSTGRES_PASSWORD: nc_test_db + MYSQL_USER: nc_test + MYSQL_PASSWORD: nc_test_db + MYSQL_DATABASE: nc_test + MYSQL_PORT: 3800 + +jobs: + integration: + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.experimental }} + name: "Update Test: Nextcloud ${{ matrix.nextcloud }} - PHP ${{ matrix.php-versions }}" + strategy: + matrix: + php-versions: ['8.1'] + nextcloud: ['stable27'] + database: ['sqlite'] + experimental: [false] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: pdo_sqlite,pdo_mysql,pdo_pgsql,gd,zip + coverage: none + + - name: Setup BATS & httpie + run: sudo apt-get install -y httpie && npm install -g bats@1.7.0 + + - name: Set up server + uses: SMillerDev/nextcloud-actions/setup-nextcloud@main + with: + version: ${{ matrix.nextcloud }} + cron: true + database-type: ${{ matrix.database }} + database-host: localhost + database-port: 5432 + database-name: postgres + database-user: postgres + database-password: ${{ env.POSTGRES_PASSWORD }} + + - name: Prime app build + run: make + + - name: Configure server with app + uses: SMillerDev/nextcloud-actions/setup-nextcloud-app@main + with: + app: 'news' + check-code: false + force: ${{ matrix.experimental }} + + - name: Install composer install php-feed-generator + working-directory: ../server + run: composer install -d apps/news/tests/test_helper/php-feed-generator + + - name: Run Updater tests + working-directory: ../server + run: | + php -S localhost:8080 &> /tmp/webserver.log & + cd apps/news/tests/test_helper/feeds && php -S localhost:8090 &> /tmp/feedserver.log & + + sleep 2 + + cd ${{ github.workspace }}/../server + + bats apps/news/tests/updater + + # Kill php server + kill %1 + kill %2 + |