Skip to content

Commit c4d75f1

Browse files
authored
feat: CI improvements
GitHub: Improved CI
2 parents 60704ed + c0aefcb commit c4d75f1

File tree

5 files changed

+105
-130
lines changed

5 files changed

+105
-130
lines changed

.github/workflows/ci.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Octokit.GraphQL CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- 'docs/**'
9+
- '*.md'
10+
pull_request:
11+
paths-ignore:
12+
- 'docs/**'
13+
- '*.md'
14+
workflow_dispatch:
15+
16+
env:
17+
CONFIGURATION: 'Release'
18+
ARTIFACTS_STAGING_DIR_PATH: '${{ github.workspace }}/nupkg'
19+
OG_SOLUTION_PATH: '${{ github.workspace }}/Octokit.GraphQL.sln'
20+
OG_UNIT_TESTS_PROJ_PATH: '${{ github.workspace }}/src/Octokit.GraphQL.UnitTests/Octokit.GraphQL.UnitTests.csproj'
21+
OG_CORE_UNIT_TESTS_PROJ_PATH: '${{ github.workspace }}/src/Octokit.GraphQL.Core.UnitTests/Octokit.GraphQL.Core.UnitTests.csproj'
22+
OG_CORE_GENERATOR_UNIT_TESTS_PROJ_PATH: '${{ github.workspace }}/src/Octokit.GraphQL.Core.Generation.UnitTests/Octokit.GraphQL.Core.Generation.UnitTests.csproj'
23+
OG_INTEGRATION_TESTS_PROJ_PATH: '${{ github.workspace }}/src/Octokit.GraphQL.IntegrationTests/Octokit.GraphQL.IntegrationTests.csproj'
24+
OG_PACK_PROJ_PATH: '${{ github.workspace }}/src/Octokit.GraphQL.Pack/Octokit.GraphQL.Pack.csproj'
25+
26+
jobs:
27+
build:
28+
runs-on: ubuntu-latest
29+
steps:
30+
31+
- name: Checkout the repository
32+
uses: actions/checkout@v4
33+
- name: Setup .NET
34+
uses: actions/setup-dotnet@v4
35+
with:
36+
dotnet-version: 3.1.101
37+
- name: Setup NuGet
38+
uses: nuget/setup-nuget@v2
39+
40+
- name: Build the solution
41+
run: dotnet build ${{ env.OG_SOLUTION_PATH }} -c ${{ env.CONFIGURATION }}
42+
43+
test:
44+
runs-on: ubuntu-latest
45+
steps:
46+
47+
- name: Checkout the repository
48+
uses: actions/checkout@v4
49+
- name: Setup .NET
50+
uses: actions/setup-dotnet@v4
51+
with:
52+
dotnet-version: 3.1.101
53+
- name: Setup NuGet
54+
uses: nuget/setup-nuget@v2
55+
56+
- name: Run Octokit.GraphQL.UnitTests
57+
run: 'dotnet test -c ${{ env.CONFIGURATION }} --no-build "${{ env.OG_UNIT_TESTS_PROJ_PATH }}"'
58+
59+
- name: Run Octokit.GraphQL.Core.UnitTests
60+
run: 'dotnet test -c ${{ env.CONFIGURATION }} --no-build "${{ env.OG_CORE_UNIT_TESTS_PROJ_PATH }}"'
61+
62+
- name: Run Octokit.GraphQL.Core.Generation.UnitTests
63+
run: 'dotnet test -c ${{ env.CONFIGURATION }} --no-build "${{ env.OG_CORE_GENERATOR_UNIT_TESTS_PROJ_PATH }}"'
64+
65+
- name: Run Octokit.GraphQL.IntegrationTests
66+
run: 'dotnet test -c ${{ env.CONFIGURATION }} --no-build -p:CollectCoverage=true -p:CoverletOutputFormat=opencover -p:Exclude="[Octokit.GraphQL]Octokit.GraphQL.*" "${{ env.OG_INTEGRATION_TESTS_PROJ_PATH }}"'
67+
env:
68+
OCTOKIT_GQL_OAUTHTOKEN: ${{ secrets.OCTOKIT_GQL_OAUTHTOKEN }}
69+
OCTOKIT_GQL_GITHUBUSERNAME: ${{ secrets.OCTOKIT_GQL_GITHUBUSERNAME }}
70+
71+
pack:
72+
runs-on: ubuntu-latest
73+
steps:
74+
75+
- name: Checkout the repository
76+
uses: actions/checkout@v4
77+
- name: Setup .NET & GitHub Packages
78+
uses: actions/setup-dotnet@v4
79+
with:
80+
dotnet-version: 3.1.101
81+
source-url: https://nuget.pkg.github.com/octokit/index.json
82+
env:
83+
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
85+
- name: Build the solution
86+
run: 'dotnet build ${{ env.OG_SOLUTION_PATH }} -c "${{ env.CONFIGURATION }}"'
87+
88+
- name: Create the new package
89+
run: 'dotnet pack ${{ env.OG_PACK_PROJ_PATH }} -o "${{ env.ARTIFACTS_STAGING_DIR_PATH }}"'
90+
91+
- name: Publish to GitHub Actions
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: nupkg
95+
path: '${{ env.ARTIFACTS_STAGING_DIR_PATH }}/*.nupkg'
96+
97+
- name: Publish to GitHub Packages
98+
if: github.ref == 'refs/heads/main'
99+
run: 'dotnet nuget push "${{ env.ARTIFACTS_STAGING_DIR_PATH }}/*.nupkg"'
100+
101+
- name: Publish to nuget.org
102+
if: github.ref == 'refs/heads/main'
103+
run: 'dotnet nuget push "${{ env.ARTIFACTS_STAGING_DIR_PATH }}/*.nupkg" -s nuget.org -k ${{ secrets.NUGET_TOKEN }}'

.github/workflows/dotnetcore.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/workflows/generate-schema.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/integration-tests.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

Octokit.GraphQL.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.12.35209.166
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generate", "Tools\Generate\Generate.csproj", "{ECCD7CFD-C72B-4D49-81D3-76B666D81DD3}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generate", "tools\Generate\Generate.csproj", "{ECCD7CFD-C72B-4D49-81D3-76B666D81DD3}"
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{516AB6AE-153D-4776-B861-DF653A0E54BF}"
99
EndProject
1010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{369BC54B-D0C7-4F5B-BBAA-D84732192187}"
1111
ProjectSection(SolutionItems) = preProject
12-
Scripts\configure-integration-tests.ps1 = Scripts\configure-integration-tests.ps1
12+
Scripts\configure-integration-tests.ps1 = scripts\configure-integration-tests.ps1
1313
EndProjectSection
1414
EndProject
1515
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F50E915E-5C1C-4170-95B7-EA4E67D42423}"

0 commit comments

Comments
 (0)