Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Setup CI #5

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# top-most EditorConfig file
root = true

# All PHP files MUST use the Unix LF (linefeed) line ending.
# Code MUST use an indent of 4 spaces, and MUST NOT use tabs for indenting.
# All PHP files MUST end with a single blank line.
# There MUST NOT be trailing whitespace at the end of non-blank lines.
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# PHP-Files, Composer.json, MD-Files
[{*.php,composer.json,*.md}]
indent_style = space
indent_size = 4

# HTML-Files LESS-Files SASS-Files CSS-Files JS-Files JSON-Files
[{*.html,*.less,*.sass,*.css,*.js,*.json}]
indent_style = tab
indent_size = 4

# Gitlab-CI, Travis-CI
[*.yml]
indent_style = space
indent_size = 2
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: composer
directories:
- "/"
- "packages/**"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
2 changes: 2 additions & 0 deletions .github/policies/kiota-php-branch-protection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ configuration:
requiresLinearHistory: false
# Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status
requiredStatusChecks:
# - validate-dependencies
# - check-build-and-coverage
- license/cla
# Require branches to be up to date before merging. This should be false since the repo contains autogenerated files. boolean
requiresStrictStatusChecks: false
Expand Down
101 changes: 101 additions & 0 deletions .github/policies/resourceManagement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
id:
name: GitOps.PullRequestIssueManagement
description: GitOps.PullRequestIssueManagement primitive
owner:
resource: repository
disabled: false
where:
configuration:
resourceManagementConfiguration:
scheduledSearches:
- description:
frequencies:
- hourly:
hour: 6
filters:
- isIssue
- isOpen
- hasLabel:
label: 'status:waiting-for-author-feedback'
- hasLabel:
label: 'Status: No Recent Activity'
- noActivitySince:
days: 3
actions:
- closeIssue
- description:
frequencies:
- hourly:
hour: 6
filters:
- isIssue
- isOpen
- hasLabel:
label: 'status:waiting-for-author-feedback'
- noActivitySince:
days: 4
- isNotLabeledWith:
label: 'Status: No Recent Activity'
actions:
- addLabel:
label: 'Status: No Recent Activity'
- addReply:
reply: This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
- description:
frequencies:
- hourly:
hour: 6
filters:
- isIssue
- isOpen
- hasLabel:
label: 'Resolution: Duplicate'
- noActivitySince:
days: 1
actions:
- addReply:
reply: This issue has been marked as duplicate and has not had any activity for **1 day**. It will be closed for housekeeping purposes.
- closeIssue
eventResponderTasks:
- if:
- payloadType: Issue_Comment
- isAction:
action: Created
- isActivitySender:
issueAuthor: True
- hasLabel:
label: 'status:waiting-for-author-feedback'
- isOpen
then:
- addLabel:
label: 'Needs: Attention :wave:'
- removeLabel:
label: 'status:waiting-for-author-feedback'
description:
- if:
- payloadType: Issues
- not:
isAction:
action: Closed
- hasLabel:
label: 'Status: No Recent Activity'
then:
- removeLabel:
label: 'Status: No Recent Activity'
description:
- if:
- payloadType: Issue_Comment
- hasLabel:
label: 'Status: No Recent Activity'
then:
- removeLabel:
label: 'Status: No Recent Activity'
description:
- if:
- payloadType: Pull_Request
then:
- inPrLabel:
label: WIP
description:
onFailure:
onSuccess:
32 changes: 32 additions & 0 deletions .github/workflows/auto-merge-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Auto-merge dependabot updates

on:
pull_request:
branches: [ main ]

permissions:
pull-requests: write
contents: write

jobs:

dependabot-merge:

runs-on: ubuntu-latest

if: ${{ github.actor == 'dependabot[bot]' }}

steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Enable auto-merge for Dependabot PRs
# Only if version bump is not a major version change
if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
109 changes: 109 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Build

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read
pull-requests: read

jobs:
validate-dependencies:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
- name: Install dependencies
run: composer install
- name: Validate dependencies are consistent across sub-projects
run: ./vendor/bin/monorepo-builder validate

build:
runs-on: ubuntu-latest
strategy:
matrix:
package-path: [
'abstractions',
'authentication/phpleague',
'http/guzzle',
'serialization/json',
'serialization/text',
'serialization/form'
]
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Install dependencies
working-directory: packages/${{ matrix.package-path }}
run: composer install
- name: Run static analysis
working-directory: packages/${{ matrix.package-path }}
run: ./vendor/bin/phpstan
- name: Run tests without coverage
working-directory: packages/${{ matrix.package-path }}
run: ./vendor/bin/phpunit --no-coverage

code-coverage:
runs-on: ubuntu-latest
strategy:
matrix:
package-path: [
'abstractions',
'authentication/phpleague',
'http/guzzle',
'serialization/json',
'serialization/text',
'serialization/form'
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP and Xdebug for Code Coverage report
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: xdebug
- name: Install dependencies
working-directory: packages/${{ matrix.package-path }}
run: composer install
- name: Run tests with coverage
working-directory: packages/${{ matrix.package-path }}
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Fix code coverage paths
working-directory: packages/${{ matrix.package-path }}
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
- name: SonarCloud Scan
if: ${{ !github.event.pull_request.head.repo.fork }}
uses: SonarSource/sonarqube-scan-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

# The check-php-version-matrix returns success if all matrix jobs in build are successful; otherwise, it returns a failure.
# Use this as a PR status check for GitHub Policy Service instead of individual matrix entry checks.
check-build-and-coverage:
runs-on: ubuntu-latest
needs: [build, code-coverage]
if: always()
steps:
- name: All build matrix options are successful
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: One or more build matrix options failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
38 changes: 38 additions & 0 deletions .github/workflows/conflicting-pr-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This is a basic workflow to help you get started with Actions

name: PullRequestConflicting

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ main ]
pull_request:
types: [synchronize]
branches: [ main ]

permissions:
pull-requests: write
contents: read

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: check if prs are dirty
uses: eps1lon/actions-label-merge-conflict@releases/2.x
if: env.LABELING_TOKEN != '' && env.LABELING_TOKEN != null
id: check
with:
dirtyLabel: "conflicting"
repoToken: "${{ secrets.GITHUB_TOKEN }}"
continueOnMissingPermissions: true
commentOnDirty: 'This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.'
commentOnClean: 'Conflicts have been resolved. A maintainer will take a look shortly.'
env:
LABELING_TOKEN: ${{secrets.GITHUB_TOKEN }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
composer.phar
composer.lock
/vendor/
/coverage
.idea/
tests/Functional/TestConstants.php
.phpunit.result.cache
.phpdoc/
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
# Project
# Kiota Libraries for PHP

> This repo has been populated by an initial template to help get you started. Please
> make sure to update the content to build a great experience for community-building.
The Kiota libraries provide the essential building blocks for Kiota-generated SDKs based on OpenAPI definitions, offering default implementations for serialization, authentication, and HTTP transport. These libraries are necessary for compiling and running any Kiota-generated project.

As the maintainer of this project, please make a few updates:
To learn more about Kiota, visit the [Kiota repository](https://github.com/microsoft/kiota).

## Build Status

![Build Status](https://github.com/microsoft/kiota-php/actions/workflows/build.yml/badge.svg)

## Libraries

| Library | PyPi Release | Changelog |
|---------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|
| [Abstractions](./packages/abstractions/README.md) | [![Latest Stable Version](https://poser.pugx.org/microsoft/kiota-abstractions/version)](https://packagist.org/packages/microsoft/kiota-abstractions) | [Changelog](./packages/abstractions/CHANGELOG.md) |
| [Authentication - PHPLeague](./packages/authentication/phpleague/README.md) | [![Latest Stable Version](https://poser.pugx.org/microsoft/kiota-authentication-phpleague/version)](https://packagist.org/packages/microsoft/kiota-authentication-phpleague) | [Changelog](./packages/authentication/phpleague/CHANGELOG.md) |
| [Http - Guzzle](./packages/http/guzzle/README.md) | [![Latest Stable Version](https://poser.pugx.org/microsoft/kiota-http-guzzle/version)](https://packagist.org/packages/microsoft/kiota-http-guzzle) | [Changelog](./packages/http/guzzle/CHANGELOG.md) |
| [Serialization - JSON](./packages/serialization/json/README.md) | [![Latest Stable Version](https://poser.pugx.org/microsoft/kiota-serialization-json/version)](https://packagist.org/packages/microsoft/kiota-serialization-json) | [Changelog](./packages/serialization/json/CHANGELOG.md) |
| [Serialization - FORM](./packages/serialization/form/README.md) | [![Latest Stable Version](http://poser.pugx.org/microsoft/kiota-serialization-form/version)](https://packagist.org/packages/microsoft/kiota-serialization-form) | [Changelog](./packages/serialization/form/CHANGELOG.md) |
| [Serialization - TEXT](./packages/serialization/text/README.md) | [![Latest Stable Version](http://poser.pugx.org/microsoft/kiota-serialization-text/version)](https://packagist.org/packages/microsoft/kiota-serialization-text) | [Changelog](./packages/serialization/text/CHANGELOG.md) |
| [Serialization - MULTIPART](./packages/serialization/multipart/README.md) | [![Latest Stable Version](https://poser.pugx.org/microsoft/kiota-serialization-multipart/version)](https://packagist.org/packages/microsoft/kiota-serialization-json) | [Changelog](./packages/serialization/multipart/CHANGELOG.md) |
| [Bundle](./packages/bundle/README.md) | [![Latest Stable Version](https://poser.pugx.org/microsoft/kiota-bundle/version)](https://packagist.org/packages/microsoft/kiota-bundle) | [Changelog](./packages/bundle/CHANGELOG.md) |

- Improving this README.MD file to provide a great experience
- Updating SUPPORT.MD with content about this project's support experience
- Understanding the security reporting process in SECURITY.MD
- Remove this section from the README

## Contributing

Expand All @@ -26,8 +38,8 @@ contact [[email protected]](mailto:[email protected]) with any additio

## Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.
Loading
Loading