diff --git a/.github/workflows/build-artifacts-code.yml b/.github/workflows/build-artifacts-code.yml new file mode 100644 index 000000000..b39044b56 --- /dev/null +++ b/.github/workflows/build-artifacts-code.yml @@ -0,0 +1,43 @@ +name: Build artifacts + +# ==== NOTE: do not rename this yml file or the run_number will be reset ==== + +on: + push: + branches: + - master + - develop + paths: + - src/** + - "*.sln" + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + +jobs: + pack: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core 5.0 SDK + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '5.0.x' + source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json + env: + NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Install dependencies + run: dotnet restore + - name: Build solution [Release] + run: dotnet build --no-restore -c Release -p:VersionSuffix=$GITHUB_RUN_NUMBER + - name: Pack solution [Release] + run: dotnet pack --no-restore --no-build -c Release -p:VersionSuffix=$GITHUB_RUN_NUMBER -o out + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: Nuget packages + path: | + out/* + - name: Publish Nuget packages to GitHub registry + run: dotnet nuget push "out/*" -k ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/publish-code.yml b/.github/workflows/publish-code.yml new file mode 100644 index 000000000..8b553b43e --- /dev/null +++ b/.github/workflows/publish-code.yml @@ -0,0 +1,70 @@ +name: Publish code + +on: + release: + types: + - published + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check github.ref starts with 'refs/tags/' + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: | + echo Error! github.ref does not start with 'refs/tags' + echo github.ref: ${{ github.ref }} + exit 1 + - name: Set version number environment variable + env: + github_ref: ${{ github.ref }} + run: | + version="${github_ref:10}" + echo version=$version + echo "version=$version" >> $GITHUB_ENV + - name: Setup .NET Core 5.0 SDK + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '5.0.x' + source-url: https://api.nuget.org/v3/index.json + env: + NUGET_AUTH_TOKEN: ${{secrets.NUGET_AUTH_TOKEN}} + - name: Install dependencies + run: dotnet restore + - name: Build solution [Release] + run: dotnet build --no-restore -c Release -p:Version=$version + - name: Pack solution [Release] + run: dotnet pack --no-restore --no-build -c Release -p:Version=$version -o out + - name: Upload Nuget packages as workflow artifacts + uses: actions/upload-artifact@v2 + with: + name: Nuget packages + path: | + out/* + - name: Publish Nuget packages to Nuget registry + run: dotnet nuget push "out/*" -k ${{secrets.NUGET_AUTH_TOKEN}} + - name: Upload Nuget packages as release artifacts + uses: actions/github-script@v2 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + console.log('environment', process.versions); + const fs = require('fs').promises; + const { repo: { owner, repo }, sha } = context; + + for (let file of await fs.readdir('src/out')) { + console.log('uploading', file); + + await github.repos.uploadReleaseAsset({ + owner, + repo, + release_id: ${{ github.event.release.id }}, + name: file, + data: await fs.readFile(`out/${file}`) + }); + } diff --git a/.github/workflows/test-code.yml b/.github/workflows/test-code.yml new file mode 100644 index 000000000..ad84ae7c1 --- /dev/null +++ b/.github/workflows/test-code.yml @@ -0,0 +1,70 @@ +name: Test code + +on: + pull_request: + branches: + - master + - develop + paths: + - src/** + - .github/workflows/** + - "*.sln" + # Upload code coverage results when PRs are merged + push: + branches: + - master + - develop + paths: + - src/** + - .github/workflows/** + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + graphqlversion: + - 4.0.2 + - 4.1.0 + - 4.2.0 + - 4.3.0 + - 4.4.0 + steps: + - name: Checkout source + uses: actions/checkout@v2 + - name: Setup .NET Core 5.0 SDK + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '5.0.x' + source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json + env: + NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Install dependencies with GraphQL version ${{ matrix.graphqlversion }} + run: dotnet restore -p:GraphQLTestVersion=${{ matrix.graphqlversion }} + - name: Build solution [Release] + if: ${{ startsWith(matrix.os, 'ubuntu') }} + run: dotnet build --no-restore -c Release -p:GraphQLTestVersion=${{ matrix.graphqlversion }} + - name: Build solution [Debug] + run: dotnet build --no-restore -c Debug -p:GraphQLTestVersion=${{ matrix.graphqlversion }} + - name: Test solution [Debug] + run: dotnet test --no-restore --no-build + + buildcheck: + needs: + - test + runs-on: ubuntu-latest + if: always() + steps: + - name: Pass build check + if: ${{ needs.test.result == 'success' }} + run: exit 0 + - name: Fail build check + if: ${{ needs.test.result != 'success' }} + run: exit 1 diff --git a/.github/workflows/wipcheck.yml b/.github/workflows/wipcheck.yml new file mode 100644 index 000000000..a61e9abe7 --- /dev/null +++ b/.github/workflows/wipcheck.yml @@ -0,0 +1,22 @@ +name: Check if PR title contains [WIP] + +on: + pull_request: + types: + - opened # when PR is opened + - edited # when PR is edited + - synchronize # when code is added + - reopened # when a closed PR is reopened + +jobs: + check-title: + runs-on: ubuntu-latest + + steps: + - name: Fail build if pull request title contains [WIP] + env: + TITLE: ${{ github.event.pull_request.title }} + if: ${{ contains(github.event.pull_request.title, '[WIP]') }} # This function is case insensitive. + run: | + echo Warning! PR title "$TITLE" contains [WIP]. Remove [WIP] from the title when PR is ready. + exit 1 diff --git a/GraphQL.Relay.sln b/GraphQL.Relay.sln index 1ac3f8a6f..279647d72 100644 --- a/GraphQL.Relay.sln +++ b/GraphQL.Relay.sln @@ -10,6 +10,21 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Relay.StarWars", "s EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Relay.Todo", "src\GraphQL.Relay.Todo\GraphQL.Relay.Todo.csproj", "{15AFC7EC-11E6-469F-87DF-D1E396463BE9}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{2F92B771-95CF-4FC3-AE9A-52E9273349F1}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{FA0A321D-0F73-478E-9B1D-495A96F4BF6D}" + ProjectSection(SolutionItems) = preProject + .github\workflows\build-artifacts-code.yml = .github\workflows\build-artifacts-code.yml + .github\workflows\publish-code.yml = .github\workflows\publish-code.yml + .github\workflows\test-code.yml = .github\workflows\test-code.yml + .github\workflows\wipcheck.yml = .github\workflows\wipcheck.yml + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Solution Items", ".Solution Items", "{5EBDC740-68FC-451D-9F02-B81314A5059E}" + ProjectSection(SolutionItems) = preProject + src\Directory.Build.props = src\Directory.Build.props + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -72,6 +87,9 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {FA0A321D-0F73-478E-9B1D-495A96F4BF6D} = {2F92B771-95CF-4FC3-AE9A-52E9273349F1} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {26C9760C-72D8-43A7-B0D6-FA4AE10D5F06} EndGlobalSection diff --git a/UpgradeLog.htm b/UpgradeLog.htm deleted file mode 100644 index 46e2d75fc..000000000 Binary files a/UpgradeLog.htm and /dev/null differ diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 000000000..bddc47a5d --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,24 @@ + + + + 0.6.0-preview + latest + Jason Quense + MIT + true + git + true + true + + + True + embedded + true + 4.0.2 + + + + + + + diff --git a/src/GraphQL.Relay.StarWars/GraphQL.Relay.StarWars.csproj b/src/GraphQL.Relay.StarWars/GraphQL.Relay.StarWars.csproj index b56fca05d..c6275a6b7 100644 --- a/src/GraphQL.Relay.StarWars/GraphQL.Relay.StarWars.csproj +++ b/src/GraphQL.Relay.StarWars/GraphQL.Relay.StarWars.csproj @@ -1,6 +1,7 @@  net5 + $(NoWarn);1591;IDE1006 diff --git a/src/GraphQL.Relay.Test/GraphQL.Relay.Test.csproj b/src/GraphQL.Relay.Test/GraphQL.Relay.Test.csproj index 01c365218..3d6906379 100644 --- a/src/GraphQL.Relay.Test/GraphQL.Relay.Test.csproj +++ b/src/GraphQL.Relay.Test/GraphQL.Relay.Test.csproj @@ -2,12 +2,13 @@ net5 + $(NoWarn);1591;IDE1006 - + - + diff --git a/src/GraphQL.Relay.Test/Types/QueryGraphTypeTests.cs b/src/GraphQL.Relay.Test/Types/QueryGraphTypeTests.cs index 26553b580..dee080454 100644 --- a/src/GraphQL.Relay.Test/Types/QueryGraphTypeTests.cs +++ b/src/GraphQL.Relay.Test/Types/QueryGraphTypeTests.cs @@ -38,7 +38,11 @@ public override SimpleData GetById(string id) => SimpleData public class SimpleSchema : Schema { - public SimpleSchema() => (Query) = (new QueryGraphType()); + public SimpleSchema() + { + Query = new QueryGraphType(); + RegisterType(new SimpleNodeGraphType()); + } } public class QueryGraphTypeTests diff --git a/src/GraphQL.Relay.Todo/GraphQL.Relay.Todo.csproj b/src/GraphQL.Relay.Todo/GraphQL.Relay.Todo.csproj index 4e0b6e4b7..3c1b9315c 100644 --- a/src/GraphQL.Relay.Todo/GraphQL.Relay.Todo.csproj +++ b/src/GraphQL.Relay.Todo/GraphQL.Relay.Todo.csproj @@ -2,13 +2,9 @@ net5 + $(NoWarn);1591;IDE1006 - - - - - diff --git a/src/GraphQL.Relay/GraphQL.Relay.csproj b/src/GraphQL.Relay/GraphQL.Relay.csproj index fb8ae0ae8..c231f2b8a 100644 --- a/src/GraphQL.Relay/GraphQL.Relay.csproj +++ b/src/GraphQL.Relay/GraphQL.Relay.csproj @@ -1,14 +1,7 @@  - Jason Quense - 0.6.0-pre3 netstandard2.0 GraphQL;Relay;React - https://github.com/graphql-dotnet/relay - https://github.com/graphql-dotnet/relay/blob/master/LICENSE.md - false - false - false diff --git a/src/GraphQL.Relay/Properties/AssemblyInfo.cs b/src/GraphQL.Relay/Properties/AssemblyInfo.cs deleted file mode 100644 index 01f9d8538..000000000 --- a/src/GraphQL.Relay/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("GraphQL.Relay")] -[assembly: AssemblyTrademark("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("46076f16-c4f7-4879-903d-70d75dd8b3ef")]