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

Update CI scripts #104

Merged
merged 16 commits into from
Apr 29, 2021
Merged
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
43 changes: 43 additions & 0 deletions .github/workflows/build-artifacts-code.yml
Original file line number Diff line number Diff line change
@@ -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}}
70 changes: 70 additions & 0 deletions .github/workflows/publish-code.yml
Original file line number Diff line number Diff line change
@@ -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}`)
});
}
70 changes: 70 additions & 0 deletions .github/workflows/test-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Test code

on:
pull_request:
branches:
- master
- develop
paths:
- src/**
- .github/workflows/**
- "*.sln"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Sln file is not in the src folder. In other repositories, it is inside the src folder. What option do we choose?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it and decided it was more appropriate here because it references files in this folder and the .github folder and so on. If not, then it should be in the src folder.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sln file should not have to traverse up a directory - e.g. ../.github/workflows/testcode.yml

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the sln file used to only reference the projects, at which point it was most appropriately in the src folder. But then you/we started adding references to the documentation and other files. So now it really should be moved in the other repos.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

# 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 }}
Shane32 marked this conversation as resolved.
Show resolved Hide resolved
- 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
22 changes: 22 additions & 0 deletions .github/workflows/wipcheck.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions GraphQL.Relay.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Binary file removed UpgradeLog.htm
Binary file not shown.
24 changes: 24 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project>

<PropertyGroup>
<VersionPrefix>0.6.0-preview</VersionPrefix>
<LangVersion>latest</LangVersion>
<Authors>Jason Quense</Authors>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RepositoryType>git</RepositoryType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<Deterministic>true</Deterministic>
<!-- https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables -->
<!-- https://github.com/clairernovotny/DeterministicBuilds -->
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">True</ContinuousIntegrationBuild>
<DebugType>embedded</DebugType>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<GraphQLTestVersion>4.0.2</GraphQLTestVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" Condition="'$(IsPackable)' == 'true'"/>
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/GraphQL.Relay.StarWars/GraphQL.Relay.StarWars.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5</TargetFramework>
<NoWarn>$(NoWarn);1591;IDE1006</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GraphQL.Server.Transports.AspNetCore.SystemTextJson" Version="5.0.0" />
Expand Down
5 changes: 3 additions & 2 deletions src/GraphQL.Relay.Test/GraphQL.Relay.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

<PropertyGroup>
<TargetFramework>net5</TargetFramework>
<NoWarn>$(NoWarn);1591;IDE1006</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GraphQL.SystemTextJson" Version="4.0.2" />
<PackageReference Include="GraphQL.SystemTextJson" Version="$(GraphQLTestVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="Shouldly" Version="2.8.3" />
<PackageReference Include="Shouldly" Version="4.0.3" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
</ItemGroup>
Expand Down
6 changes: 5 additions & 1 deletion src/GraphQL.Relay.Test/Types/QueryGraphTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions src/GraphQL.Relay.Todo/GraphQL.Relay.Todo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

<PropertyGroup>
<TargetFramework>net5</TargetFramework>
<NoWarn>$(NoWarn);1591;IDE1006</NoWarn>
</PropertyGroup>

<ItemGroup>
<Folder Include="Properties\" />
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="GraphQL.Server.Transports.AspNetCore.SystemTextJson" Version="5.0.0" />
<PackageReference Include="GraphQL.Server.Ui.GraphiQL" Version="5.0.0" />
Expand Down
7 changes: 0 additions & 7 deletions src/GraphQL.Relay/GraphQL.Relay.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>Jason Quense</Authors>
<VersionPrefix>0.6.0-pre3</VersionPrefix>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageTags>GraphQL;Relay;React</PackageTags>
<PackageProjectUrl>https://github.com/graphql-dotnet/relay</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/graphql-dotnet/relay/blob/master/LICENSE.md</PackageLicenseUrl>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GraphQL" Version="4.0.2" />
Expand Down
19 changes: 0 additions & 19 deletions src/GraphQL.Relay/Properties/AssemblyInfo.cs

This file was deleted.