Browse Source

Add GH Workflow for CI Tests (#10392)

Co-authored-by: Cody Robibero <cody@robibe.ro>
DavidFair 1 year ago
parent
commit
9b5930d7d8

+ 0 - 0
.github/workflows/codeql-analysis.yml → .github/workflows/ci-codeql-analysis.yml


+ 0 - 0
.github/workflows/openapi.yml → .github/workflows/ci-openapi.yml


+ 50 - 0
.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"

+ 2 - 21
.github/workflows/repo-stale.yaml → .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.

+ 1 - 14
.github/workflows/automation.yml → .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

+ 23 - 0
.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 }}

+ 30 - 0
.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.

+ 0 - 0
.github/workflows/repo-bump-version.yaml → .github/workflows/release-bump-version.yaml