diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..a9bad0a7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,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 }}' diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml deleted file mode 100644 index 7d5fd9c0..00000000 --- a/.github/workflows/dotnetcore.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Build, test and publish - -on: - push: - branches: - - main - paths-ignore: - - 'docs/**' - - '*.md' - pull_request: - paths-ignore: - - 'docs/**' - - '*.md' - workflow_dispatch: - -env: - CONFIGURATION: "Release" - ARTIFACTS_STAGING_DIR_PATH: "nupkg" - OG_SOLUTION_PATH: "Octokit.GraphQL.sln" - OG_UNIT_TESTS_PROJ_PATH: ".\\src\\Octokit.GraphQL.UnitTests\\Octokit.GraphQL.UnitTests.csproj" - OG_CORE_UNIT_TESTS_PROJ_PATH: ".\\src\\Octokit.GraphQL.Core.UnitTests\\Octokit.GraphQL.Core.UnitTests.csproj" - OG_CORE_GENERATOR_UNIT_TESTS_PROJ_PATH: ".\\src\\Octokit.GraphQL.Core.Generation.UnitTests\\Octokit.GraphQL.Core.Generation.UnitTests.csproj" - OG_PACK_PROJ_PATH: ".\\src\\Octokit.GraphQL.Pack\\Octokit.GraphQL.Pack.csproj" - -jobs: - build-test-publish: - runs-on: windows-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: Setup NuGet - uses: nuget/setup-nuget@v2 - - - name: Build the solution - run: dotnet build ${{ env.OG_SOLUTION_PATH }} -c ${{ env.CONFIGURATION }} - - - 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: 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 }} diff --git a/.github/workflows/generate-schema.yml b/.github/workflows/generate-schema.yml deleted file mode 100644 index 2918f7d8..00000000 --- a/.github/workflows/generate-schema.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Test Generate Schema -"on": - push: - branches: - - main - pull_request: - branches: - - main - schedule: - - cron: 0 0 * * * - workflow_dispatch: -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 3.1.x - - name: Install dependencies - run: dotnet restore - - name: Generate - run: >- - dotnet run --project ./tools/Generate/Generate.csproj -- ${{ - github.token }} ./src/Octokit.GraphQL/ - - name: Build - run: dotnet build diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml deleted file mode 100644 index d7bdd711..00000000 --- a/.github/workflows/integration-tests.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Integration tests -"on": - push: null - schedule: - - cron: 0 */24 * * * - workflow_dispatch: - watch: - types: - - started -env: - config: Release -jobs: - integration-tests: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 3.1.101 - - name: Build using .NET Core - run: dotnet build Octokit.GraphQL.sln -c ${{ env.config }} - - name: Run integration tests - run: >- - dotnet test -c ${{ env.config }} --no-build /p:CollectCoverage=true - /p:CoverletOutputFormat=opencover - /p:Exclude="[Octokit.GraphQL]Octokit.GraphQL.*" - .\src\Octokit.GraphQL.IntegrationTests\Octokit.GraphQL.IntegrationTests.csproj - env: - OCTOKIT_GQL_OAUTHTOKEN: ${{ secrets.OCTOKIT_GQL_OAUTHTOKEN }} - OCTOKIT_GQL_GITHUBUSERNAME: ${{ secrets.OCTOKIT_GQL_GITHUBUSERNAME }} diff --git a/Octokit.GraphQL.sln b/Octokit.GraphQL.sln index 58290556..7e957599 100644 --- a/Octokit.GraphQL.sln +++ b/Octokit.GraphQL.sln @@ -9,7 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{516AB6AE EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{369BC54B-D0C7-4F5B-BBAA-D84732192187}" ProjectSection(SolutionItems) = preProject - Scripts\configure-integration-tests.ps1 = Scripts\configure-integration-tests.ps1 + Scripts\configure-integration-tests.ps1 = scripts\configure-integration-tests.ps1 EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F50E915E-5C1C-4170-95B7-EA4E67D42423}" diff --git a/readme.md b/readme.md index 87aa821f..a933ec33 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@

- CI Status + CI Status CodeCov Status