Skip to content

Commit

Permalink
chore(CI): Update master php testing versions and workflow templates
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Jan 16, 2023
1 parent ad5a8a8 commit 6ea9af2
Show file tree
Hide file tree
Showing 17 changed files with 311 additions and 93 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/command-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,43 @@ jobs:

steps:
- name: Check actor permission
uses: skjnldsv/check-actor-permission@v2
uses: skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2.1
with:
require: write

- name: Add reaction on start
uses: peter-evans/create-or-update-comment@v1
uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # v2.1.0
with:
token: ${{ secrets.COMMAND_BOT_PAT }}
repository: ${{ github.event.repository.full_name }}
comment-id: ${{ github.event.comment.id }}
reaction-type: "+1"

- name: Parse command
uses: skjnldsv/parse-command-comment@master
uses: skjnldsv/parse-command-comment@e9cb9d1df338afed4295a59bbe27b4da53fd38a8 # master
id: command

# Init path depending on which command is run
- name: Init path
id: git-path
run: |
run: |
if ${{ startsWith(steps.command.outputs.arg1, '/') }}; then
echo "::set-output name=path::${{ github.workspace }}${{steps.command.outputs.arg1}}"
echo "path=${{ github.workspace }}${{steps.command.outputs.arg1}}" >> $GITHUB_OUTPUT
else
echo "::set-output name=path::${{ github.workspace }}${{steps.command.outputs.arg2}}"
echo "path=${{ github.workspace }}${{steps.command.outputs.arg2}}" >> $GITHUB_OUTPUT
fi
- name: Init branch
uses: xt0rted/pull-request-comment-branch@v1
uses: xt0rted/pull-request-comment-branch@653a7d5ca8bd91d3c5cb83286063314d0b063b8e # v1
id: comment-branch

process:
runs-on: ubuntu-latest
needs: init

steps:
- name: Checkout ${{ needs.init.outputs.head_ref }}
uses: actions/checkout@v3
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
token: ${{ secrets.COMMAND_BOT_PAT }}
fetch-depth: 0
Expand All @@ -66,14 +66,14 @@ jobs:
git config --local user.name "nextcloud-command"
- name: Read package.json node and npm engines version
uses: skjnldsv/[email protected]
uses: skjnldsv/read-package-engines-version-actions@1bdcee71fa343c46b18dc6aceffb4cd1e35209c6 # v1.2
id: package-engines-versions
with:
fallbackNode: '^12'
fallbackNpm: '^6'
fallbackNode: '^16'
fallbackNpm: '^7'

- name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
uses: actions/setup-node@v3
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
with:
node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}
cache: npm
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
git push --force origin ${{ needs.init.outputs.head_ref }}
- name: Add reaction on failure
uses: peter-evans/create-or-update-comment@v1
uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # v2.1.0
if: failure()
with:
token: ${{ secrets.COMMAND_BOT_PAT }}
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/command-rebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,40 @@ on:
issue_comment:
types: created

permissions:
contents: read

jobs:
rebase:
runs-on: ubuntu-latest
permissions:
contents: none

# On pull requests and if the comment starts with `/rebase`
if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/rebase')

steps:
- name: Add reaction on start
uses: peter-evans/create-or-update-comment@v2
uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # v2.1.0
with:
token: ${{ secrets.COMMAND_BOT_PAT }}
repository: ${{ github.event.repository.full_name }}
comment-id: ${{ github.event.comment.id }}
reaction-type: "+1"

- name: Checkout the latest code
uses: actions/checkout@v3
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
fetch-depth: 0
token: ${{ secrets.COMMAND_BOT_PAT }}

- name: Automatic Rebase
uses: cirrus-actions/rebase@1.6
uses: cirrus-actions/rebase@6e572f08c244e2f04f9beb85a943eb618218714d # 1.7
env:
GITHUB_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}

- name: Add reaction on failure
uses: peter-evans/create-or-update-comment@v2
uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # v2.1.0
if: failure()
with:
token: ${{ secrets.COMMAND_BOT_PAT }}
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/dependabot-approve-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,26 @@ on:
permissions:
contents: read

concurrency:
group: dependabot-approve-merge-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
auto-approve-merge:
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
permissions:
# for hmarr/auto-approve-action to approve PRs
pull-requests: write
pull-requests: write

steps:
# Github actions bot approve
- uses: hmarr/auto-approve-action@v2
- uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

# Nextcloud bot approve and merge request
- uses: ahmadnassri/action-dependabot-auto-merge@v2
- uses: ahmadnassri/action-dependabot-auto-merge@45fc124d949b19b6b8bf6645b6c9d55f4f9ac61a # v2
with:
target: minor
github-token: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }}
17 changes: 15 additions & 2 deletions .github/workflows/fixup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,29 @@

name: Pull request checks

on: pull_request
on:
pull_request:
types: [opened, ready_for_review, reopened]

permissions:
contents: read

concurrency:
group: fixup-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
commit-message-check:
if: github.event.pull_request.draft == false

permissions:
pull-requests: write
name: Block fixup and squash commits

runs-on: ubuntu-latest

steps:
- name: Run check
uses: xt0rted/block-autosquash-commits-action@v2
uses: xt0rted/block-autosquash-commits-action@79880c36b4811fe549cfffe20233df88876024e7 # v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
39 changes: 39 additions & 0 deletions .github/workflows/lint-eslint-when-unrelated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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
#
# Use lint-eslint together with lint-eslint-when-unrelated to make eslint a required check for GitHub actions
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks

name: Lint

on:
pull_request:
paths-ignore:
- '.github/workflows/**'
- 'src/**'
- 'appinfo/info.xml'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- '.eslintrc.*'
- '.eslintignore'
- '**.js'
- '**.ts'
- '**.vue'

permissions:
contents: read

jobs:
lint:
permissions:
contents: none

runs-on: ubuntu-latest

name: eslint

steps:
- run: 'echo "No eslint required"'
30 changes: 23 additions & 7 deletions .github/workflows/lint-eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,31 @@
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# Use lint-eslint together with lint-eslint-when-unrelated to make eslint a required check for GitHub actions
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks

name: Lint

on: pull_request
on:
pull_request:
paths:
- '.github/workflows/**'
- 'src/**'
- 'appinfo/info.xml'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- '.eslintrc.*'
- '.eslintignore'
- '**.js'
- '**.ts'
- '**.vue'

permissions:
contents: read

concurrency:
concurrency:
group: lint-eslint-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

Expand All @@ -22,17 +38,17 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3

- name: Read package.json node and npm engines version
uses: skjnldsv/[email protected]
uses: skjnldsv/read-package-engines-version-actions@1bdcee71fa343c46b18dc6aceffb4cd1e35209c6 # v1.2
id: versions
with:
fallbackNode: '^12'
fallbackNpm: '^6'
fallbackNode: '^16'
fallbackNpm: '^7'

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@v3
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/lint-php-cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on: pull_request
permissions:
contents: read

concurrency:
concurrency:
group: lint-php-cs-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

Expand All @@ -22,13 +22,15 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3

- name: Set up php
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2
with:
php-version: "7.4"
php-version: 8.1
coverage: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: composer i
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/lint-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
permissions:
contents: read

concurrency:
concurrency:
group: lint-php-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

Expand All @@ -25,19 +25,21 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.4", "8.0", "8.1"]
php-versions: [ "8.0", "8.1", "8.2" ]

name: php-lint

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Lint
run: composer run lint
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/lint-stylelint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on: pull_request
permissions:
contents: read

concurrency:
concurrency:
group: lint-stylelint-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

Expand All @@ -22,17 +22,17 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3

- name: Read package.json node and npm engines version
uses: skjnldsv/[email protected]
uses: skjnldsv/read-package-engines-version-actions@1bdcee71fa343c46b18dc6aceffb4cd1e35209c6 # v1.2
id: versions
with:
fallbackNode: '^12'
fallbackNpm: '^6'
fallbackNode: '^16'
fallbackNpm: '^7'

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@v3
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

Expand Down
Loading

0 comments on commit 6ea9af2

Please sign in to comment.