From 9b5930d7d86722cc8a173db4592bdcc8792f2431 Mon Sep 17 00:00:00 2001 From: DavidFair Date: Fri, 10 Nov 2023 15:12:21 +0000 Subject: [PATCH] Add GH Workflow for CI Tests (#10392) Co-authored-by: Cody Robibero --- ...ql-analysis.yml => ci-codeql-analysis.yml} | 0 .../workflows/{openapi.yml => ci-openapi.yml} | 0 .github/workflows/ci-tests.yml | 50 +++++++++++++++++++ .../{repo-stale.yaml => issue-stale.yml} | 23 +-------- ...{automation.yml => project-automation.yml} | 15 +----- .github/workflows/pull-request-conflict.yml | 23 +++++++++ .github/workflows/pull-request-stale.yaml | 30 +++++++++++ ...version.yaml => release-bump-version.yaml} | 0 8 files changed, 106 insertions(+), 35 deletions(-) rename .github/workflows/{codeql-analysis.yml => ci-codeql-analysis.yml} (100%) rename .github/workflows/{openapi.yml => ci-openapi.yml} (100%) create mode 100644 .github/workflows/ci-tests.yml rename .github/workflows/{repo-stale.yaml => issue-stale.yml} (59%) rename .github/workflows/{automation.yml => project-automation.yml} (82%) create mode 100644 .github/workflows/pull-request-conflict.yml create mode 100644 .github/workflows/pull-request-stale.yaml rename .github/workflows/{repo-bump-version.yaml => release-bump-version.yaml} (100%) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/ci-codeql-analysis.yml similarity index 100% rename from .github/workflows/codeql-analysis.yml rename to .github/workflows/ci-codeql-analysis.yml diff --git a/.github/workflows/openapi.yml b/.github/workflows/ci-openapi.yml similarity index 100% rename from .github/workflows/openapi.yml rename to .github/workflows/ci-openapi.yml diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml new file mode 100644 index 0000000000..f6cf859bcd --- /dev/null +++ b/.github/workflows/ci-tests.yml @@ -0,0 +1,50 @@ +name: Tests +on: + push: + branches: + - master + # Run tests against the forked branch, but + # do not allow access to secrets + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflows-in-forked-repositories + pull_request: + +env: + SDK_VERSION: "7.0.x" + +jobs: + run-tests: + strategy: + matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + + runs-on: "${{ matrix.os }}" + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ env.SDK_VERSION }} + + - name: Run DotNet CLI Tests + run: > + dotnet test Jellyfin.sln + --configuration Release + --collect:"XPlat Code Coverage" + --settings tests/coverletArgs.runsettings + --verbosity minimal + + - name: Merge code coverage results + uses: danielpalme/ReportGenerator-GitHub-Action@5 + with: + reports: "**/coverage.cobertura.xml" + targetdir: "merged/" + reporttypes: "Cobertura" + + # TODO - which action / tool to use to publish code coverage results? + # - name: Publish code coverage results + + - name: Publish OpenAPI Artifact + uses: actions/upload-artifact@v3 + with: + name: "OpenAPI Spec" + path: "tests/Jellyfin.Server.Integration.Tests/bin/Release/net*/openapi.json" diff --git a/.github/workflows/repo-stale.yaml b/.github/workflows/issue-stale.yml similarity index 59% rename from .github/workflows/repo-stale.yaml rename to .github/workflows/issue-stale.yml index f9075ba03a..926a7fbfb0 100644 --- a/.github/workflows/repo-stale.yaml +++ b/.github/workflows/issue-stale.yml @@ -1,4 +1,4 @@ -name: Stale Check +name: Stale Issue Labeler on: schedule: @@ -28,27 +28,8 @@ jobs: exempt-issue-labels: regression,security,roadmap,future,feature,enhancement,confirmed stale-issue-label: stale stale-issue-message: |- - This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs. + This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs. If you have any questions you can use one of several ways to [contact us](https://jellyfin.org/contact). close-issue-message: |- This issue was closed due to inactivity. - - prs-conflicts: - name: Check PRs with merge conflicts - runs-on: ubuntu-latest - if: ${{ contains(github.repository, 'jellyfin/') }} - steps: - - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8.0.0 - with: - repo-token: ${{ secrets.JF_BOT_TOKEN }} - ascending: true - operations-per-run: 150 - # The merge conflict action will remove the label when updated - remove-stale-when-updated: false - days-before-stale: -1 - days-before-close: 90 - days-before-issue-close: -1 - stale-pr-label: merge conflict - close-pr-message: |- - This PR has been closed due to having unresolved merge conflicts. diff --git a/.github/workflows/automation.yml b/.github/workflows/project-automation.yml similarity index 82% rename from .github/workflows/automation.yml rename to .github/workflows/project-automation.yml index 47abce02a3..3637eb16ad 100644 --- a/.github/workflows/automation.yml +++ b/.github/workflows/project-automation.yml @@ -1,4 +1,4 @@ -name: Automation +name: Project Automation on: push: @@ -9,19 +9,6 @@ on: permissions: {} jobs: - label: - name: Labeling - runs-on: ubuntu-latest - if: ${{ github.repository == 'jellyfin/jellyfin' }} - steps: - - name: Apply label - uses: eps1lon/actions-label-merge-conflict@fd1f295ee7443d13745804bc49fe158e240f6c6e # tag=v2.1.0 - if: ${{ github.event_name == 'push' || github.event_name == 'pull_request_target'}} - with: - dirtyLabel: 'merge conflict' - commentOnDirty: 'This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.' - repoToken: ${{ secrets.JF_BOT_TOKEN }} - project: name: Project board runs-on: ubuntu-latest diff --git a/.github/workflows/pull-request-conflict.yml b/.github/workflows/pull-request-conflict.yml new file mode 100644 index 0000000000..05517bb030 --- /dev/null +++ b/.github/workflows/pull-request-conflict.yml @@ -0,0 +1,23 @@ +name: Merge Conflict Labeler + +on: + push: + branches: + - master + pull_request_target: + issue_comment: + +permissions: {} +jobs: + label: + name: Labeling + runs-on: ubuntu-latest + if: ${{ github.repository == 'jellyfin/jellyfin' }} + steps: + - name: Apply label + uses: eps1lon/actions-label-merge-conflict@fd1f295ee7443d13745804bc49fe158e240f6c6e # tag=v2.1.0 + if: ${{ github.event_name == 'push' || github.event_name == 'pull_request_target'}} + with: + dirtyLabel: 'merge conflict' + commentOnDirty: 'This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.' + repoToken: ${{ secrets.JF_BOT_TOKEN }} diff --git a/.github/workflows/pull-request-stale.yaml b/.github/workflows/pull-request-stale.yaml new file mode 100644 index 0000000000..de093a9887 --- /dev/null +++ b/.github/workflows/pull-request-stale.yaml @@ -0,0 +1,30 @@ +name: Stale PR Check + +on: + schedule: + - cron: '30 */12 * * *' + workflow_dispatch: + +permissions: + pull-requests: write + actions: write + +jobs: + prs-stale-conflicts: + name: Check PRs with merge conflicts + runs-on: ubuntu-latest + if: ${{ contains(github.repository, 'jellyfin/') }} + steps: + - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8.0.0 + with: + repo-token: ${{ secrets.JF_BOT_TOKEN }} + ascending: true + operations-per-run: 150 + # The merge conflict action will remove the label when updated + remove-stale-when-updated: false + days-before-stale: -1 + days-before-close: 90 + days-before-issue-close: -1 + stale-pr-label: merge conflict + close-pr-message: |- + This PR has been closed due to having unresolved merge conflicts. diff --git a/.github/workflows/repo-bump-version.yaml b/.github/workflows/release-bump-version.yaml similarity index 100% rename from .github/workflows/repo-bump-version.yaml rename to .github/workflows/release-bump-version.yaml