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