Skip to content

Commit

Permalink
Merge pull request #1401 from microsoftgraph/dev
Browse files Browse the repository at this point in the history
Release 2.0.0 🚀
  • Loading branch information
SilasKenneth authored Nov 9, 2023
2 parents 14b1b9f + 63e7749 commit 13013b8
Show file tree
Hide file tree
Showing 37,000 changed files with 2,013,251 additions and 1,114,522 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 3 additions & 3 deletions .github/policies/msgraph-sdk-php-branch-protection.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Microsoft Corporation.
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# File initially created using https://github.com/MIchaelMainer/policyservicetoolkit/blob/main/branch_protection_export.ps1.
Expand Down Expand Up @@ -35,7 +35,7 @@ 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-pull-request #TODO: add this back once we are using Kiota
- check-php-version-matrix
# Require branches to be up to date before merging. Requires requiredStatusChecks. boolean
requiresStrictStatusChecks: true
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
Expand Down Expand Up @@ -69,7 +69,7 @@ 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-pull-request #TODO: add this back once we are using Kiota
- check-php-version-matrix
# Require branches to be up to date before merging. Requires requiredStatusChecks. boolean
requiresStrictStatusChecks: true
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/bump-generated-sdk-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

name: "Bump SDK version in generated pull request"

# Controls when the action will run. Triggers the workflow on push
# events but only for branches with the following branch spec: kiota/v1.0/pipelinebuild/*
on:
push:
branches:
- "kiota/v1.0/pipelinebuild/*"
paths:
- 'src/Generated/**'

defaults:
run:
shell: bash

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
bump-sdk-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Git config user
run: |
git config --global user.email "GraphTooling@service.microsoft.com"
git config --global user.name "Microsoft Graph DevX Tooling"
- name: Run increment script
run: php scripts/BumpStableSdkVersion.php

- name: Commit and push changes if any
run: if git commit -am "Bump SDK version"; then git push origin $GITHUB_REF; fi
35 changes: 0 additions & 35 deletions .github/workflows/bump-sdk-version.yml

This file was deleted.

30 changes: 26 additions & 4 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
name: "create release"

on:
push:
tags:
'*'
workflow_dispatch:

defaults:
run:
shell: bash

jobs:
create-tag:
runs-on: ubuntu-latest
outputs:
SDK_VERSION: ${{ steps.tag-step.outputs.SDK_VERSION }}
steps:
- uses: actions/checkout@v3

- name: Get SDK version and set environment variable
run: |
SDK_VERSION=$(grep 'SDK_VERSION' src/GraphConstants.php | grep -oE '[0-9]+\.[0-9]+\.[0-9A-Za-z.\-]+')
echo "SDK_VERSION=$SDK_VERSION" >> $GITHUB_ENV
- id: tag-step
name: Create and publish tag
run: |
echo "SDK_VERSION is:"$SDK_VERSION
git tag $SDK_VERSION && git push origin $SDK_VERSION
echo "SDK_VERSION=$SDK_VERSION" >> "$GITHUB_OUTPUT"
create-release:
needs: create-tag
env:
SDK_VERSION: ${{ needs.create-tag.outputs.SDK_VERSION }}
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -20,5 +40,7 @@ jobs:
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
prerelease: ${{ contains(github.ref_name, 'RC') }}
prerelease: ${{ contains( env.SDK_VERSION, 'RC') }}
skipIfReleaseExists: true
tag: ${{ env.SDK_VERSION }}
name: "Release ${{ env.SDK_VERSION }}"
31 changes: 26 additions & 5 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: "Validate Pull Request"

on:
push:
branches: [ main, dev ]
branches: [ main, dev, feat/kiota-preview ]
pull_request:
branches: [ main, dev ]
branches: [ main, dev, feat/kiota-preview ]

defaults:
run:
Expand All @@ -16,17 +16,38 @@ defaults:
jobs:
validate-pull-request:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1', '8.2']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- uses: actions/checkout@v4
- name: Validate composer file
run: |
composer validate
- name: Install dependencies
run: |
composer install
composer install -a
- name: run tests
run : |
vendor/bin/phpunit --exclude-group functional
vendor/bin/phpunit --coverage-text
- name: Run static analysis
run: |
vendor/bin/phpstan analyse --memory-limit=1500M --error-format=github
vendor/bin/phpstan analyse --memory-limit=8G --error-format=github
# 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-php-version-matrix:
runs-on: ubuntu-latest
needs: validate-pull-request
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
31 changes: 0 additions & 31 deletions .github/workflows/tag-release.yml

This file was deleted.

21 changes: 15 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,36 @@ There are a few different recommended paths to get contributions into the releas
The best way to get started with a contribution is to start a dialog with us. Sometimes features will be under development or out of scope for this library and it's best to check before starting work on contribution, especially for large work items.

## Pull requests
If you are making documentation changes, feel free to submit a pull request against the **master** branch. All other pull requests should be submitted against the **dev** branch or a specific feature branch. The master branch is intended to represent the code released in the most-recent composer package.
If you are making documentation changes, feel free to submit a pull request against the **main** branch. All other pull requests should be submitted against the **dev** branch or a specific feature branch. The master branch is intended to represent the code released in the most-recent composer package.

When a new package is about to be released, changes in dev will be merged into master. The package will be generated from master.

Some things to note about this project:

### How the library is built
The PHP SDK has a handwritten set of core files and a folder of autogenerated models. These models are generated using the [MSGraph SDK Code Generator](https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator). **Changes made to the ```Models``` folder will be overwritten** the next time the generator is run.
The PHP SDK has a mix of handwritten "core" files and a folder of autogenerated models and request builder classes.

If you would like to make changes to the models, you can either file an issue or make a PR in the [MSGraph SDK Code Generator](https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator) to the [templates](https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator/tree/master/Templates/PHP/Model). Although there is a lot of logic in the generator, the code used for PHP is fairly minimal.
The models and request builders are generated using [Kiota](https://github.com/microsoft/kiota). **Changes made to the ```Generated``` folder will be overwritten** the next time the generator is run - currently every week on Tuesday. Feel free to contribute to the generated code there.

Hand-written core files are spread across:

- [PHP Core](https://github.com/microsoftgraph/msgraph-sdk-php-core) which contains Graph specific configuration
- [Kiota Abstractions](https://github.com/microsoft/kiota-abstractions-php) which contains all interfaces that tie the SDK together
- [Kiota HTTP using Guzzle](https://github.com/microsoft/kiota-http-guzzle-php) which handles HTTP level concerns
- [Kiota Authentication using PHP League](https://github.com/microsoft/kiota-authentication-phpleague-php) which handles Authentication
- [Kiota Serialization JSON](https://github.com/microsoft/kiota-serialization-json-php) which handles JSON (de)/serialization
- [Kiota Serialization Text](https://github.com/microsoft/kiota-serialization-text-php) which handles `text/plain` (de)/serialization

### How the generator works
You can view the [README](https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator/blob/master/README.md) for a full run-through of its capabilities.
You can view the [README](https://github.com/microsoft/kiota) for a full run-through of its capabilities.

For the purposes of the PHP library, the generator runs through an OData-compliant metadata file published by Microsoft Graph (https://graph.microsoft.com/v1.0/$metadata) and builds up a list of models. These models are converted into PHP code using T4 templates, which use C# to programmatically define what PHP code is written to the file.
For the purposes of the PHP library, the generator runs through an OpenAPI schema description of the Microsoft Graph API (https://github.com/microsoftgraph/msgraph-metadata/blob/master/openapi/v1.0/openapi.yaml) and builds up a list of models and request builders based on the paths.

### When new features are added to the library
Generation happens as part of a manual process that occurs once a significant change or set of changes has been added to the Graph. This may include:
- A new workload comes to v1.0 of Graph (Microsoft Teams, Batching, etc.)
- There is significant addition of functionality (Delta Queries, etc.)

However, this is evaluated on a case-by-case basis. If the library is missing v1.0 Graph functionality that you wish to utilize, please [file an issue](https://github.com/microsoftgraph/msgraph-sdk-php/issues).

We do our best to prevent breaking changes from being introduced into the library during this process. If you find a breaking change, please file an issue and we will work to get this resolved ASAP.
Expand Down
Loading

0 comments on commit 13013b8

Please sign in to comment.